x
This website is using cookies. We use cookies to ensure that we give you the best experience on our website. More info. That's Fine
HPC:Factor Logo 
 
Latest Forum Activity

Using "CeRunAppAtEvent" function for HPC/Pro device

Snappy! Page Icon Posted 2005-01-23 2:47 PM
#
Avatar image of Snappy!
H/PC Elder

Posts:
1,712
Location:
New Mexico, US
Status:
Hi all.

Anyone used "CeRunAppAtEvent" for HPC/Pro handheld yet?

I checked the HPC/Pro SDK and it is supposed to be supported, but a compile would generate error.

Specifically ...

++++++++++code snippet++++++++++++++
TCHAR szAppName[MAX_PATH];
GetModuleFileName(NULL, szAppName, MAX_PATH);

if (m_bAutorun)
{
SYSTEMTIME timeNow;
GetSystemTime(&timeNow);

CeRunAppAtEvent(szAppName, NOTIFICATION_EVENT_WAKEUP);
}
++++++++++code snippet++++++++++++++

Somehow the constant "NOTIFICATION_EVENT_WAKEUP" is only defined in HPC2000 SDK!!! This is so wierd. And a check with MSDN shows that HPC/Pro SDK/documentation is non existent! Only 3.0 and above is available.

Any idea?
 Top of the page
C:Amie Page Icon Posted 2005-01-23 3:05 PM
#
Avatar image of C:Amie
Administrator
H/PC Oracle

Posts:
17,979
Location:
United Kingdom
Status:
What is the error that you are getting back from the debugger?
 Top of the page
Snappy! Page Icon Posted 2005-01-23 9:37 PM
#
Avatar image of Snappy!
H/PC Elder

Posts:
1,712
Location:
New Mexico, US
Status:
ooops ... I included everything but the error!!! hahaha

Prob#1
I had to explicitly declare the NOTIFICATION_EVENT_WAKEUP as it is not found in the notify.h file for HPC/Pro SDK although its suppose to be included/supported in HPC/Pro SDK.

#ifndef NOTIFICATION_EVENT_WAKEUP
#define NOTIFICATION_EVENT_WAKEUP 11
#endif

Prob#2
ok, at compile time or rather linking time I get ...

C:\Windows CE Tools\wce211\MS HPC PRO\include\Notify.h(167): Could not find the file pnotify.h.
C:\Windows CE Tools\wce211\MS HPC PRO\include\Notify.h(169): Could not find the file mnotify.h.

Prob#3
Now it seems like it has no error on the emulator which is HPC/Pro, but on my MP790, it basically says "An unsupported operation was attempted."

 Top of the page
C:Amie Page Icon Posted 2005-01-24 9:12 AM
#
Avatar image of C:Amie
Administrator
H/PC Oracle

Posts:
17,979
Location:
United Kingdom
Status:
CeRunAppAtEvent
This function starts running an application when a specified event occurs.

At a Glance
Header file: Notify.h
Windows CE versions: 1.01 and later


Syntax
BOOL CeRunAppAtEvent(TCHAR *pwszAppName, LONG lWhichEvent);

Parameters
pwszAppName
[in] Pointer to a null-terminated string that specifies the name of the application to be started.
lWhichEvent
[in] Event at which the application is to be started. It is one of the following values:
NOTIFICATION_EVENT_NONE
No events—remove all event registrations for this application.
NOTIFICATION_EVENT_SYNC_END
When data synchronization finishes.
NOTIFICATION_EVENT_DEVICE_CHANGE
When a PC Card device is changed.
NOTIFICATION_EVENT_RS232_DETECTED
When an RS232 connection is made.
NOTIFICATION_EVENT_TIME_CHANGE
When the system time is changed.
NOTIFICATION_EVENT_RESTORE_END
When a full device data restore completes.
Return Values
TRUE indicates success. FALSE indicates failure.

Remarks
The application is started with a system-defined command line. If there was already an instance of the application running, the new instance must send a private message to the existing instance and then shut down. The command line, which corresponds to the registered event, can be one of the following string constants.

Constant Value
APP_RUN_AFTER_SYNC “AppRunAfterSync”
APP_RUN_AT_AC_POWER_ON “AppRunAtAcPowerOn”
APP_RUN_AT_AC_POWER_OFF “AppRunAtAcPowerOff”
APP_RUN_AT_NET_CONNECT “AppRunAtNetConnect”
APP_RUN_AT_NET_DISCONNECT “AppRunAtNetDisconnect”
APP_RUN_AT_DEVICE_CHANGE “AppRunDeviceChange”
APP_RUN_AT_IR_DISCOVERY “AppRunAtIrDiscovery”
APP_RUN_AT_RS232_DETECT “AppRunAtRs232Detect”
APP_RUN_AFTER_RESTORE “AppRunAfterRestore”


The string values in this table are processed as command line commands. In some cases, the part of the command line that follows the string is treated as a parameter.

