不包含SDK头文件, 补全API定义
- /// @file main.cpp
- /// @brief 不包含SDK头文件, 补全API定义
- #ifdef __cplusplus
- extern "C" {
- #endif /* __cplusplus */
- #define DECLARE_HANDLE(name) struct name##__ { int unused; }; typedef struct name##__* name
- DECLARE_HANDLE(HWND);
- DECLARE_HANDLE(HINSTANCE);
- #define WINAPI __stdcall
- typedef char* LPSTR;
- typedef const char* LPCSTR;
- typedef unsigned int UINT;
- #define NULL 0
- #define MB_OK 0
- /// MessageBoxA 是CRT函数
- __declspec(dllimport)
- int
- WINAPI
- MessageBoxA(
- HWND hWnd ,
- LPCSTR lpText,
- LPCSTR lpCaption,
- UINT uType);
- #define MessageBox MessageBoxA
- #ifdef __cplusplus
- }
- #endif /* __cplusplus */
- int WINAPI WinMain(HINSTANCE hInstance,
- HINSTANCE hPrevInstance,
- LPSTR lpCmdLine,
- int nCmdShow) {
- MessageBox(NULL, "test", "main", MB_OK);
- return 0;
- }
http://blog.csdn.net/lostspeed/article/details/50590304