Create FUNDING.yml
[wdl/wdl-ol.git] / WDL / win32_utf8.h
blobfc17f90947cf6480d3bc10cadd39d77f74eb7f6d
1 #ifndef _WDL_WIN32_UTF8_H_
2 #define _WDL_WIN32_UTF8_H_
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
8 #if defined(_WIN32) && !defined(WDL_NO_SUPPORT_UTF8)
10 #ifndef WDL_WIN32_UTF8_IMPL
11 #define WDL_WIN32_UTF8_IMPL
12 #define WDL_WIN32_UTF8_IMPL_NOTSTATIC
13 #endif
15 #include <windows.h>
16 #include <sys/stat.h>
17 #include <stdio.h>
19 WDL_WIN32_UTF8_IMPL BOOL SetWindowTextUTF8(HWND hwnd, LPCTSTR str);
20 WDL_WIN32_UTF8_IMPL BOOL SetDlgItemTextUTF8(HWND hDlg, int nIDDlgItem, LPCTSTR lpString);
21 WDL_WIN32_UTF8_IMPL int GetWindowTextUTF8(HWND hWnd, LPTSTR lpString, int nMaxCount);
22 WDL_WIN32_UTF8_IMPL UINT GetDlgItemTextUTF8(HWND hDlg, int nIDDlgItem, LPTSTR lpString, int nMaxCount);
23 WDL_WIN32_UTF8_IMPL int MessageBoxUTF8(HWND hwnd, LPCTSTR lpText, LPCTSTR lpCaption, UINT fl);
25 WDL_WIN32_UTF8_IMPL BOOL CreateDirectoryUTF8(LPCTSTR path, LPSECURITY_ATTRIBUTES attr);
26 WDL_WIN32_UTF8_IMPL BOOL DeleteFileUTF8(LPCTSTR path);
27 WDL_WIN32_UTF8_IMPL BOOL MoveFileUTF8(LPCTSTR existfn, LPCTSTR newfn);
28 WDL_WIN32_UTF8_IMPL BOOL CopyFileUTF8(LPCTSTR existfn, LPCTSTR newfn, BOOL fie);
29 WDL_WIN32_UTF8_IMPL DWORD GetCurrentDirectoryUTF8(DWORD nBufferLength, LPTSTR lpBuffer);
30 WDL_WIN32_UTF8_IMPL BOOL SetCurrentDirectoryUTF8(LPCTSTR path);
31 WDL_WIN32_UTF8_IMPL BOOL RemoveDirectoryUTF8(LPCTSTR path);
32 WDL_WIN32_UTF8_IMPL HINSTANCE LoadLibraryUTF8(LPCTSTR path);
34 WDL_WIN32_UTF8_IMPL HANDLE CreateFileUTF8(LPCTSTR lpFileName,DWORD dwDesiredAccess,DWORD dwShareMode,LPSECURITY_ATTRIBUTES lpSecurityAttributes,DWORD dwCreationDisposition,DWORD dwFlagsAndAttributes,HANDLE hTemplateFile);
36 WDL_WIN32_UTF8_IMPL UINT DragQueryFileUTF8(HDROP hDrop, UINT idx, char *buf, UINT bufsz);
38 WDL_WIN32_UTF8_IMPL int DrawTextUTF8(HDC hdc, LPCTSTR str, int nc, LPRECT lpRect, UINT format);
40 WDL_WIN32_UTF8_IMPL BOOL GetOpenFileNameUTF8(LPOPENFILENAME lpofn);
41 WDL_WIN32_UTF8_IMPL BOOL GetSaveFileNameUTF8(LPOPENFILENAME lpofn);
43 #if _MSC_VER > 1700 && defined(_WIN64)
44 WDL_WIN32_UTF8_IMPL BOOL SHGetPathFromIDListUTF8(const struct _ITEMIDLIST __unaligned *pidl, LPSTR pszPath, int pszPathLen);
45 #else
46 WDL_WIN32_UTF8_IMPL BOOL SHGetPathFromIDListUTF8(const struct _ITEMIDLIST *pidl, LPSTR pszPath, int pszPathLen);
47 #endif
49 WDL_WIN32_UTF8_IMPL BOOL SHGetSpecialFolderPathUTF8(HWND hwndOwner, LPTSTR lpszPath, int pszPathLen, int csidl, BOOL create);
51 WDL_WIN32_UTF8_IMPL struct _ITEMIDLIST *SHBrowseForFolderUTF8(struct _browseinfoA *browseInfoA);
52 WDL_WIN32_UTF8_IMPL int WDL_UTF8_SendBFFM_SETSEL(HWND hwnd, const char *str); // sends BFFM_SETSELECTIONA or BFFM_SETSELECTIONW
54 WDL_WIN32_UTF8_IMPL HINSTANCE ShellExecuteUTF8(HWND hwnd, LPCTSTR lpOp, LPCTSTR lpFile, LPCTSTR lpParm, LPCTSTR lpDir, INT nShowCmd);
56 WDL_WIN32_UTF8_IMPL BOOL GetUserNameUTF8(LPTSTR lpString, LPDWORD nMaxCount);
57 WDL_WIN32_UTF8_IMPL BOOL GetComputerNameUTF8(LPTSTR lpString, LPDWORD nMaxCount);
59 WDL_WIN32_UTF8_IMPL BOOL InsertMenuUTF8(HMENU hMenu, UINT uPosition, UINT uFlags, UINT_PTR uIDNewItem, LPCTSTR str);
60 WDL_WIN32_UTF8_IMPL BOOL InsertMenuItemUTF8( HMENU hMenu,UINT uItem, BOOL fByPosition, LPMENUITEMINFO lpmii);
61 WDL_WIN32_UTF8_IMPL BOOL SetMenuItemInfoUTF8(HMENU hMenu, UINT uItem, BOOL fByPosition,LPMENUITEMINFO lpmii);
62 WDL_WIN32_UTF8_IMPL BOOL GetMenuItemInfoUTF8(HMENU hMenu, UINT uItem,BOOL fByPosition,LPMENUITEMINFO lpmii);
64 WDL_WIN32_UTF8_IMPL int statUTF8(const char *filename, struct stat *buffer);
65 WDL_WIN32_UTF8_IMPL FILE *fopenUTF8(const char *filename, const char *mode);
67 WDL_WIN32_UTF8_IMPL int GetKeyNameTextUTF8(LONG lParam, LPTSTR lpString, int nMaxCount);
70 WDL_WIN32_UTF8_IMPL WCHAR *WDL_UTF8ToWC(const char *buf, BOOL doublenull, int minsize, DWORD *sizeout);
72 WDL_WIN32_UTF8_IMPL BOOL WDL_HasUTF8(const char *_str);
74 WDL_WIN32_UTF8_IMPL void WDL_UTF8_HookComboBox(HWND h);
75 WDL_WIN32_UTF8_IMPL void WDL_UTF8_HookListView(HWND h);
76 WDL_WIN32_UTF8_IMPL void WDL_UTF8_HookListBox(HWND h);
77 WDL_WIN32_UTF8_IMPL void WDL_UTF8_HookTreeView(HWND h);
78 WDL_WIN32_UTF8_IMPL void WDL_UTF8_HookTabCtrl(HWND h);
80 WDL_WIN32_UTF8_IMPL LPSTR GetCommandParametersUTF8();
81 WDL_WIN32_UTF8_IMPL void WDL_UTF8_ListViewConvertDispInfoToW(void *di); //NMLVDISPINFO
83 WDL_WIN32_UTF8_IMPL UINT GetPrivateProfileIntUTF8(LPCTSTR appStr, LPCTSTR keyStr, INT def, LPCTSTR fnStr);
84 WDL_WIN32_UTF8_IMPL DWORD GetPrivateProfileStringUTF8(LPCTSTR appStr, LPCTSTR keyStr, LPCTSTR defStr, LPTSTR retStr, DWORD nSize, LPCTSTR fnStr);
85 WDL_WIN32_UTF8_IMPL BOOL WritePrivateProfileStringUTF8(LPCTSTR appStr, LPCTSTR keyStr, LPCTSTR str, LPCTSTR fnStr);
86 WDL_WIN32_UTF8_IMPL BOOL GetPrivateProfileStructUTF8(LPCTSTR appStr, LPCTSTR keyStr, LPVOID pStruct, UINT uSize, LPCTSTR fnStr);
87 WDL_WIN32_UTF8_IMPL BOOL WritePrivateProfileStructUTF8(LPCTSTR appStr, LPCTSTR keyStr, LPVOID pStruct, UINT uSize, LPCTSTR fnStr);
89 WDL_WIN32_UTF8_IMPL DWORD GetModuleFileNameUTF8(HMODULE hModule, LPTSTR fnStr, DWORD nSize);
91 WDL_WIN32_UTF8_IMPL BOOL CreateProcessUTF8( LPCTSTR lpApplicationName, LPTSTR lpCommandLine,
92 LPSECURITY_ATTRIBUTES lpProcessAttributes,
93 LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles,
94 DWORD dwCreationFlags,
95 LPVOID lpEnvironment,
96 LPCTSTR lpCurrentDirectory,
97 LPSTARTUPINFO lpStartupInfo,
98 LPPROCESS_INFORMATION lpProcessInformation);
100 #ifdef SetWindowText
101 #undef SetWindowText
102 #endif
103 #define SetWindowText SetWindowTextUTF8
105 #ifdef SetDlgItemText
106 #undef SetDlgItemText
107 #endif
108 #define SetDlgItemText SetDlgItemTextUTF8
111 #ifdef GetWindowText
112 #undef GetWindowText
113 #endif
114 #define GetWindowText GetWindowTextUTF8
116 #ifdef GetDlgItemText
117 #undef GetDlgItemText
118 #endif
119 #define GetDlgItemText GetDlgItemTextUTF8
121 #ifdef MessageBox
122 #undef MessageBox
123 #endif
124 #define MessageBox MessageBoxUTF8
126 #ifdef DragQueryFile
127 #undef DragQueryFile
128 #endif
129 #define DragQueryFile DragQueryFileUTF8
131 #ifdef GetOpenFileName
132 #undef GetOpenFileName
133 #endif
134 #define GetOpenFileName GetOpenFileNameUTF8
136 #ifdef GetSaveFileName
137 #undef GetSaveFileName
138 #endif
139 #define GetSaveFileName GetSaveFileNameUTF8
141 #ifdef ShellExecute
142 #undef ShellExecute
143 #endif
144 #define ShellExecute ShellExecuteUTF8
146 #ifdef GetUserName
147 #undef GetUserName
148 #endif
149 #define GetUserName GetUserNameUTF8
151 #ifdef GetComputerName
152 #undef GetComputerName
153 #endif
154 #define GetComputerName GetComputerNameUTF8
156 #ifdef CreateDirectory
157 #undef CreateDirectory
158 #endif
159 #define CreateDirectory CreateDirectoryUTF8
161 #ifdef DeleteFile
162 #undef DeleteFile
163 #endif
164 #define DeleteFile DeleteFileUTF8
166 #ifdef MoveFile
167 #undef MoveFile
168 #endif
169 #define MoveFile MoveFileUTF8
171 #ifdef CopyFile
172 #undef CopyFile
173 #endif
174 #define CopyFile CopyFileUTF8
176 #ifdef GetCurrentDirectory
177 #undef GetCurrentDirectory
178 #endif
179 #define GetCurrentDirectory GetCurrentDirectoryUTF8
181 #ifdef SetCurrentDirectory
182 #undef SetCurrentDirectory
183 #endif
184 #define SetCurrentDirectory SetCurrentDirectoryUTF8
187 #ifdef RemoveDirectory
188 #undef RemoveDirectory
189 #endif
190 #define RemoveDirectory RemoveDirectoryUTF8
193 #ifdef CreateFile
194 #undef CreateFile
195 #endif
196 #define CreateFile CreateFileUTF8
199 #ifdef InsertMenu
200 #undef InsertMenu
201 #endif
202 #define InsertMenu InsertMenuUTF8
204 #ifdef InsertMenuItem
205 #undef InsertMenuItem
206 #endif
207 #define InsertMenuItem InsertMenuItemUTF8
209 #ifdef SetMenuItemInfo
210 #undef SetMenuItemInfo
211 #endif
212 #define SetMenuItemInfo SetMenuItemInfoUTF8
214 #ifdef GetMenuItemInfo
215 #undef GetMenuItemInfo
216 #endif
217 #define GetMenuItemInfo GetMenuItemInfoUTF8
219 #ifdef LoadLibrary
220 #undef LoadLibrary
221 #endif
222 #define LoadLibrary LoadLibraryUTF8
224 #ifdef GetPrivateProfileInt
225 #undef GetPrivateProfileInt
226 #endif
227 #define GetPrivateProfileInt GetPrivateProfileIntUTF8
229 #ifdef GetPrivateProfileString
230 #undef GetPrivateProfileString
231 #endif
232 #define GetPrivateProfileString GetPrivateProfileStringUTF8
234 #ifdef WritePrivateProfileString
235 #undef WritePrivateProfileString
236 #endif
237 #define WritePrivateProfileString WritePrivateProfileStringUTF8
239 #ifdef WritePrivateProfileStruct
240 #undef WritePrivateProfileStruct
241 #endif
242 #define WritePrivateProfileStruct WritePrivateProfileStructUTF8
244 #ifdef GetPrivateProfileStruct
245 #undef GetPrivateProfileStruct
246 #endif
247 #define GetPrivateProfileStruct GetPrivateProfileStructUTF8
250 #ifdef GetModuleFileName
251 #undef GetModuleFileName
252 #endif
253 #define GetModuleFileName GetModuleFileNameUTF8
255 #ifdef CreateProcess
256 #undef CreateProcess
257 #endif
258 #define CreateProcess CreateProcessUTF8
260 #else
262 // compat defines for when UTF disabled
263 #define DrawTextUTF8 DrawText
264 #define statUTF8 stat
265 #define fopenUTF8 fopen
266 #define WDL_UTF8_HookComboBox(x)
267 #define WDL_UTF8_HookListView(x)
268 #define WDL_UTF8_HookListBox(x)
269 #define WDL_UTF8_HookTreeView(x)
270 #define WDL_UTF8_HookTabCtrl(x)
271 #define WDL_UTF8_ListViewConvertDispInfoToW(x)
273 #endif
275 #ifdef __cplusplus
277 #endif
279 #endif