How to use WINAPI from newer SDK but still using the old SDK in WindowsMobile
Specifically, I want to use Point-to-point Message Queue but because I am still using legacy codes in eVC++ 4 and it only support until PocketPC 2003SE SDK, I cannot find CreateMsgQueue
and friends in the headers (the port to newer VisualStudio is still in progess)
I am using the Message Queue to do IPC with apps developed with WM-6.5-DTK (VS2005).
Update:
I am using the following code (taken frommsgqueue.h
) to store function pointers and load CoreDLL.dll
using GetProcAddress()
and LoadLibrary()
respectively.
HANDLE /*WINAPI*/ (*CreateMsgQueue)(LPCWSTR lpName, LPMSGQUEUEOPTIONS lpOptions);
HANDLE /*WINAPI*/ (*OpenMsgQueue)(HANDLE hSrcProc, HANDLE hMsgQ
, LPMSGQUEUEOPTIONS lpOptions);
BOOL /*WINAPI*/ (*ReadMsgQueue)(HANDLE hMsgQ,
/*__out_bcount(cbBufferSize)*/ LPVOID lpBuffer, DWORD cbBufferSize,
LPDWORD lpNumberOfBytesRead, DWORD dwTimeout, DWORD *pdwFlags);
BOOL /*WINAPI*/ (*WriteMsgQueue)(HANDLE hMsgQ, LPVOID lpBuffer, DWORD cbDataSize,
DWORD dwTimeout, DWORD dwFlags);
BOOL /*WINAPI*/ (*GetMsgQueueInfo)(HANDLE hMsgQ, LPMSGQUEUEINFO lpInfo);
BOOL /*WINAPI*/ (*CloseMsgQueue)(HANDLE hMsgQ);
Is the above code alright since I need to comment out WINAPI
and __out_bcount(cbBufferSize)
in ord开发者_如何转开发er for them to compile.
As pointed out by ctacke, it is actually available on PPC2003 SDK. The Requirement in the MSDN is wrong.
Btw, the above approach seems to work fine even after commenting out WINAPI
and __out_bcount(cbBufferSize)
精彩评论