1*9eab2a37SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*9eab2a37SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*9eab2a37SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*9eab2a37SAndrew Rist * distributed with this work for additional information 6*9eab2a37SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*9eab2a37SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*9eab2a37SAndrew Rist * "License"); you may not use this file except in compliance 9*9eab2a37SAndrew Rist * with the License. You may obtain a copy of the License at 10*9eab2a37SAndrew Rist * 11*9eab2a37SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*9eab2a37SAndrew Rist * 13*9eab2a37SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*9eab2a37SAndrew Rist * software distributed under the License is distributed on an 15*9eab2a37SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*9eab2a37SAndrew Rist * KIND, either express or implied. See the License for the 17*9eab2a37SAndrew Rist * specific language governing permissions and limitations 18*9eab2a37SAndrew Rist * under the License. 19*9eab2a37SAndrew Rist * 20*9eab2a37SAndrew Rist *************************************************************/ 21*9eab2a37SAndrew Rist 22*9eab2a37SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #pragma once 25cdf0e10cSrcweir 26cdf0e10cSrcweir #ifndef _WINDOWS_ 27cdf0e10cSrcweir #include <windows.h> 28cdf0e10cSrcweir #endif 29cdf0e10cSrcweir 30cdf0e10cSrcweir #ifdef __cplusplus 31cdf0e10cSrcweir extern "C"{ 32cdf0e10cSrcweir #endif 33cdf0e10cSrcweir 34cdf0e10cSrcweir //------------------------------------------------------------------------ 35cdf0e10cSrcweir // undefine the macros defined in the winuser.h file in order to avoid 36cdf0e10cSrcweir // warnings because of multiple defines 37cdf0e10cSrcweir //------------------------------------------------------------------------ 38cdf0e10cSrcweir 39cdf0e10cSrcweir #ifdef SendMessageW 40cdf0e10cSrcweir #undef SendMessageW 41cdf0e10cSrcweir #endif 42cdf0e10cSrcweir 43cdf0e10cSrcweir #ifdef CreateWindowExW 44cdf0e10cSrcweir #undef CreateWindowExW 45cdf0e10cSrcweir #endif 46cdf0e10cSrcweir 47cdf0e10cSrcweir #ifdef RegisterClassExW 48cdf0e10cSrcweir #undef RegisterClassExW 49cdf0e10cSrcweir #endif 50cdf0e10cSrcweir 51cdf0e10cSrcweir #ifdef UnregisterClassW 52cdf0e10cSrcweir #undef UnregisterClassW 53cdf0e10cSrcweir #endif 54cdf0e10cSrcweir 55cdf0e10cSrcweir #ifdef RegisterClipboardFormatW 56cdf0e10cSrcweir #undef RegisterClipboardFormatW 57cdf0e10cSrcweir #endif 58cdf0e10cSrcweir 59cdf0e10cSrcweir #ifdef GetClipboardFormatNameW 60cdf0e10cSrcweir #undef GetClipboardFormatNameW 61cdf0e10cSrcweir #endif 62cdf0e10cSrcweir 63cdf0e10cSrcweir #ifdef SetWindowTextW 64cdf0e10cSrcweir #undef SetWindowTextW 65cdf0e10cSrcweir #endif 66cdf0e10cSrcweir 67cdf0e10cSrcweir #ifdef GetWindowTextW 68cdf0e10cSrcweir #undef GetWindowTextW 69cdf0e10cSrcweir #endif 70cdf0e10cSrcweir 71cdf0e10cSrcweir #ifdef InsertMenuItemW 72cdf0e10cSrcweir #undef InsertMenuItemW 73cdf0e10cSrcweir #endif 74cdf0e10cSrcweir 75cdf0e10cSrcweir #ifndef DrawTextW 76cdf0e10cSrcweir #undef DrawTextW 77cdf0e10cSrcweir #endif 78cdf0e10cSrcweir 79cdf0e10cSrcweir //------------------------------------------------------------------------ 80cdf0e10cSrcweir // defines 81cdf0e10cSrcweir //------------------------------------------------------------------------ 82cdf0e10cSrcweir 83cdf0e10cSrcweir #define USER9X_API extern 84cdf0e10cSrcweir 85cdf0e10cSrcweir //------------------------------------------------------------------------ 86cdf0e10cSrcweir // declare function pointers to the appropriate user32 functions 87cdf0e10cSrcweir //------------------------------------------------------------------------ 88cdf0e10cSrcweir 89cdf0e10cSrcweir USER9X_API LRESULT ( WINAPI * lpfnSendMessageW) ( 90cdf0e10cSrcweir HWND hWnd, // handle to the destination window 91cdf0e10cSrcweir UINT Msg, // message 92cdf0e10cSrcweir WPARAM wParam, // first message parameter 93cdf0e10cSrcweir LPARAM lParam // second message parameter 94cdf0e10cSrcweir ); 95cdf0e10cSrcweir 96cdf0e10cSrcweir USER9X_API HWND ( WINAPI * lpfnCreateWindowExW ) ( 97cdf0e10cSrcweir DWORD dwExStyle, // extended window style 98cdf0e10cSrcweir LPCWSTR lpClassName, // registered class name 99cdf0e10cSrcweir LPCWSTR lpWindowName, // window name 100cdf0e10cSrcweir DWORD dwStyle, // window style 101cdf0e10cSrcweir int x, // horizontal position of window 102cdf0e10cSrcweir int y, // vertical position of window 103cdf0e10cSrcweir int nWidth, // window width 104cdf0e10cSrcweir int nHeight, // window height 105cdf0e10cSrcweir HWND hWndParent, // handle to parent or owner window 106cdf0e10cSrcweir HMENU hMenu, // menu handle or child identifier 107cdf0e10cSrcweir HINSTANCE hInstance, // handle to application instance 108cdf0e10cSrcweir LPVOID lpParam // window-creation data 109cdf0e10cSrcweir ); 110cdf0e10cSrcweir 111cdf0e10cSrcweir USER9X_API ATOM ( WINAPI * lpfnRegisterClassExW ) ( 112cdf0e10cSrcweir CONST WNDCLASSEXW* lpwcx // class data 113cdf0e10cSrcweir ); 114cdf0e10cSrcweir 115cdf0e10cSrcweir USER9X_API BOOL ( WINAPI * lpfnUnregisterClassW ) ( 116cdf0e10cSrcweir LPCWSTR lpClassName, // class name 117cdf0e10cSrcweir HINSTANCE hInstance // handle to application instance 118cdf0e10cSrcweir ); 119cdf0e10cSrcweir 120cdf0e10cSrcweir USER9X_API UINT (WINAPI * lpfnRegisterClipboardFormatW) ( 121cdf0e10cSrcweir LPCWSTR lpszFormat // name of new format 122cdf0e10cSrcweir ); 123cdf0e10cSrcweir 124cdf0e10cSrcweir USER9X_API int ( WINAPI * lpfnGetClipboardFormatNameW ) ( 125cdf0e10cSrcweir UINT format, // clipboard format to retrieve 126cdf0e10cSrcweir LPWSTR lpszFormatName, // format name 127cdf0e10cSrcweir int cchMaxCount // length of format name buffer 128cdf0e10cSrcweir ); 129cdf0e10cSrcweir 130cdf0e10cSrcweir USER9X_API BOOL ( WINAPI * lpfnSetWindowTextW ) ( 131cdf0e10cSrcweir HWND hWnd, 132cdf0e10cSrcweir LPCWSTR lpString 133cdf0e10cSrcweir ); 134cdf0e10cSrcweir 135cdf0e10cSrcweir USER9X_API int ( WINAPI * lpfnGetWindowTextW ) ( 136cdf0e10cSrcweir HWND hWnd, // handle to the window or control 137cdf0e10cSrcweir LPWSTR lpString, // text buffer 138cdf0e10cSrcweir int nMaxCount // length of text buffer 139cdf0e10cSrcweir ); 140cdf0e10cSrcweir 141cdf0e10cSrcweir USER9X_API BOOL ( WINAPI * lpfnInsertMenuItemW ) ( 142cdf0e10cSrcweir HMENU hMenu, // handle to menu 143cdf0e10cSrcweir UINT uItem, // identifier or position 144cdf0e10cSrcweir BOOL fByPosition, // meaning of uItem 145cdf0e10cSrcweir LPCMENUITEMINFOW lpmii // menu item information 146cdf0e10cSrcweir ); 147cdf0e10cSrcweir 148cdf0e10cSrcweir USER9X_API int ( WINAPI * lpfnDrawTextW ) ( 149cdf0e10cSrcweir HDC hDC, // handle to DC 150cdf0e10cSrcweir LPCWSTR lpString, // text to draw 151cdf0e10cSrcweir int nCount, // text length 152cdf0e10cSrcweir LPRECT lpRect, // formatting dimensions 153cdf0e10cSrcweir UINT uFormat // text-drawing options 154cdf0e10cSrcweir ); 155cdf0e10cSrcweir 156cdf0e10cSrcweir USER9X_API BOOL ( WINAPI * lpfnDrawStateW ) ( 157cdf0e10cSrcweir HDC hdc, // handle to device context 158cdf0e10cSrcweir HBRUSH hbr, // handle to brush 159cdf0e10cSrcweir DRAWSTATEPROC lpOutputFunc, // callback function 160cdf0e10cSrcweir LPARAM lData, // image information 161cdf0e10cSrcweir WPARAM wData, // more image information 162cdf0e10cSrcweir int x, // horizontal location 163cdf0e10cSrcweir int y, // vertical location 164cdf0e10cSrcweir int cx, // image width 165cdf0e10cSrcweir int cy, // image height 166cdf0e10cSrcweir UINT fuFlags // image type and state 167cdf0e10cSrcweir ); 168cdf0e10cSrcweir 169cdf0e10cSrcweir //------------------------------------------------------------------------ 170cdf0e10cSrcweir // redefine the above undefined macros so that the preprocessor replaces 171cdf0e10cSrcweir // all occurrences of this macros with our function pointer 172cdf0e10cSrcweir //------------------------------------------------------------------------ 173cdf0e10cSrcweir 174cdf0e10cSrcweir #define SendMessageW lpfnSendMessageW 175cdf0e10cSrcweir #define CreateWindowExW lpfnCreateWindowExW 176cdf0e10cSrcweir #define RegisterClassExW lpfnRegisterClassExW 177cdf0e10cSrcweir #define UnregisterClassW lpfnUnregisterClassW 178cdf0e10cSrcweir #define RegisterClipboardFormatW lpfnRegisterClipboardFormatW 179cdf0e10cSrcweir #define GetClipboardFormatNameW lpfnGetClipboardFormatNameW 180cdf0e10cSrcweir #define SetWindowTextW lpfnSetWindowTextW 181cdf0e10cSrcweir #define GetWindowTextW lpfnGetWindowTextW 182cdf0e10cSrcweir #define InsertMenuItemW lpfnInsertMenuItemW 183cdf0e10cSrcweir #define DrawTextW lpfnDrawTextW 184cdf0e10cSrcweir #define DrawStateW lpfnDrawStateW 185cdf0e10cSrcweir 186cdf0e10cSrcweir #ifdef __cplusplus 187cdf0e10cSrcweir } 188cdf0e10cSrcweir #endif 189