Use the CeRunAppAtEvent function sparingly, because automatically starting an application can confuse the user and cause low-memory conditions on a machine with restricted memory. Ideally, the application should be small and non-intrusive.

The following constants are defined in the header file, but they are not supported:

NOTIFICATION_EVENT_IR_DISCOVERED
NOTIFICATION_EVENT_NET_CONNECT
NOTIFICATION_EVENT_NET_DISCONNECT
NOTIFICATION_EVENT_OFF_AC_POWER
NOTIFICATION_EVENT_ON_AC_POWER

That is from the CE 2.1x API reference, I don't see NOTIFICATION_EVENT_WAKEUP listed for CeRunAppAtEvent.
It does say on MSDN that the API was changed after the 2.12 release making CeRunAppAtEvent a legacy call.
Could it be that NOTIFICATION_EVENT_WAKEUP is a 2.12 API that was subsequently made rudundant in 3.00 - but never existed in 2.10 / 2.11?
I am sure Chiark will know better than I.
 Top of the page
Snappy! Page Icon Posted 2005-01-24 12:52 PM
#
Avatar image of Snappy!
H/PC Elder

Posts:
1,712
Location:
New Mexico, US
Status:
C:aime, thanks for the info.
Strangely, from the HPC/Pro SDK I installed, NOTIFICATION_EVENT_WAKEUP is actually defined, but when I look into notify.h, it is only defined in the HPC2000 SDK and not the HPC/Pro SDK. Looks like another slip-up on MS part!

ok, here's an update on the app.

I tested the build on my MP790 and its working fine right now. The unsupported error was a bug on my part! but I have no idea if it works on HPC/Pro devices. Anyone with a 780 willing to try it out?

On the emulator, it does not work at all, but I dunno if its just the emulator. So, is there any other way to schedule an app to start for HPC/Pro devices? Else, I will have to detect platform type and disable the autorun option.
 Top of the page
C:Amie Page Icon Posted 2005-01-24 2:03 PM
#
Avatar image of C:Amie
Administrator
H/PC Oracle

Posts:
17,979
Location:
United Kingdom
Status:
^^
I have a MIPS IBM z50, HPC Pro, 640x480 display. Which I can test with if you like.
(Although you probably should remind me of the application... the html control viewer?)
 Top of the page
Snappy! Page Icon Posted 2005-01-24 11:44 PM
#
Avatar image of Snappy!
H/PC Elder

Posts:
1,712
Location:
New Mexico, US
Status:
gee thanks! ... nah, its not the simple browser ... that is temporarily shelved! ... its a daily readings app. How shall I send it to you? This app for testing? oh ya, let me pm you the url!
 Top of the page
C:Amie Page Icon Posted 2005-01-25 8:19 AM
#
Avatar image of C:Amie
Administrator
H/PC Oracle

Posts:
17,979
Location:
United Kingdom
Status:
I've received your PM, will look into it later on today and get back to you here.
 Top of the page
C:Amie Page Icon Posted 2005-01-25 10:02 AM
#
Avatar image of C:Amie
Administrator
H/PC Oracle

Posts:
17,979
Location:
United Kingdom
Status:
OK, I looked at the app. Nice work.

I've sent you a couple of screen shots to your forum registered mail address - I wasn't sure if you wanted it publicised here or not, so I will be non-descript.

As you will see from the screen shots the system seems to have worked correctly, and the bell tolls too

You will also see from the screen shot the down side of using fix sized window measurements. I would suggest that perhaps you detach it completly and make the application a floating window, get it to load screen centred.
You could percievably have a problem with the original specification 480x240 H/PCs (which are the base window size an app needs to support) doing that, but I think that having it full screen on a 640x480 or 800x400 H/PC just to too imposing IMHO.

Great work though. The platform needs things like this.
 Top of the page
Snappy! Page Icon Posted 2005-01-25 11:06 AM
#
Avatar image of Snappy!
H/PC Elder

Posts:
1,712
Location:
New Mexico, US
Status:
Gee ... thanks for your kind words! ...

Ya, I'm trying to figure out the screen size thingie. I originally had it centred ... but the emulator always shows it differently from on my MP790!

So I end up fixing it to 0,0 origin and maxing out the width ... but the bottom is empty. Its actually a floating dialog box ... without the title bar.

Please let me know how the new build works ya? Thanks!
 Top of the page
C:Amie Page Icon Posted 2005-01-25 11:08 AM
#
Avatar image of C:Amie
Administrator
H/PC Oracle

Posts:
17,979
Location:
United Kingdom
Status:
Already have. Check your email.
 Top of the page
Snappy! Page Icon Posted 2005-01-25 11:15 AM
#
Avatar image of Snappy!
H/PC Elder

Posts:
1,712
Location:
New Mexico, US
Status:
Thanks for your help! Now I know that CeRunAtTime works on HPCPros as well ...
 Top of the page
Jump to forum:
Seconds to generate: 0.219 - Cached queries : 69 - Executed queries : 9