By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,667 Members | 1,219 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,667 IT Pros & Developers. It's quick & easy.

CeSetUserNotificationEx troubles

P: n/a
Hi everyone,

I've been trying out examples and reading documentation
on CeSetUserNotificationEx for a couple days now and
still cannot find the problem in my code. All I want to
do is launch an application when the PPC wakes up. I'm
deploying the solution on a Siemens SX56 with PPC
3.0.12039.

Here's my code. CeSetUserNotificationEx always returns
me an IntPtr.Zero regardless of what I try.

public class Utils
{

[DllImport("coredll.dll", SetLastError=true)]
private static extern IntPtr CeSetUserNotificationEx(
IntPtr h,
CE_NOTIFICATION_TRIGGER nt,
CE_USER_NOTIFICATION un
) ;

private unsafe class CE_NOTIFICATION_TRIGGER
{
public UInt32 dwSize;
public UInt32 dwEvent;
public UInt32 dwType;
public char *lpszApplication;
public char *lpszArguments;
public SystemTime startTime ;
public SystemTime endTime ;
}

private unsafe class CE_USER_NOTIFICATION
{
public UInt32 ActionFlags ;
public char *pDialogTitle ;
public char *DialogText ;
public char *Sound ;
public UInt32 MaxSound ;
public UInt32 Reserved ;
}

public struct SystemTime
{
public UInt16 Year ;
public UInt16 Month ;
public UInt16 DayOfWeek ;
public UInt16 Day ;
public UInt16 Hour ;
public UInt16 Minute ;
public UInt16 Second ;
public UInt16 MilliSecond ;
}

struct Constants
{
public const int NOTIFICATION_EVENT_NONE = 0;
public const int CNT_EVENT = 1;
public const int NOTIFICATION_EVENT_WAKEUP = 11;
}

public unsafe static void AttachAppToStartup(
string executable, string arguments )
{
CE_NOTIFICATION_TRIGGER nt =
new CE_NOTIFICATION_TRIGGER();
CE_USER_NOTIFICATION un =
new CE_USER_NOTIFICATION();
IntPtr h;

try
{

fixed( char *appName =
executable.ToCharArray() )
{

if( ( arguments == null ) ||
( arguments.Length == 0 ) )
{
arguments = " ";
}

fixed( char *appArgs =
arguments.ToCharArray() )
{

nt.dwSize = (uint)Marshal.SizeOf( typeof
(CE_NOTIFICATION_TRIGGER) );
nt.dwType = Constants.CNT_EVENT;
nt.dwEvent = Constants.NOTIFICATION_EVENT_NONE;
nt.lpszApplication = appName;
nt.lpszArguments = appArgs;

h = CeSetUserNotificationEx(IntPtr.Zero, nt, un) ;

MessageBox.Show( "h is " +
( (h!=IntPtr.Zero) ? "not " : "" ) +
"null." );

}
}
}
catch( Exception E )
{
MessageBox.Show( E.ToString() );
}
}

}

--------------------------

This is the method in a Windows Form object that calls
the wrapper.

private void menuItem1_Click
(object sender, System.EventArgs e)
{
string executable =
Assembly.GetExecutingAssembly().GetModules()
[0].FullyQualifiedName;
Utils.AttachAppToStartup( executable, null );
}

I appreciate any help you can provide!

CR
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi,

Take a look at http://www.innovativedss.com/forums/...p?TOPIC_ID=127

also , I think that you will find better answers in the
microsoft.public.dotnet.framework.compactframework NG

Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"CR6485" <fe********@hotmail.com> wrote in message
news:0a****************************@phx.gbl...
Hi everyone,

I've been trying out examples and reading documentation
on CeSetUserNotificationEx for a couple days now and
still cannot find the problem in my code. All I want to
do is launch an application when the PPC wakes up. I'm
deploying the solution on a Siemens SX56 with PPC
3.0.12039.

Here's my code. CeSetUserNotificationEx always returns
me an IntPtr.Zero regardless of what I try.

