LMMS
Loading...
Searching...
No Matches
win32_utf8.h
Go to the documentation of this file.
1#ifndef _WDL_WIN32_UTF8_H_
2#define _WDL_WIN32_UTF8_H_
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#if defined(_WIN32) && !defined(WDL_NO_SUPPORT_UTF8)
9
10#ifndef WDL_WIN32_UTF8_IMPL
11#define WDL_WIN32_UTF8_IMPL
12#define WDL_WIN32_UTF8_IMPL_NOTSTATIC
13#endif
14
15#include <windows.h>
16#include <sys/stat.h>
17#include <stdio.h>
18
19WDL_WIN32_UTF8_IMPL BOOL SetWindowTextUTF8(HWND hwnd, LPCTSTR str);
20WDL_WIN32_UTF8_IMPL BOOL SetDlgItemTextUTF8(HWND hDlg, int nIDDlgItem, LPCTSTR lpString);
21WDL_WIN32_UTF8_IMPL int GetWindowTextUTF8(HWND hWnd, LPTSTR lpString, int nMaxCount);
22WDL_WIN32_UTF8_IMPL UINT GetDlgItemTextUTF8(HWND hDlg, int nIDDlgItem, LPTSTR lpString, int nMaxCount);
23WDL_WIN32_UTF8_IMPL int MessageBoxUTF8(HWND hwnd, LPCTSTR lpText, LPCTSTR lpCaption, UINT fl);
24
25WDL_WIN32_UTF8_IMPL BOOL CreateDirectoryUTF8(LPCTSTR path, LPSECURITY_ATTRIBUTES attr);
26WDL_WIN32_UTF8_IMPL BOOL DeleteFileUTF8(LPCTSTR path);
27WDL_WIN32_UTF8_IMPL BOOL MoveFileUTF8(LPCTSTR existfn, LPCTSTR newfn);
28WDL_WIN32_UTF8_IMPL BOOL CopyFileUTF8(LPCTSTR existfn, LPCTSTR newfn, BOOL fie);
29WDL_WIN32_UTF8_IMPL DWORD GetCurrentDirectoryUTF8(DWORD nBufferLength, LPTSTR lpBuffer);
30WDL_WIN32_UTF8_IMPL BOOL SetCurrentDirectoryUTF8(LPCTSTR path);
31WDL_WIN32_UTF8_IMPL BOOL RemoveDirectoryUTF8(LPCTSTR path);
32WDL_WIN32_UTF8_IMPL HINSTANCE LoadLibraryUTF8(LPCTSTR path);
33
34WDL_WIN32_UTF8_IMPL HANDLE CreateFileUTF8(LPCTSTR lpFileName,DWORD dwDesiredAccess,DWORD dwShareMode,LPSECURITY_ATTRIBUTES lpSecurityAttributes,DWORD dwCreationDisposition,DWORD dwFlagsAndAttributes,HANDLE hTemplateFile);
35
36WDL_WIN32_UTF8_IMPL UINT DragQueryFileUTF8(HDROP hDrop, UINT idx, char *buf, UINT bufsz);
37
38WDL_WIN32_UTF8_IMPL int DrawTextUTF8(HDC hdc, LPCTSTR str, int nc, LPRECT lpRect, UINT format);
39
40WDL_WIN32_UTF8_IMPL BOOL GetOpenFileNameUTF8(LPOPENFILENAME lpofn);
41WDL_WIN32_UTF8_IMPL BOOL GetSaveFileNameUTF8(LPOPENFILENAME lpofn);
42
43#if _MSC_VER > 1700 && defined(_WIN64)
44WDL_WIN32_UTF8_IMPL BOOL SHGetPathFromIDListUTF8(const struct _ITEMIDLIST __unaligned *pidl, LPSTR pszPath, int pszPathLen);
45#else
46WDL_WIN32_UTF8_IMPL BOOL SHGetPathFromIDListUTF8(const struct _ITEMIDLIST *pidl, LPSTR pszPath, int pszPathLen);
47#endif
48
49WDL_WIN32_UTF8_IMPL BOOL SHGetSpecialFolderPathUTF8(HWND hwndOwner, LPTSTR lpszPath, int pszPathLen, int csidl, BOOL create);
50
51WDL_WIN32_UTF8_IMPL struct _ITEMIDLIST *SHBrowseForFolderUTF8(struct _browseinfoA *browseInfoA);
52WDL_WIN32_UTF8_IMPL int WDL_UTF8_SendBFFM_SETSEL(HWND hwnd, const char *str); // sends BFFM_SETSELECTIONA or BFFM_SETSELECTIONW
53
54WDL_WIN32_UTF8_IMPL HINSTANCE ShellExecuteUTF8(HWND hwnd, LPCTSTR lpOp, LPCTSTR lpFile, LPCTSTR lpParm, LPCTSTR lpDir, INT nShowCmd);
55
56WDL_WIN32_UTF8_IMPL BOOL GetUserNameUTF8(LPTSTR lpString, LPDWORD nMaxCount);
57WDL_WIN32_UTF8_IMPL BOOL GetComputerNameUTF8(LPTSTR lpString, LPDWORD nMaxCount);
58
59WDL_WIN32_UTF8_IMPL BOOL InsertMenuUTF8(HMENU hMenu, UINT uPosition, UINT uFlags, UINT_PTR uIDNewItem, LPCTSTR str);
60WDL_WIN32_UTF8_IMPL BOOL InsertMenuItemUTF8( HMENU hMenu,UINT uItem, BOOL fByPosition, LPMENUITEMINFO lpmii);
61WDL_WIN32_UTF8_IMPL BOOL SetMenuItemInfoUTF8(HMENU hMenu, UINT uItem, BOOL fByPosition,LPMENUITEMINFO lpmii);
62WDL_WIN32_UTF8_IMPL BOOL GetMenuItemInfoUTF8(HMENU hMenu, UINT uItem,BOOL fByPosition,LPMENUITEMINFO lpmii);
63
64WDL_WIN32_UTF8_IMPL int statUTF8(const char *filename, struct stat *buffer);
65WDL_WIN32_UTF8_IMPL FILE *fopenUTF8(const char *filename, const char *mode);
66
67WDL_WIN32_UTF8_IMPL int GetKeyNameTextUTF8(LONG lParam, LPTSTR lpString, int nMaxCount);
68
69
70WDL_WIN32_UTF8_IMPL WCHAR *WDL_UTF8ToWC(const char *buf, BOOL doublenull, int minsize, DWORD *sizeout);
71
72WDL_WIN32_UTF8_IMPL BOOL WDL_HasUTF8(const char *_str);
73
74WDL_WIN32_UTF8_IMPL void WDL_UTF8_HookComboBox(HWND h);
75WDL_WIN32_UTF8_IMPL void WDL_UTF8_HookListView(HWND h);
76WDL_WIN32_UTF8_IMPL void WDL_UTF8_HookListBox(HWND h);
77WDL_WIN32_UTF8_IMPL void WDL_UTF8_HookTreeView(HWND h);
78WDL_WIN32_UTF8_IMPL void WDL_UTF8_HookTabCtrl(HWND h);
79
80WDL_WIN32_UTF8_IMPL LPSTR GetCommandParametersUTF8();
81WDL_WIN32_UTF8_IMPL void WDL_UTF8_ListViewConvertDispInfoToW(void *di); //NMLVDISPINFO
82
83WDL_WIN32_UTF8_IMPL UINT GetPrivateProfileIntUTF8(LPCTSTR appStr, LPCTSTR keyStr, INT def, LPCTSTR fnStr);
84WDL_WIN32_UTF8_IMPL DWORD GetPrivateProfileStringUTF8(LPCTSTR appStr, LPCTSTR keyStr, LPCTSTR defStr, LPTSTR retStr, DWORD nSize, LPCTSTR fnStr);
85WDL_WIN32_UTF8_IMPL BOOL WritePrivateProfileStringUTF8(LPCTSTR appStr, LPCTSTR keyStr, LPCTSTR str, LPCTSTR fnStr);
86WDL_WIN32_UTF8_IMPL BOOL GetPrivateProfileStructUTF8(LPCTSTR appStr, LPCTSTR keyStr, LPVOID pStruct, UINT uSize, LPCTSTR fnStr);
87WDL_WIN32_UTF8_IMPL BOOL WritePrivateProfileStructUTF8(LPCTSTR appStr, LPCTSTR keyStr, LPVOID pStruct, UINT uSize, LPCTSTR fnStr);
88
89WDL_WIN32_UTF8_IMPL DWORD GetModuleFileNameUTF8(HMODULE hModule, LPTSTR fnStr, DWORD nSize);
90
91WDL_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);
99
100#ifdef SetWindowText
101#undef SetWindowText
102#endif
103#define SetWindowText SetWindowTextUTF8
104
105#ifdef SetDlgItemText
106#undef SetDlgItemText
107#endif
108#define SetDlgItemText SetDlgItemTextUTF8
109
110
111#ifdef GetWindowText
112#undef GetWindowText
113#endif
114#define GetWindowText GetWindowTextUTF8
115
116#ifdef GetDlgItemText
117#undef GetDlgItemText
118#endif
119#define GetDlgItemText GetDlgItemTextUTF8
120
121#ifdef MessageBox
122#undef MessageBox
123#endif
124#define MessageBox MessageBoxUTF8
125
126#ifdef DragQueryFile
127#undef DragQueryFile
128#endif
129#define DragQueryFile DragQueryFileUTF8
130
131#ifdef GetOpenFileName
132#undef GetOpenFileName
133#endif
134#define GetOpenFileName GetOpenFileNameUTF8
135
136#ifdef GetSaveFileName
137#undef GetSaveFileName
138#endif
139#define GetSaveFileName GetSaveFileNameUTF8
140
141#ifdef ShellExecute
142#undef ShellExecute
143#endif
144#define ShellExecute ShellExecuteUTF8
145
146#ifdef GetUserName
147#undef GetUserName
148#endif
149#define GetUserName GetUserNameUTF8
150
151#ifdef GetComputerName
152#undef GetComputerName
153#endif
154#define GetComputerName GetComputerNameUTF8
155
156#ifdef CreateDirectory
157#undef CreateDirectory
158#endif
159#define CreateDirectory CreateDirectoryUTF8
160
161#ifdef DeleteFile
162#undef DeleteFile
163#endif
164#define DeleteFile DeleteFileUTF8
165
166#ifdef MoveFile
167#undef MoveFile
168#endif
169#define MoveFile MoveFileUTF8
170
171#ifdef CopyFile
172#undef CopyFile
173#endif
174#define CopyFile CopyFileUTF8
175
176#ifdef GetCurrentDirectory
177#undef GetCurrentDirectory
178#endif
179#define GetCurrentDirectory GetCurrentDirectoryUTF8
180
181#ifdef SetCurrentDirectory
182#undef SetCurrentDirectory
183#endif
184#define SetCurrentDirectory SetCurrentDirectoryUTF8
185
186
187#ifdef RemoveDirectory
188#undef RemoveDirectory
189#endif
190#define RemoveDirectory RemoveDirectoryUTF8
191
192
193#ifdef CreateFile
194#undef CreateFile
195#endif
196#define CreateFile CreateFileUTF8
197
198
199#ifdef InsertMenu
200#undef InsertMenu
201#endif
202#define InsertMenu InsertMenuUTF8
203
204#ifdef InsertMenuItem
205#undef InsertMenuItem
206#endif
207#define InsertMenuItem InsertMenuItemUTF8
208
209#ifdef SetMenuItemInfo
210#undef SetMenuItemInfo
211#endif
212#define SetMenuItemInfo SetMenuItemInfoUTF8
213
214#ifdef GetMenuItemInfo
215#undef GetMenuItemInfo
216#endif
217#define GetMenuItemInfo GetMenuItemInfoUTF8
218
219#ifdef LoadLibrary
220#undef LoadLibrary
221#endif
222#define LoadLibrary LoadLibraryUTF8
223
224#ifdef GetPrivateProfileInt
225#undef GetPrivateProfileInt
226#endif
227#define GetPrivateProfileInt GetPrivateProfileIntUTF8
228
229#ifdef GetPrivateProfileString
230#undef GetPrivateProfileString
231#endif
232#define GetPrivateProfileString GetPrivateProfileStringUTF8
233
234#ifdef WritePrivateProfileString
235#undef WritePrivateProfileString
236#endif
237#define WritePrivateProfileString WritePrivateProfileStringUTF8
238
239#ifdef WritePrivateProfileStruct
240#undef WritePrivateProfileStruct
241#endif
242#define WritePrivateProfileStruct WritePrivateProfileStructUTF8
243
244#ifdef GetPrivateProfileStruct
245#undef GetPrivateProfileStruct
246#endif
247#define GetPrivateProfileStruct GetPrivateProfileStructUTF8
248
249
250#ifdef GetModuleFileName
251#undef GetModuleFileName
252#endif
253#define GetModuleFileName GetModuleFileNameUTF8
254
255#ifdef CreateProcess
256#undef CreateProcess
257#endif
258#define CreateProcess CreateProcessUTF8
259
260#ifdef fopen
261#undef fopen
262#endif
263#define fopen fopenUTF8
264
265#ifdef stat
266#undef stat
267#endif
268#define stat(fn,s) statUTF8(fn,s)
269typedef char wdl_utf8_chk_stat_types_assert_failed[sizeof(struct stat) == sizeof(struct _stat) ? 1 : -1];
270
271#else
272
273#if defined(WDL_CHECK_FOR_NON_UTF8_FOPEN) && defined(fopen)
274 #undef fopen
275#endif
276
277// compat defines for when UTF disabled
278#define DrawTextUTF8 DrawText
279#define statUTF8 stat
280#define fopenUTF8 fopen
281#define WDL_UTF8_HookComboBox(x)
282#define WDL_UTF8_HookListView(x)
283#define WDL_UTF8_HookListBox(x)
284#define WDL_UTF8_HookTreeView(x)
285#define WDL_UTF8_HookTabCtrl(x)
286#define WDL_UTF8_ListViewConvertDispInfoToW(x)
287
288#endif
289
290#ifdef __cplusplus
291};
292#endif
293
294#endif
static char filename[]
Definition features.c:5
png_structrp int mode
Definition png.h:1139
RECT const char void HWND hwnd
Definition swell-functions.h:1066
void * HINSTANCE
Definition swell-types.h:212
char * LPSTR
Definition swell-types.h:189
struct RECT * LPRECT
uintptr_t UINT_PTR
Definition swell-types.h:43
unsigned int UINT
Definition swell-types.h:166
int INT
Definition swell-types.h:167
signed char BOOL
Definition swell-types.h:160
unsigned int DWORD
Definition swell-types.h:164
void * HDROP
Definition swell-types.h:212
struct HMENU__ * HMENU
Definition swell-types.h:211
signed int LONG
Definition swell-types.h:182
void * HANDLE
Definition swell-types.h:212
void * LPVOID
Definition swell-types.h:174
struct HWND__ * HWND
Definition swell-types.h:210
char * LPTSTR
Definition swell-types.h:189
struct HDC__ * HDC
Definition swell-types.h:263
const char * LPCTSTR
Definition swell-types.h:190
uch h[RAND_HEAD_LEN]
Definition crypt.c:459
_WDL_CSTRING_PREFIX void INT_PTR const char * format
Definition wdlcstring.h:263
#define DrawTextUTF8
Definition win32_utf8.h:278
#define WDL_UTF8_HookTreeView(x)
Definition win32_utf8.h:284
#define fopenUTF8
Definition win32_utf8.h:280
#define WDL_UTF8_ListViewConvertDispInfoToW(x)
Definition win32_utf8.h:286
#define WDL_UTF8_HookListView(x)
Definition win32_utf8.h:282
#define WDL_UTF8_HookListBox(x)
Definition win32_utf8.h:283
#define WDL_UTF8_HookComboBox(x)
Definition win32_utf8.h:281
#define WDL_UTF8_HookTabCtrl(x)
Definition win32_utf8.h:285
#define statUTF8
Definition win32_utf8.h:279