I have a Pocket PC application (C#, .NET on Mobile 5) and I need to determine
either: 1) when the Pocket PC is connected with the host PC through
ActiveSync, or 2) when one or more files are deleted from a Pocket PC
directory - these are deleted by a host PC application using RAPI. Is there a
way for my PPC to get either notification?

Re: How to get notified in PPC application when PPC is sync'd by r_z_aret

r_z_aret
Tue May 08 15:56:21 CDT 2007

On Tue, 8 May 2007 11:23:01 -0700, snohelty
<snohelty@discussions.microsoft.com> wrote:

>I have a Pocket PC application (C#, .NET on Mobile 5) and I need to determine
>either: 1) when the Pocket PC is connected with the host PC through
>ActiveSync,

For info on how a _desktop_ application can determine when an
ActiveSync connection is made, use google
(http://groups.google.com/advanced_group_search) to look up
cerapiinit registry
in this newsgroup. You can use that info to write an app that uses
RAPI to notify and/or start a Pocket PC app.

or 2) when one or more files are deleted from a Pocket PC
>directory - these are deleted by a host PC application using RAPI. Is there a
>way for my PPC to get either notification?

See a current thread called "File transfers between PC <> PocketPC" in
this newsgroup.

>

-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

Robert E. Zaret, eMVP
PenFact, Inc.
20 Park Plaza, Suite 478
Boston, MA 02116
www.penfact.com

Re: How to get notified in PPC application when PPC is sync'd by snohelty

snohelty
Wed May 09 07:53:01 CDT 2007


"r_z_aret@pen_fact.com" wrote:

> On Tue, 8 May 2007 11:23:01 -0700, snohelty
> <snohelty@discussions.microsoft.com> wrote:
>
> >I have a Pocket PC application (C#, .NET on Mobile 5) and I need to determine
> >either: 1) when the Pocket PC is connected with the host PC through
> >ActiveSync,
>
> For info on how a _desktop_ application can determine when an
> ActiveSync connection is made, use google
> (http://groups.google.com/advanced_group_search) to look up
> cerapiinit registry
> in this newsgroup. You can use that info to write an app that uses
> RAPI to notify and/or start a Pocket PC app.
>
> or 2) when one or more files are deleted from a Pocket PC
> >directory - these are deleted by a host PC application using RAPI. Is there a
> >way for my PPC to get either notification?
>
> See a current thread called "File transfers between PC <> PocketPC" in
> this newsgroup.
>
> >
>

Ichecked the references you mentioned in your reply. Still one question
though - do I need to initiate some action on the PPC, let's say to start a
timer, etc to check for a file? Or can RAPI make an IPC call into a running
application? Either way if I have a running PPC application is there a way to
notify that application that the files have been deleted by a desktop app? It
wasn't clear to me from what I read.


> -----------------------------------------
> To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).
>
> Robert E. Zaret, eMVP
> PenFact, Inc.
> 20 Park Plaza, Suite 478
> Boston, MA 02116
> www.penfact.com
>

RE: How to get notified in PPC application when PPC is sync'd by AlbertoCardoso

AlbertoCardoso
Wed May 09 08:15:01 CDT 2007

Hello my friend.

You can do the 2 things really. You can use the
OpenNetCF.Desktop.Communication. Download the .dll from the site:
http://www.opennetcf.com/SharedSource/DesktopCommunication/tabid/90/Default.aspx

Import it and do something like this:

using OpenNETCF.Desktop.Communication;

class Rapi
{
private RAPI rapi = new RAPI();

public Rapi()
{
rapi.Connect();
}

public bool isConnected()
{
return rapi.Connected;
}
}

Check this out.
http://www.opennetcf.com/library/communication/OpenNETCF.Desktop.Communication.RAPIMembers.html

Hope it helps.
Peace friend.


--
Alberto Cardoso



"snohelty" wrote:

> I have a Pocket PC application (C#, .NET on Mobile 5) and I need to determine
> either: 1) when the Pocket PC is connected with the host PC through
> ActiveSync, or 2) when one or more files are deleted from a Pocket PC
> directory - these are deleted by a host PC application using RAPI. Is there a
> way for my PPC to get either notification?
>
>

Re: How to get notified in PPC application when PPC is sync'd by r_z_aret

