New project->WinCE Dynamic-link library->Simple Window CE DLL ->
Step 2: Add header aaa.h file:
#ifdef TWOTECHBT_EXPORTS //cannot use numbers here like "2TBT_EXPORTS" will get fatal error C1016: #if[n]def expected an identifier"
#define TWOTECHBTLIB_API __declspec(dllexport)
#else
#define TWOTECHBTLIB_API __declspec(dllimport)
#endif
// Use "C" naming convention for methods.
#ifdef __cplusplus
extern "C" {
#endif
TWOTECHBTLIB_API BOOL WINAPI Initialize();
TWOTECHBTLIB_API BOOL WINAPI Deinitialize();
TWOTECHBTLIB_API BOOL WINAPI GetLocalBluetoothAddressName(
#ifdef __cplusplus
}
#endif
Step 3: Settings->C/C++->Preprocessor-
Step 4: aaa.cpp file: may need use following to replace default dllmain
BOOL APIENTRY Dllentry( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
Step 5: in order to use CString, add following to stdafx.h
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include
#include
#if defined(_WIN32_WCE) && (_WIN32_WCE >= 211) && (_AFXDLL)
#include
#endif
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include
#endif // _AFX_NO_AFXCMN_SUPPORT
No comments:
Post a Comment