UnManaged SIP & Managed app

G

Guest

Hi,
I have a nice full screen SIP that is invoked everytime the user wants to
key in information from my Managed application running on the Windows CE.NET
device. There is also a screen saver that kicks in whenever the app go to
idle state for more than x minutes... The issue I have is after the SIP is
invoked and the user keys in data for minutes greater than x then the managed
app does not hear any activity from the unmanaged sip and will kick up the
screen saver. Only when the user presses enter or close I call the SendString
function of IIMCallback and the string reaches the managed app.

My efforts to send heartbeat messages and user messages from unmanaged
code did not work as they are not being received at the managed app. Has
anyone done something like this? I tried another approach.

I wrote a small function that would have a dirty flag globally
accessible between the classes in SIP implementation and the P/Invoked export
function. I set the flag to true when the user has any sip activity from
within the UI classes in the custom SIP...But to my surprise... the static
bool variable does not retain the value when I query from the managed code...
Will a global static bool in C++ retain values across P/Invokes? I always get
the same value from C# on P/Invoking!

Unmanaged code
-------------------------------------------
CPanel::processKey()
{
.....
IsDirty(true, true);
}
static bool bRet=false;
EXTERN_C __declspec(dllexport) bool IsDirty(bool bSet, bool bVal=false)
{
if (bSet)
bRet = bVal;
return bRet;
}

Managed Code
-----------------------------
[ DllImport( "customsip.dll" ) ]
public static extern bool IsDirty(bool bSet, bool bVal);

public void Show()
{
try
{
......
bool nRet = IsDirty(false,false);
}

The return value nRet is true always even though I set it to true when I the
user enters any keys and false on Enter or Close. Tried keeping the static
bool inside the exported function IsDirty and the result is the same. I tried
with int and I will get 0 all the time.

Thanks for helping.
Praveen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top