r_z_aret
Wed May 09 15:26:12 CDT 2007

On Wed, 9 May 2007 05:53:01 -0700, snohelty
<snohelty@discussions.microsoft.com> wrote:

>
>"r_z_aret@pen_fact.com" wrote:
>
>> On Tue, 8 May 2007 11:23:01 -0700, snohelty
>> <snohelty@discussions.microsoft.com> wrote:
>>
>> >I have a Pocket PC application (C#, .NET on Mobile 5) and I need to determine
>> >either: 1) when the Pocket PC is connected with the host PC through
>> >ActiveSync,
>>
>> For info on how a _desktop_ application can determine when an
>> ActiveSync connection is made, use google
>> (http://groups.google.com/advanced_group_search) to look up
>> cerapiinit registry
>> in this newsgroup. You can use that info to write an app that uses
>> RAPI to notify and/or start a Pocket PC app.
>>
>> or 2) when one or more files are deleted from a Pocket PC
>> >directory - these are deleted by a host PC application using RAPI. Is there a
>> >way for my PPC to get either notification?
>>
>> See a current thread called "File transfers between PC <> PocketPC" in
>> this newsgroup.
>>
>> >
>>
>
>Ichecked the references you mentioned in your reply. Still one question
>though - do I need to initiate some action on the PPC, let's say to start a
>timer, etc to check for a file? Or can RAPI make an IPC call into a running
>application? Either way if I have a running PPC application is there a way to
>notify that application that the files have been deleted by a desktop app? It
>wasn't clear to me from what I read.

I've definitely not used RPC. Sure, the PPC app could poll for file
deletion (loop that checks for existence and then pauses).

I've set up all my apps so they only allow one copy to run and accept
command-line arguments. If another copy runs, it looks for the first,
brings the first to the foreground, sends the command line as a
special message to the first copy, and then exits. So you could use
CeRapiInvoke to "start" your PPC app and send itself a message.

>
>
>> -----------------------------------------
>> To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).
>>
>> Robert E. Zaret, eMVP
>> PenFact, Inc.
>> 20 Park Plaza, Suite 478
>> Boston, MA 02116
>> www.penfact.com
>>

-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

Robert E. Zaret, eMVP
PenFact, Inc.
20 Park Plaza, Suite 478
Boston, MA 02116
www.penfact.com

Re: How to get notified in PPC application when PPC is sync'd by snohelty

snohelty
Thu May 10 07:27:02 CDT 2007



"r_z_aret@pen_fact.com" wrote:

> On Wed, 9 May 2007 05:53:01 -0700, snohelty
> <snohelty@discussions.microsoft.com> wrote:
>
> >
> >"r_z_aret@pen_fact.com" wrote:
> >
> >> On Tue, 8 May 2007 11:23:01 -0700, snohelty
> >> <snohelty@discussions.microsoft.com> wrote:
> >>
> >> >I have a Pocket PC application (C#, .NET on Mobile 5) and I need to determine
> >> >either: 1) when the Pocket PC is connected with the host PC through
> >> >ActiveSync,
> >>
> >> For info on how a _desktop_ application can determine when an
> >> ActiveSync connection is made, use google
> >> (http://groups.google.com/advanced_group_search) to look up
> >> cerapiinit registry
> >> in this newsgroup. You can use that info to write an app that uses
> >> RAPI to notify and/or start a Pocket PC app.
> >>
> >> or 2) when one or more files are deleted from a Pocket PC
> >> >directory - these are deleted by a host PC application using RAPI. Is there a
> >> >way for my PPC to get either notification?
> >>
> >> See a current thread called "File transfers between PC <> PocketPC" in
> >> this newsgroup.
> >>
> >> >
> >>
> >
> >Ichecked the references you mentioned in your reply. Still one question
> >though - do I need to initiate some action on the PPC, let's say to start a
> >timer, etc to check for a file? Or can RAPI make an IPC call into a running
> >application? Either way if I have a running PPC application is there a way to
> >notify that application that the files have been deleted by a desktop app? It
> >wasn't clear to me from what I read.
>
> I've definitely not used RPC. Sure, the PPC app could poll for file
> deletion (loop that checks for existence and then pauses).
>
> I've set up all my apps so they only allow one copy to run and accept
> command-line arguments. If another copy runs, it looks for the first,
> brings the first to the foreground, sends the command line as a
> special message to the first copy, and then exits. So you could use
> CeRapiInvoke to "start" your PPC app and send itself a message.
>

