473,387 Members | 3,821 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

CeSetUserNotificationEx troubles

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
2 5241
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

33
by: Darren Dale | last post by:
I love the language. I love the community. My only complaint is that Python for Windows is built with Visual Studio. It is too difficult to build python, or a module, from source. This is what...
0
by: lmckaha | last post by:
Hi, Mysql version: 3.23.49 Solaris version: 2.7 gcc compiler version: 2.95.2 Python : 2.2.2 I'm evaluating the C and C++ API to decide which one to bye but I have many troubles.
3
by: Mr. B | last post by:
GRRRR... I've run across a situation in which I have NO solution. Hopefully there is one. VB.net. It's rather simple. I've a ComboBox that get's populated via a Database. And I pre-select...
4
by: jernej goricki | last post by:
Hy I'm trying to edit a XSLT document, just like I'm editing a XML document : (Im trying to make a new xsl:template tag here ) Dim myXml As New XmlDocument()...
4
by: Edwin G. Castro | last post by:
I want to start a process from a C# application. I also want to redirect standard error to standard output so that I can read output from both streams just like I could from a command line. In...
0
by: Stefan Slapeta | last post by:
Hi all, I've experienced some troubles with message tables and wanted to know if anybody knows a solution for one of them: - If I translate my .mc file into a Unicode .bin file, some of the...
0
by: Michal | last post by:
I have troubles with instaling .Net Framework 2.0 (Beta 2 - 2.0.50215). The main instalation went just fine, troubles begin with my attemt to run aspnet_regiss.exe -i. Asp.Net is instaled into IIS...
0
by: JohnIdol | last post by:
VC++6 to VC++2003 - linking troubles -------------------------------------------------------------------------------- Hi All, I successfully ported an application from VC++6 to VS2003. Solved...
1
by: Pegasus | last post by:
Good morning, I'm Filippo Battaglia. We're porting Apache STDCXX under Nanodesktop. We are trying to make nd compatible also with C++ and not only with C. Unfortunately, we're finding different...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.