public class Utils
{

[DllImport("coredll.dll", SetLastError=true)]
private static extern IntPtr CeSetUserNotificationEx(
IntPtr h,
CE_NOTIFICATION_TRIGGER nt,
CE_USER_NOTIFICATION un
) ;

private unsafe class CE_NOTIFICATION_TRIGGER
{
public UInt32 dwSize;
public UInt32 dwEvent;
public UInt32 dwType;
public char *lpszApplication;
public char *lpszArguments;
public SystemTime startTime ;
public SystemTime endTime ;
}

private unsafe class CE_USER_NOTIFICATION
{
public UInt32 ActionFlags ;
public char *pDialogTitle ;
public char *DialogText ;
public char *Sound ;
public UInt32 MaxSound ;
public UInt32 Reserved ;
}

public struct SystemTime
{
public UInt16 Year ;
public UInt16 Month ;
public UInt16 DayOfWeek ;
public UInt16 Day ;
public UInt16 Hour ;
public UInt16 Minute ;
public UInt16 Second ;
public UInt16 MilliSecond ;
}

struct Constants
{
public const int NOTIFICATION_EVENT_NONE = 0;
public const int CNT_EVENT = 1;
public const int NOTIFICATION_EVENT_WAKEUP = 11;
}

public unsafe static void AttachAppToStartup(
string executable, string arguments )
{
CE_NOTIFICATION_TRIGGER nt =
new CE_NOTIFICATION_TRIGGER();
CE_USER_NOTIFICATION un =
new CE_USER_NOTIFICATION();
IntPtr h;

try
{

fixed( char *appName =
executable.ToCharArray() )
{

if( ( arguments == null ) ||
( arguments.Length == 0 ) )
{
arguments = " ";
}

fixed( char *appArgs =
arguments.ToCharArray() )
{

nt.dwSize = (uint)Marshal.SizeOf( typeof
(CE_NOTIFICATION_TRIGGER) );
nt.dwType = Constants.CNT_EVENT;
nt.dwEvent = Constants.NOTIFICATION_EVENT_NONE;
nt.lpszApplication = appName;
nt.lpszArguments = appArgs;

h = CeSetUserNotificationEx(IntPtr.Zero, nt, un) ;

MessageBox.Show( "h is " +
( (h!=IntPtr.Zero) ? "not " : "" ) +
"null." );

}
}
}
catch( Exception E )
{
MessageBox.Show( E.ToString() );
}
}

}

--------------------------

This is the method in a Windows Form object that calls
the wrapper.

private void menuItem1_Click
(object sender, System.EventArgs e)
{
string executable =
Assembly.GetExecutingAssembly().GetModules()
[0].FullyQualifiedName;
Utils.AttachAppToStartup( executable, null );
}

I appreciate any help you can provide!

CR

Nov 13 '05 #2

P: n/a
I'll give it a shot.

Thanks!
-----Original Message-----
Hi,

Take a look at http://www.innovativedss.com/forums/...p?TOPIC_ID=127
also , I think that you will find better answers in the
microsoft.public.dotnet.framework.compactframewor k NG

Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"CR6485" <fe********@hotmail.com> wrote in message
news:0a****************************@phx.gbl...
Hi everyone,

I've been trying out examples and reading documentation
on CeSetUserNotificationEx for a couple days now and
still cannot find the problem in my code. All I want to do is launch an application when the PPC wakes up. I'm
deploying the solution on a Siemens SX56 with PPC
3.0.12039.

Here's my code. CeSetUserNotificationEx always returns
me an IntPtr.Zero regardless of what I try.

public class Utils
{

[DllImport("coredll.dll", SetLastError=true)]
private static extern IntPtr CeSetUserNotificationEx(
IntPtr h,
CE_NOTIFICATION_TRIGGER nt,
CE_USER_NOTIFICATION un
) ;

private unsafe class CE_NOTIFICATION_TRIGGER
{
public UInt32 dwSize;
public UInt32 dwEvent;
public UInt32 dwType;
public char *lpszApplication;
public char *lpszArguments;
public SystemTime startTime ;
public SystemTime endTime ;
}

private unsafe class CE_USER_NOTIFICATION
{
public UInt32 ActionFlags ;
public char *pDialogTitle ;
public char *DialogText ;
public char *Sound ;
public UInt32 MaxSound ;
public UInt32 Reserved ;
}

public struct SystemTime
{
public UInt16 Year ;
public UInt16 Month ;
public UInt16 DayOfWeek ;
public UInt16 Day ;
public UInt16 Hour ;
public UInt16 Minute ;
public UInt16 Second ;
public UInt16 MilliSecond ;
}

struct Constants
{
public const int NOTIFICATION_EVENT_NONE = 0;
public const int CNT_EVENT = 1;
public const int NOTIFICATION_EVENT_WAKEUP = 11;
}

public unsafe static void AttachAppToStartup(
string executable, string arguments )
{
CE_NOTIFICATION_TRIGGER nt =
new CE_NOTIFICATION_TRIGGER();
CE_USER_NOTIFICATION un =
new CE_USER_NOTIFICATION();
IntPtr h;

try
{

fixed( char *appName =
executable.ToCharArray() )
{

if( ( arguments == null ) ||
( arguments.Length == 0 ) )
{
arguments = " ";
}

fixed( char *appArgs =
arguments.ToCharArray() )
{

nt.dwSize = (uint)Marshal.SizeOf( typeof
(CE_NOTIFICATION_TRIGGER) );
nt.dwType = Constants.CNT_EVENT;
nt.dwEvent = Constants.NOTIFICATION_EVENT_NONE;
nt.lpszApplication = appName;
nt.lpszArguments = appArgs;

h = CeSetUserNotificationEx(IntPtr.Zero, nt, un) ;
MessageBox.Show( "h is " +
( (h!=IntPtr.Zero) ? "not " : "" ) +
"null." );

}
}
}
catch( Exception E )
{
MessageBox.Show( E.ToString() );
}
}

}

--------------------------

This is the method in a Windows Form object that calls
the wrapper.

private void menuItem1_Click
(object sender, System.EventArgs e)
{
string executable =
Assembly.GetExecutingAssembly().GetModules()
[0].FullyQualifiedName;
Utils.AttachAppToStartup( executable, null );
}

I appreciate any help you can provide!

CR

.

Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.