What method do you use to send a message from one instance of the app to
another?


> >
> >
> >> -----------------------------------------
> >> To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).
> >>
> >> Robert E. Zaret, eMVP
> >> PenFact, Inc.
> >> 20 Park Plaza, Suite 478
> >> Boston, MA 02116
> >> www.penfact.com
> >>
>
> -----------------------------------------
> To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).
>
> Robert E. Zaret, eMVP
> PenFact, Inc.
> 20 Park Plaza, Suite 478
> Boston, MA 02116
> www.penfact.com
>

Re: How to get notified in PPC application when PPC is sync'd by r_z_aret

r_z_aret
Thu May 10 14:47:18 CDT 2007

On Thu, 10 May 2007 05:27:02 -0700, snohelty
<snohelty@discussions.microsoft.com> wrote:

>
>
>"r_z_aret@pen_fact.com" wrote:
>
>> On Wed, 9 May 2007 05:53:01 -0700, snohelty
>> <snohelty@discussions.microsoft.com> wrote:
>>

clip

>>
>
>What method do you use to send a message from one instance of the app to
>another?

The SendMessage function and WM_COPYDATA.

>
>

-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

Robert E. Zaret, eMVP
PenFact, Inc.
20 Park Plaza, Suite 478
Boston, MA 02116
www.penfact.com

RE: How to get notified in PPC application when PPC is sync'd by dbgrick

dbgrick
Thu May 10 22:24:01 CDT 2007

You can determine if a device has synchronized with active sync using the
following C# code:

Wire up the active synce state changed event and then perform the action
needed

SystemState activeSyncState = new
SystemState(SystemProperty.ActiveSyncStatus);
activeSyncState.Changed += new
ChangeEventHandler(activeSyncState_Changed);

void activeSyncState_Changed(object sender, ChangeEventArgs args)
{
ActiveSyncStatus status = (ActiveSyncStatus)args.NewValue;

try
{
if (status == ActiveSyncStatus.Synchronizing)
{
// Do Some work
}
}
catch (Exception ex)
{
// Handle Exception
}
}

2. Determine if a directory changes:

Rick D.
Contractor

"snohelty" wrote:

> I have a Pocket PC application (C#, .NET on Mobile 5) and I need to determine
> either: 1) when the Pocket PC is connected with the host PC through
> ActiveSync, or 2) when one or more files are deleted from a Pocket PC
> directory - these are deleted by a host PC application using RAPI. Is there a
> way for my PPC to get either notification?
>
>

RE: How to get notified in PPC application when PPC is sync'd by snohelty

snohelty
Fri May 11 11:02:00 CDT 2007



"dbgrick" wrote:

> You can determine if a device has synchronized with active sync using the
> following C# code:
>
> Wire up the active synce state changed event and then perform the action
> needed
>
> SystemState activeSyncState = new
> SystemState(SystemProperty.ActiveSyncStatus);
> activeSyncState.Changed += new
> ChangeEventHandler(activeSyncState_Changed);
>
> void activeSyncState_Changed(object sender, ChangeEventArgs args)
> {
> ActiveSyncStatus status = (ActiveSyncStatus)args.NewValue;
>
> try
> {
> if (status == ActiveSyncStatus.Synchronizing)
> {
> // Do Some work
> }
> }
> catch (Exception ex)
> {
> // Handle Exception
> }
> }
>
> 2. Determine if a directory changes:
>
> Rick D.
> Contractor
>
> "snohelty" wrote:
>
> > I have a Pocket PC application (C#, .NET on Mobile 5) and I need to determine
> > either: 1) when the Pocket PC is connected with the host PC through
> > ActiveSync, or 2) when one or more files are deleted from a Pocket PC
> > directory - these are deleted by a host PC application using RAPI. Is there a
> > way for my PPC to get either notification?
> >
> >


Rick,

Thanks for the help, it worked great. The only change I had to make was to
declare activeSyncState at the class level and not locally. But it's
working. This helps me a great deal. Thanks again.

Steve