Monthly archives: April 2006

Timothy

VB.Net, P/Invoke, Windows Mobile 5.0 SDK, and ActiveSync

Update: I emailed Microsoft and they have acknowledged their KB was incorrect and have since corrected it.  Below is my original post, which I wrote shortly after discovering the typo in MS's KB on this subject.


If you are a Windows Mobile developer, you have probably noticed all the new whiz-bang new APIs in the 5.0 SDK. Many are available only to unmanaged calls (either from unmanaged C or P/Invoke from .Net). Most of the documentation is correct and helpful, but I noticed a problem when I was trying to P/Invoke the new API calls ActiveSyncStart and ActiveSyncStop when I was trying to write a teensy little app that needed to use these.

In MS's knowledgebase (which is located here), we see that ActiveSyncStart is defined in ActiveSync.h and references the library actsyncc.lib. The problem is that there is no actsyncc.lib in the SDK! Perhaps there was in one of the beta/CTPs -- I'm not sure. So when you create your P/Invoke call and reference actsyncc.dll, you are out of luck. I googled for help, but with no luck. I dug through the libs and finally found out where it actually is referenced, which is aygshell.lib (aygshell.dll).

Here are the P/Invoke declarations for the unmanaged function calls for use in VB.Net...

Private Declare Function ActiveSyncStart Lib "aygshell.dll" () As Integer

Private Declare Function ActiveSyncStop Lib "aygshell.dll" () As Integer

Obviously you need to change the definition a teeny bit to get it to work in C#.

So if you are writing managed code on Windows Mobile and, like me, frustratingly coudln't find out how to use the unmanaged API calls ActiveSyncStart and ActiveSyncStop, I hope this helps! :-)

 

Blog

Search Posts

Recent Comments

  1. Re: DPM 2016 + SQL 2016 and "An unexpected error occurred during the installation" ID: 4387
    ptbNPA: That should have been *ID 810*, not 820

  2. Re: DPM 2016 + SQL 2016 and "An unexpected error occurred during the installation" ID: 4387
    ptbNPA: For anyone else coming across this in the future and have an ID 820 error: For some strange reason...

  3. Re: DPM 2016 + SQL 2016 and "An unexpected error occurred during the installation" ID: 4387
    Timothy: Sorry, I don't have any other insight. I'm sure you ran into all the same articles I did about the error...

  4. Re: DPM 2016 + SQL 2016 and "An unexpected error occurred during the installation" ID: 4387
    ptbNPA: FYI, after posting the issue on technet + windows-noob.com with no replies I decided to do a fresh Windows...

  5. Re: DPM 2016 + SQL 2016 and "An unexpected error occurred during the installation" ID: 4387
    ptbNPA: Hi and thanks for your post. I originally installed SQL 2016 with SP1 on a Windows server 2016 and got...

  6. Re: DPM 2016 + SQL 2016 and "An unexpected error occurred during the installation" ID: 4387
    Timothy: Update Rollup 2.

  7. Re: DPM 2016 + SQL 2016 and "An unexpected error occurred during the installation" ID: 4387
    Catwiesl: You write "Microsoft System Center Data Protection Manager (DPM) officially supports SQL 2016 with U...

  8. Re: PowerShell: Quickly Finding the Oldest and Newest Files in a Folder
    Neki: i would like to compare a local file with a remote file and download the remote file if its newer than...

  9. Re: RD Tabs: Tabbed Windows Remote Desktops
    lukas: Fantastic software though I am having issues saving passwords. As soon as I kill the program the setting...

  10. Re: Easy Way to Change Permissions on the Windows Server Scheduled Tasks Folder (C:\Windows\Tasks)
    George: From another server, using an admin account, I opened \\SERVER\c$\windows in Windows Explorer. Tasks...

Archive

Tag Cloud