Run Pocket PC 2003 aplication After Active Sync Connection set

  • Thread starter Thread starter Hassan Wasel
  • Start date Start date
H

Hassan Wasel

Hi Everybody,
I want to run a PocketPC 2003 application at the end of Active Sync
Connection. I wrote the following application to test this function
CeRunAppAtEvent(). I got no application at the end of sync.

// PDAClientRunSetter.cpp : Defines the entry point for the application.
//

#include "stdafx.h"
#include <notify.h>

int WINAPI WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
CeRunAppAtEvent(_T("\\Windows\\Calc.exe"),NOTIFICATION_EVENT_NONE);
return
CeRunAppAtEvent(_T("\\Windows\\CloseAS.exe"),NOTIFICATION_EVENT_SYNC_END);

}

Any comments will be highly apperiated.

Thanks in advance.

Hassan Wasel
 
The event NOTIFICATION_EVENT_SYNC_END is only triggered after a manually
triggered sync, not when your device automatically syncs on connection to
the PC. Therefore after the user clicks the Sync button in ActiveSync.
If you want to run a process on every connect to the desktop you'll find
NOTIFICATION_EVENT_NET_CONNECT more reliable, since it will be triggered at
the beginning of each connection, though you'll need to determine whether
the current connection is ActiveSync or another network connection such as
GPRS. If you try to resolve the hostname PPP_PEER this will indicate that
you are connected to activesync.

Peter

--
Peter Foot
Windows Embedded MVP
www.inthehand.com | www.opennetcf.org

Do have an opinion on the effectiveness of Microsoft Windows Mobile and
Embedded newsgroups? Let us know!
https://www.windowsembeddedeval.com/community/newsgroups
 
Peter said:
The event NOTIFICATION_EVENT_SYNC_END is only triggered after a manually
triggered sync, not when your device automatically syncs on connection to
the PC. Therefore after the user clicks the Sync button in ActiveSync.
If you want to run a process on every connect to the desktop you'll find
NOTIFICATION_EVENT_NET_CONNECT more reliable, since it will be triggered at
the beginning of each connection, though you'll need to determine whether
the current connection is ActiveSync or another network connection such as
GPRS. If you try to resolve the hostname PPP_PEER this will indicate that
you are connected to activesync.

Peter

Thanks for your fast reply.
But even when I try NOTIFICATION_EVENT_NET_CONNECT, without checking the
host name, It didn't work when I put the PDA in the cradle, the
calculator didn't work.

Hassan

// PDAClientRunSetter.cpp : Defines the entry point for the application.
//

#include "stdafx.h"
#include <notify.h>

int WINAPI WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
CeRunAppAtEvent(_T("\\Windows\\Calc.exe"),NOTIFICATION_EVENT_NONE);
return
CeRunAppAtEvent(_T("\\Windows\\Calc.exe"),NOTIFICATION_EVENT_NET_CONNECT);
}
 
Back
Top