#pragma once #include "system/base.hpp" typedef struct _GUID { unsigned long Data1; unsigned short Data2; unsigned short Data3; unsigned char Data4[ 8 ]; } GUID; typedef GUID IID; typedef const IID * REFCLSID; typedef wchar_t OLECHAR; typedef OLECHAR* LPOLESTR; typedef GUID CLSID; typedef CLSID *LPCLSID; typedef const OLECHAR* LPCOLESTR; typedef const OLECHAR *LPCOLESTR; #define DECLSPEC_IMPORT __declspec(dllimport) #define EXTERN_C extern "C" typedef long HRESULT; #define STDAPICALLTYPE __stdcall #define WINOLEAPI EXTERN_C DECLSPEC_IMPORT HRESULT STDAPICALLTYPE WINOLEAPI CoCreateGuid(GUID * pguid); WINOLEAPI StringFromCLSID(REFCLSID rclsid, LPOLESTR* ppsz) ; WINOLEAPI CLSIDFromProgID(LPCOLESTR lpsz, LPCLSID pclsid) ; #define WINAPI __stdcall extern "C" { void WINAPI SysFreeString(BSTR str);//OleAut32.dll void * WINAPI LoadLibraryW(const wchar_t* lpText); bool WINAPI FreeLibrary(void * hModule); void * WINAPI GetProcAddressW(void* hModule, const char* lpText); LPARAM WINAPI GetPropW(HWND hWnd,string lpString); HWND WINAPI GetParent(HWND) ; LRESULT WINAPI MessageBoxW(HWND hWnd,string title,string caption,int button ); LRESULT WINAPI MessageBoxA(HWND hWnd,const char* title,const char* caption,int button ); LRESULT WINAPI SendMessageW(HWND hWnd,int msg,WPARAM wparam,LPARAM lparam) ; LRESULT WINAPI PostMessageW(HWND hWnd,int msg,WPARAM wparam,LPARAM lparam) ; HDC WINAPI GetDC(HWND hWnd) ;//native from "user32.dll" alias "GetDC"; int WINAPI ReleaseDC(HWND hWnd,int hDC) ;//native from "user32.dll" alias "ReleaseDC"; HWND WINAPI GetChild(HWND hWnd,int uCmd) ;//native from "user32.dll" alias "GetChild"; int WINAPI GetWindowTextW(HWND hWnd,string str,int nMaxCount) ;//native from "user32.dll" alias "GetWindowTextW"; int WINAPI SetWindowTextW(HWND hWnd,string str) ;//native from "user32.dll" alias "SetWindowTextW"; int WINAPI GetWindowTextLengthW(HWND hWnd) ;//native from "user32.dll" alias "GetWindowTextLengthW"; int WINAPI EnableWindow(HWND hWnd,bool abled) ;//native from "user32.dll" alias "EnableWindow"; int WINAPI SetFocus(HWND hWnd) ;//native from "user32.dll" alias "SetFocus"; HWND WINAPI GetFocus() ;//native from "user32.dll" alias "GetFocus"; int WINAPI IsWindowVisible(HWND hWnd) ;//native from "user32.dll" alias "IsWindowVisible"; //int WINAPI GetLocalTime(ref dwtime dt) ;//native from "Kernel32.dll" alias "GetLocalTime"; bool WINAPI AnimateWindow(HWND hWnd,int dwTime,int dwFlags) ;//native from "user32.dll" alias "AnimateWindow"; int WINAPI GetKeyState(int nVirtKey) ;//native from "user32.dll" alias "GetKeyState"; int WINAPI SetWindowLong(HWND hWnd, int nIndex, int dwNewLong) ;//native from "user32.dll" alias "SetWindowLongW"; LPARAM WINAPI GetWindowLong(HWND hWnd, int nIndex) ;//native from "user32.dll" alias "GetWindowLongW"; int WINAPI GetClientRect(HWND hWnd, xrect & lpRect) ;//native from "user32.dll" alias "GetClientRect"; int WINAPI GetWindowRect(HWND hWnd, xrect & lpRect) ;//native from "user32.dll" alias "GetWindowRect"; int WINAPI MoveWindow(HWND hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint) ;//native from "user32.dll" alias "MoveWindow"; int WINAPI GetCursorPos(/*manage*/xpoint & IpPoint) ;//native from "user32.dll" alias "GetCursorPos"; int WINAPI SetCursorPos(int X, int Y) ;//native from "user32.dll" alias "SetCursorPos"; int WINAPI SetParent(HWND hWndChild,HWND hWndNewParent) ;//native from "user32.dll" alias "SetParent"; int WINAPI SetWindowPos(HWND hWnd, HWND hWndlnsertAfter,int X,int Y,int cx, int cy,int Flags) ;//native from "user32.dll" alias "SetWindowPos"; int WINAPI CreateWindowEx(int dwExStyle,string IpClassName,string lpWindowName, int dwStyle, int x, int y, int nWidth, int nHeight, HWND hWndParent, int hMenu, int hInstance, int lpParam) ;//native from "user32.dll" alias "CreateWindowExW"; int WINAPI ScrollWindow(HWND hWnd, int XAmount, int YAmount, xrect IpRect, xrect lpClipRect) ;//native from "user32.dll" alias "ScrollWindow"; int WINAPI ShowWindow(HWND hWnd, int nCmdShow) ;//native from "user32.dll" alias "ShowWindow"; int WINAPI WindowFromPoint(int xPoint, int yPoint) ;//native from "user32.dll" alias "WindowFromPoint"; int WINAPI SetClassLongW(HWND hWnd,int nlndex,int dwNewLong) ;//native from "user32.dll" alias "SetClassLongW"; int WINAPI ScreenToClient(HWND hWnd, xpoint lpPoint) ;//native from "user32.dll" alias "ScreenToClient"; int WINAPI GetCursor() ;//native from "user32.dll" alias "GetCursor"; int WINAPI GetPinYinLeader(string & ,string) ;//native from "pinyin.dll" alias "GetPinYinLeader"; int WINAPI SetTextColor(int hdc, int crColor ) ;//native from "gdi32.dll" alias "SetTextColor"; int WINAPI SetCapture(HWND hWnd) ;//native from "user32.dll" alias "SetCapture"; int WINAPI SetTimer(HWND hWnd, int nIDEvent, int uElapse, int lpTimerFunc) ;//native from "user32.dll" alias "SetTimer"; int WINAPI KillTimer(HWND hWnd, int nIDEvent) ;//native from "user32.dll" alias "KillTimer"; HWND WINAPI FindWindowExW(HWND hWndParent, HWND hWndChildAfter, string lpszClass, string lpszWindow) ;//native from "user32.dll" alias "FindWindowExW"; int WINAPI DestroyWindow(HWND hWnd) ;//native from "user32.dll" alias "DestroyWindow"; HMENU WINAPI CreatePopupMenu() ;//native from "user32.dll" alias "CreatePopupMenu"; bool WINAPI AppendMenuW(HMENU hMenu, int uFlags, int uIDNewltem, string lpNewltem) ;//native from "user32.dll" alias "AppendMenuW"; bool WINAPI TrackPopupMenu(HMENU hMenu, int uFlags, int x, int y, int nReserved, HWND hWnd, xrect prcRect) ;//native from "user32.dll" alias "TrackPopupMenu"; //int WINAPI CallWindowProc(int OldWProc,HWND hWnd,int uMsg,param wParam,param lParam) ;//native from "user32.dll" alias "CallWindowProcW"; int WINAPI InvalidateRect(HWND hWnd,xrect * lpRect, bool bErase) ;//native from "user32.dll" alias "InvalidateRect"; int WINAPI Sleep(int dwMilliseconds) ;//native from "kernel32.dll" alias "Sleep"; int WINAPI DestroyWindow(HWND hWnd) ;//native from "user32.dll" alias "DestroyWindow"; int WINAPI GetClassNameW(HWND hWnd,string str,int nMaxCount) ;//native from "user32.dll" alias "GetClassNameW"; int WINAPI GetDeviceCaps(HWND hWnd,int HORZRES) ;//native from "user32.dll" alias "GetDeviceCaps"; int WINAPI GetComputerName(string name , int len) ;//native from "kernel32.dll" alias "GetComputerName"; int WINAPI IsWindow(HWND hWnd) ;//native from "user32.dll" alias "IsWindow"; int WINAPI GetCurrentDirectory(int nBufferLength, string lpBuffer) ;//native from "kernel32.dll" alias "GetCurrentDirectory"; int WINAPI ShellExecuteW(HWND hWnd, string lpOperation, string lpFile, string lpParameters, string lpDirectory, int nShowCmd) ;//native from "shell32.dll" alias "ShellExecuteW"; int WINAPI DeleteFile(string lpFileName) ;//native from "Shlwapi.dll" alias "DeleteFileW"; bool WINAPI PathFileExists(string lpFileName) ;//native from "shlwapi.dll" alias "PathFileExistsW"; int WINAPI CreateDirectory(string lpFileName, string lpFileAttributes) ;//native from "kernel32.dll" alias "CreateDirectoryW"; //bool WINAPI SystemParametersinfo(int uiAction,int uiParam,param pvParam,int fWinlni) ;//native from "user32.dll" alias "SystemParametersinfo"; int WINAPI GetSystemMetrics(int nIndex) ;//native from "user32.dll" alias "GetSystemMetrics"; HWND WINAPI FindWindowW(string lpClassName, string lpWindowName);//native from "user32.dll" alias "FindWindowW"; int WINAPI GetTempPathW(int NAME_LEN,string & OutPath) ;//native from "kernel32.dll" alias "GetTempPathW"; int WINAPI GetModuleHandleW(string lpModuleName) ;//native from "kernel32.dll" alias "GetModuleHandleW"; int WINAPI GetModuleFileNameW(int hModule ,string lpFileName, int nSize);//native from "kernel32.dll" alias "GetModuleFileNameW"; void WINAPI GetLocalTime(SYSTEMTIME& lpSystemTime) ;//native from "kernel32.dll" alias "GetLocalTime"; int WINAPI PathRemoveFileSpecW(xstring lpFileName);// native from "shlwapi.dll" alias "PathRemoveFileSpecW"; } #define SendMessage SendMessageW #define PostMessage PostMessageW #define GetWindowLong GetWindowLongW #define SetWindowLong SetWindowLongW #define MessageBox MessageBoxW #define GetModuleFileName GetModuleFileNameW #define PathRemoveFileSpec PathRemoveFileSpecW #define SetWindowText SetWindowTextW #define GetWindowText GetWindowTextW #if 0 namespace win32 { void * LoadLibrary(const wchar_t* lpText); bool FreeLibrary(void * hModule); void * GetProcAddress(void* hModule, const char* lpText); LPARAM GetProp(HWND hWnd,string lpString); HWND GetParent(HWND) ; LRESULT MessageBoxW(HWND hWnd,string title,string caption,int button ); LRESULT MessageBoxA(HWND hWnd,const char* title,const char* caption,int button ); LRESULT SendMessage(HWND hWnd,int msg,WPARAM wparam,LPARAM lparam) ; LRESULT PostMessage(HWND hWnd,int msg,WPARAM wparam,LPARAM lparam) ; HDC GetDC(HWND hWnd) ;//native from "user32.dll" alias "GetDC"; int ReleaseDC(HWND hWnd,int hDC) ;//native from "user32.dll" alias "ReleaseDC"; HWND GetChild(HWND hWnd,int uCmd) ;//native from "user32.dll" alias "GetChild"; int GetWindowTextW(HWND hWnd,string str,int nMaxCount) ;//native from "user32.dll" alias "GetWindowTextW"; int SetWindowTextW(HWND hWnd,string str) ;//native from "user32.dll" alias "SetWindowTextW"; int GetWindowTextLengthW(HWND hWnd) ;//native from "user32.dll" alias "GetWindowTextLengthW"; int EnableWindow(HWND hWnd,bool abled) ;//native from "user32.dll" alias "EnableWindow"; int SetFocus(HWND hWnd) ;//native from "user32.dll" alias "SetFocus"; HWND GetFocus() ;//native from "user32.dll" alias "GetFocus"; int IsWindowVisible(HWND hWnd) ;//native from "user32.dll" alias "IsWindowVisible"; //int GetLocalTime(ref dwtime dt) ;//native from "Kernel32.dll" alias "GetLocalTime"; bool AnimateWindow(HWND hWnd,int dwTime,int dwFlags) ;//native from "user32.dll" alias "AnimateWindow"; int GetKeyState(int nVirtKey) ;//native from "user32.dll" alias "GetKeyState"; int SetWindowLong(HWND hWnd, int nIndex, int dwNewLong) ;//native from "user32.dll" alias "SetWindowLongW"; LPARAM GetWindowLong(HWND hWnd, int nIndex) ;//native from "user32.dll" alias "GetWindowLongW"; int GetClientRect(HWND hWnd, xrect & lpRect) ;//native from "user32.dll" alias "GetClientRect"; int GetWindowRect(HWND hWnd, xrect & lpRect) ;//native from "user32.dll" alias "GetWindowRect"; int MoveWindow(HWND hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint) ;//native from "user32.dll" alias "MoveWindow"; int GetCursorPos(/*manage*/xpoint & IpPoint) ;//native from "user32.dll" alias "GetCursorPos"; int SetCursorPos(int X, int Y) ;//native from "user32.dll" alias "SetCursorPos"; int SetParent(HWND hWndChild,HWND hWndNewParent) ;//native from "user32.dll" alias "SetParent"; int SetWindowPos(HWND hWnd, HWND hWndlnsertAfter,int X,int Y,int cx, int cy,int Flags) ;//native from "user32.dll" alias "SetWindowPos"; int CreateWindowEx(int dwExStyle,string IpClassName,string lpWindowName, int dwStyle, int x, int y, int nWidth, int nHeight, HWND hWndParent, int hMenu, int hInstance, int lpParam) ;//native from "user32.dll" alias "CreateWindowExW"; int ScrollWindow(HWND hWnd, int XAmount, int YAmount, xrect IpRect, xrect lpClipRect) ;//native from "user32.dll" alias "ScrollWindow"; int ShowWindow(HWND hWnd, int nCmdShow) ;//native from "user32.dll" alias "ShowWindow"; int WindowFromPoint(int xPoint, int yPoint) ;//native from "user32.dll" alias "WindowFromPoint"; int SetClassLongW(HWND hWnd,int nlndex,int dwNewLong) ;//native from "user32.dll" alias "SetClassLongW"; int ScreenToClient(HWND hWnd, xpoint lpPoint) ;//native from "user32.dll" alias "ScreenToClient"; int GetCursor() ;//native from "user32.dll" alias "GetCursor"; int GetPinYinLeader(string & ,string) ;//native from "pinyin.dll" alias "GetPinYinLeader"; int SetTextColor(int hdc, int crColor ) ;//native from "gdi32.dll" alias "SetTextColor"; int SetCapture(HWND hWnd) ;//native from "user32.dll" alias "SetCapture"; int SetTimer(HWND hWnd, int nIDEvent, int uElapse, int lpTimerFunc) ;//native from "user32.dll" alias "SetTimer"; int KillTimer(HWND hWnd, int nIDEvent) ;//native from "user32.dll" alias "KillTimer"; HWND FindWindowExW(HWND hWndParent, HWND hWndChildAfter, string lpszClass, string lpszWindow) ;//native from "user32.dll" alias "FindWindowExW"; int DestroyWindow(HWND hWnd) ;//native from "user32.dll" alias "DestroyWindow"; HMENU CreatePopupMenu() ;//native from "user32.dll" alias "CreatePopupMenu"; bool AppendMenuW(HMENU hMenu, int uFlags, int uIDNewltem, string lpNewltem) ;//native from "user32.dll" alias "AppendMenuW"; bool TrackPopupMenu(HMENU hMenu, int uFlags, int x, int y, int nReserved, HWND hWnd, xrect prcRect) ;//native from "user32.dll" alias "TrackPopupMenu"; //int CallWindowProc(int OldWProc,HWND hWnd,int uMsg,param wParam,param lParam) ;//native from "user32.dll" alias "CallWindowProcW"; int InvalidateRect(HWND hWnd,xrect & lpRect, bool bErase) ;//native from "user32.dll" alias "InvalidateRect"; int Sleep(int dwMilliseconds) ;//native from "kernel32.dll" alias "Sleep"; int DestroyWindow(HWND hWnd) ;//native from "user32.dll" alias "DestroyWindow"; int GetClassNameW(HWND hWnd,string str,int nMaxCount) ;//native from "user32.dll" alias "GetClassNameW"; int GetDeviceCaps(HWND hWnd,int HORZRES) ;//native from "user32.dll" alias "GetDeviceCaps"; int GetComputerName(string name , int len) ;//native from "kernel32.dll" alias "GetComputerName"; int IsWindow(HWND hWnd) ;//native from "user32.dll" alias "IsWindow"; int GetCurrentDirectory(int nBufferLength, string lpBuffer) ;//native from "kernel32.dll" alias "GetCurrentDirectory"; int ShellExecuteW(HWND hWnd, string lpOperation, string lpFile, string lpParameters, string lpDirectory, int nShowCmd) ;//native from "shell32.dll" alias "ShellExecuteW"; int DeleteFile(string lpFileName) ;//native from "Shlwapi.dll" alias "DeleteFileW"; bool PathFileExists(string lpFileName) ;//native from "shlwapi.dll" alias "PathFileExistsW"; int CreateDirectory(string lpFileName, string lpFileAttributes) ;//native from "kernel32.dll" alias "CreateDirectoryW"; //bool SystemParametersinfo(int uiAction,int uiParam,param pvParam,int fWinlni) ;//native from "user32.dll" alias "SystemParametersinfo"; int GetSystemMetrics(int nIndex) ;//native from "user32.dll" alias "GetSystemMetrics"; HWND FindWindowW(string lpClassName, string lpWindowName);//native from "user32.dll" alias "FindWindowW"; int GetTempPathW(int NAME_LEN,string & OutPath) ;//native from "kernel32.dll" alias "GetTempPathW"; int GetModuleHandleW(string lpModuleName) ;//native from "kernel32.dll" alias "GetModuleHandleW"; int GetModuleFileName(int hModule ,string & lpFileName ,int nSize ) ;//native from "kernel32.dll" alias "GetModuleFileName"; void GetLocalTime(SYSTEMTIME& lpSystemTime) ;//native from "kernel32.dll" alias "GetLocalTime"; } #endif