summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2019-09-20 13:38:21 (GMT)
committerdgp <dgp@users.sourceforge.net>2019-09-20 13:38:21 (GMT)
commitcd20edbb665c16909bbd2a4e4f883d84c05892da (patch)
tree8d3e89e4946a24181b53dc14f90c34860dd0a908 /win
parent05e5bd41202409d6adc6b3999de853b8de400cd9 (diff)
parentcd10234e38f770e0ccb89282180716b4cbd04fea (diff)
downloadtk-cd20edbb665c16909bbd2a4e4f883d84c05892da.zip
tk-cd20edbb665c16909bbd2a4e4f883d84c05892da.tar.gz
tk-cd20edbb665c16909bbd2a4e4f883d84c05892da.tar.bz2
merge 8.6
Diffstat (limited to 'win')
-rw-r--r--win/tkWinButton.c8
-rw-r--r--win/tkWinCursor.c8
-rw-r--r--win/tkWinDialog.c58
-rw-r--r--win/tkWinEmbed.c4
-rw-r--r--win/tkWinFont.c77
-rw-r--r--win/tkWinImage.c1
-rw-r--r--win/tkWinInit.c10
-rw-r--r--win/tkWinMenu.c22
-rw-r--r--win/tkWinPixmap.c4
-rw-r--r--win/tkWinScrlbr.c2
-rw-r--r--win/tkWinTest.c17
-rw-r--r--win/tkWinWindow.c4
-rw-r--r--win/tkWinWm.c31
-rw-r--r--win/tkWinX.c16
-rw-r--r--win/ttkWinMonitor.c14
-rw-r--r--win/ttkWinXPTheme.c2
16 files changed, 119 insertions, 159 deletions
diff --git a/win/tkWinButton.c b/win/tkWinButton.c
index ec8141c..fc5d9e2 100644
--- a/win/tkWinButton.c
+++ b/win/tkWinButton.c
@@ -131,9 +131,9 @@ InitBoxes(void)
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- hrsrc = FindResource(module, L"buttons", RT_BITMAP);
+ hrsrc = FindResourceW(module, L"buttons", (LPWSTR) RT_BITMAP);
if (hrsrc == NULL) {
- Tcl_Panic("FindResource() failed for buttons bitmap resource, "
+ Tcl_Panic("FindResourceW() failed for buttons bitmap resource, "
"resources in tk_base.rc must be linked into Tk dll or static executable");
} else {
hblk = LoadResource(module, hrsrc);
@@ -253,7 +253,7 @@ CreateProc(
class = L"BUTTON";
butPtr->style = BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS;
}
- butPtr->hwnd = CreateWindow(class, NULL, butPtr->style,
+ butPtr->hwnd = CreateWindowW(class, NULL, butPtr->style,
Tk_X(tkwin), Tk_Y(tkwin), Tk_Width(tkwin), Tk_Height(tkwin),
parent, NULL, Tk_GetHINSTANCE(), NULL);
SetWindowPos(butPtr->hwnd, HWND_TOP, 0, 0, 0, 0,
@@ -1300,7 +1300,7 @@ ButtonProc(
return 0;
}
}
-
+ /* FALLTHRU */
default:
if (Tk_TranslateWinEvent(hwnd, message, wParam, lParam, &result)) {
return result;
diff --git a/win/tkWinCursor.c b/win/tkWinCursor.c
index 6a9dc75..3cf33e8 100644
--- a/win/tkWinCursor.c
+++ b/win/tkWinCursor.c
@@ -41,7 +41,7 @@ typedef struct {
static struct CursorName {
const char *name;
- LPCWSTR id;
+ LPCTSTR id;
} cursorNames[] = {
{"starting", IDC_APPSTARTING},
{"arrow", IDC_ARROW},
@@ -71,7 +71,7 @@ static struct CursorName {
* The default cursor is used whenever no other cursor has been specified.
*/
-#define TK_DEFAULT_CURSOR IDC_ARROW
+#define TK_DEFAULT_CURSOR (LPCWSTR)IDC_ARROW
/*
*----------------------------------------------------------------------
@@ -145,7 +145,7 @@ TkGetCursorByName(
for (namePtr = cursorNames; namePtr->name != NULL; namePtr++) {
if (strcmp(namePtr->name, argv[0]) == 0) {
- cursorPtr->winCursor = LoadCursor(NULL, namePtr->id);
+ cursorPtr->winCursor = LoadCursorW(NULL, (LPCWSTR) namePtr->id);
break;
}
}
@@ -253,7 +253,7 @@ TkpSetCursor(
TkWinCursor *winCursor = (TkWinCursor *) cursor;
if (winCursor == NULL || winCursor->winCursor == NULL) {
- hcursor = LoadCursor(NULL, TK_DEFAULT_CURSOR);
+ hcursor = LoadCursorW(NULL, TK_DEFAULT_CURSOR);
} else {
hcursor = winCursor->winCursor;
}
diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c
index 23c7f46..afee8f2 100644
--- a/win/tkWinDialog.c
+++ b/win/tkWinDialog.c
@@ -641,7 +641,7 @@ static void LoadShellProcs()
if (shell32_handle != NULL)
return; /* We have already been through here. */
- shell32_handle = GetModuleHandle(L"shell32.dll");
+ shell32_handle = GetModuleHandleW(L"shell32.dll");
if (shell32_handle == NULL) /* Should never happen but check anyways. */
return;
@@ -758,7 +758,7 @@ Tk_ChooseColorObjCmd(
Tk_Window tkwin = clientData, parent;
HWND hWnd;
int i, oldMode, winCode, result;
- CHOOSECOLOR chooseColor;
+ CHOOSECOLORW chooseColor;
static int inited = 0;
static COLORREF dwCustColors[16];
static long oldColor; /* the color selected last time */
@@ -846,7 +846,7 @@ Tk_ChooseColorObjCmd(
chooseColor.hwndOwner = hWnd;
oldMode = Tcl_SetServiceMode(TCL_SERVICE_ALL);
- winCode = ChooseColor(&chooseColor);
+ winCode = ChooseColorW(&chooseColor);
(void) Tcl_SetServiceMode(oldMode);
/*
@@ -926,7 +926,7 @@ ColorDlgHookProc(
if ((title != NULL) && (title[0] != '\0')) {
Tcl_DString ds;
- SetWindowText(hDlg, Tcl_WinUtfToTChar(title,-1,&ds));
+ SetWindowTextW(hDlg, Tcl_WinUtfToTChar(title,-1,&ds));
Tcl_DStringFree(&ds);
}
if (tsdPtr->debugFlag) {
@@ -1569,7 +1569,7 @@ vamoose: /* (hr != 0) => error */
*/
static int GetFileNameXP(Tcl_Interp *interp, OFNOpts *optsPtr, enum OFNOper oper)
{
- OPENFILENAME ofn;
+ OPENFILENAMEW ofn;
OFNData ofnData;
int cdlgerr;
int filterIndex = 0, result = TCL_ERROR, winCode, oldMode;
@@ -1673,9 +1673,9 @@ static int GetFileNameXP(Tcl_Interp *interp, OFNOpts *optsPtr, enum OFNOper oper
oldMode = Tcl_SetServiceMode(TCL_SERVICE_ALL);
if (oper != OFN_FILE_SAVE) {
- winCode = GetOpenFileName(&ofn);
+ winCode = GetOpenFileNameW(&ofn);
} else {
- winCode = GetSaveFileName(&ofn);
+ winCode = GetSaveFileNameW(&ofn);
}
Tcl_SetServiceMode(oldMode);
EatSpuriousMessageBugFix();
@@ -2431,7 +2431,7 @@ Tk_ChooseDirectoryObjCmd(
WCHAR path[MAX_PATH];
int oldMode, result;
LPCITEMIDLIST pidl; /* Returned by browser */
- BROWSEINFO bInfo; /* Used by browser */
+ BROWSEINFOW bInfo; /* Used by browser */
ChooseDir cdCBData; /* Structure to pass back and forth */
LPMALLOC pMalloc; /* Used by shell */
HWND hWnd;
@@ -2471,7 +2471,7 @@ Tk_ChooseDirectoryObjCmd(
/* Convert possible relative path to full path to keep dialog happy. */
- GetFullPathName(uniStr, MAX_PATH, saveDir, NULL);
+ GetFullPathNameW(uniStr, MAX_PATH, saveDir, NULL);
wcsncpy(cdCBData.initDir, saveDir, MAX_PATH);
}
@@ -2492,7 +2492,7 @@ Tk_ChooseDirectoryObjCmd(
bInfo.pszDisplayName = path;
bInfo.pidlRoot = NULL;
if (wcslen(cdCBData.initDir) == 0) {
- GetCurrentDirectory(MAX_PATH, cdCBData.initDir);
+ GetCurrentDirectoryW(MAX_PATH, cdCBData.initDir);
}
bInfo.lParam = (LPARAM) &cdCBData;
@@ -2533,13 +2533,13 @@ Tk_ChooseDirectoryObjCmd(
*/
oldMode = Tcl_SetServiceMode(TCL_SERVICE_ALL);
- GetCurrentDirectory(MAX_PATH, saveDir);
+ GetCurrentDirectoryW(MAX_PATH, saveDir);
if (SHGetMalloc(&pMalloc) == NOERROR) {
/*
* XXX - MSDN says CoInitialize must have been called before
* SHBrowseForFolder can be used but don't see that called anywhere.
*/
- pidl = SHBrowseForFolder(&bInfo);
+ pidl = SHBrowseForFolderW(&bInfo);
/*
* This is a fix for Windows 2000, which seems to modify the folder
@@ -2554,7 +2554,7 @@ Tk_ChooseDirectoryObjCmd(
*/
if (pidl != NULL) {
- if (!SHGetPathFromIDList(pidl, path)) {
+ if (!SHGetPathFromIDListW(pidl, path)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"error: not a file system folder", -1));
Tcl_SetErrorCode(interp, "TK", "DIRDIALOG", "PSEUDO", NULL);
@@ -2565,7 +2565,7 @@ Tk_ChooseDirectoryObjCmd(
}
pMalloc->lpVtbl->Release(pMalloc);
}
- SetCurrentDirectory(saveDir);
+ SetCurrentDirectoryW(saveDir);
Tcl_SetServiceMode(oldMode);
/*
@@ -2659,7 +2659,7 @@ ChooseDirectoryValidateProc(
MAX_PATH);
Tcl_DStringFree(&initDirString);
- if (SetCurrentDirectory(string) == 0) {
+ if (SetCurrentDirectoryW(string) == 0) {
/*
* Get the full path name to the user entry, at this point it does
@@ -2667,17 +2667,17 @@ ChooseDirectoryValidateProc(
* it.
*/
- GetFullPathName(string, MAX_PATH,
+ GetFullPathNameW(string, MAX_PATH,
chooseDirSharedData->retDir, NULL);
if (chooseDirSharedData->mustExist) {
/*
* User HAS to select a valid directory.
*/
- wsprintf(selDir, L"Directory '%s' does not exist,\n"
+ wsprintfW(selDir, L"Directory '%s' does not exist,\n"
L"please select or enter an existing directory.",
chooseDirSharedData->retDir);
- MessageBox(NULL, selDir, NULL, MB_ICONEXCLAMATION|MB_OK);
+ MessageBoxW(NULL, selDir, NULL, MB_ICONEXCLAMATION|MB_OK);
chooseDirSharedData->retDir[0] = '\0';
return 1;
}
@@ -2687,7 +2687,7 @@ ChooseDirectoryValidateProc(
* directory in utfRetDir.
*/
- GetCurrentDirectory(MAX_PATH, chooseDirSharedData->retDir);
+ GetCurrentDirectoryW(MAX_PATH, chooseDirSharedData->retDir);
return 0;
}
return 0;
@@ -2702,7 +2702,7 @@ ChooseDirectoryValidateProc(
* Not called when user changes edit box directly.
*/
- if (SHGetPathFromIDList((LPITEMIDLIST) lParam, selDir)) {
+ if (SHGetPathFromIDListW((LPITEMIDLIST) lParam, selDir)) {
SendMessage(hwnd, BFFM_SETSTATUSTEXT, 0, (LPARAM) selDir);
// enable the OK button
SendMessage(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 1);
@@ -2721,7 +2721,7 @@ ChooseDirectoryValidateProc(
WCHAR *initDir = chooseDirSharedData->initDir;
- SetCurrentDirectory(initDir);
+ SetCurrentDirectoryW(initDir);
if (*initDir == '\\') {
/*
@@ -2941,7 +2941,7 @@ Tk_MessageBoxObjCmd(
titlePtr = L"";
Tcl_DStringInit(&titleBuf);
}
- winCode = MessageBox(hWnd, tmpPtr, titlePtr, flags);
+ winCode = MessageBoxW(hWnd, tmpPtr, titlePtr, flags);
Tcl_DStringFree(&titleBuf);
Tcl_DStringFree(&tmpBuf);
UnhookWindowsHookEx(tsdPtr->hMsgBoxHook);
@@ -3063,7 +3063,7 @@ ConvertExternalFilename(
static Tcl_Obj *
GetFontObj(
HDC hdc,
- LOGFONT *plf)
+ LOGFONTW *plf)
{
Tcl_DString ds;
Tcl_Obj *resObj;
@@ -3099,7 +3099,7 @@ ApplyLogfont(
Tcl_Interp *interp,
Tcl_Obj *cmdObj,
HDC hdc,
- LOGFONT *logfontPtr)
+ LOGFONTW *logfontPtr)
{
int objc;
Tcl_Obj **objv, **tmpv;
@@ -3158,7 +3158,7 @@ HookProc(
Tcl_WinUtfToTChar(Tcl_GetString(phd->titleObj), -1, &title);
if (Tcl_DStringLength(&title) > 0) {
- SetWindowText(hwndDlg, (LPCWSTR) Tcl_DStringValue(&title));
+ SetWindowTextW(hwndDlg, (LPCWSTR) Tcl_DStringValue(&title));
}
Tcl_DStringFree(&title);
}
@@ -3191,7 +3191,7 @@ HookProc(
*/
if (WM_COMMAND == msg && LOWORD(wParam) == 1026) {
- LOGFONT lf = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0}};
+ LOGFONTW lf = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0}};
HDC hdc = GetDC(hwndDlg);
SendMessage(hwndDlg, WM_CHOOSEFONT_GETLOGFONT, 0, (LPARAM) &lf);
@@ -3430,8 +3430,8 @@ FontchooserShowCmd(
{
Tcl_DString ds;
Tk_Window tkwin = clientData, parent;
- CHOOSEFONT cf;
- LOGFONT lf;
+ CHOOSEFONTW cf;
+ LOGFONTW lf;
HDC hdc;
HookData *hdPtr;
int r = TCL_OK, oldMode = 0;
@@ -3506,7 +3506,7 @@ FontchooserShowCmd(
if (TCL_OK == r) {
oldMode = Tcl_SetServiceMode(TCL_SERVICE_ALL);
- if (ChooseFont(&cf)) {
+ if (ChooseFontW(&cf)) {
if (hdPtr->cmdObj) {
ApplyLogfont(hdPtr->interp, hdPtr->cmdObj, hdc, &lf);
}
diff --git a/win/tkWinEmbed.c b/win/tkWinEmbed.c
index e22314f..ec2a2c3 100644
--- a/win/tkWinEmbed.c
+++ b/win/tkWinEmbed.c
@@ -305,8 +305,8 @@ TkpUseWindow(
WCHAR msg[256];
- wsprintf(msg, L"Unable to get information of window \"%.40hs\". Attach to this\nwindow may have unpredictable results if it is not a valid container.\n\nPress Ok to proceed or Cancel to abort attaching.", string);
- if (IDCANCEL == MessageBox(hwnd, msg, L"Tk Warning",
+ wsprintfW(msg, L"Unable to get information of window \"%.40hs\". Attach to this\nwindow may have unpredictable results if it is not a valid container.\n\nPress Ok to proceed or Cancel to abort attaching.", string);
+ if (IDCANCEL == MessageBoxW(hwnd, msg, L"Tk Warning",
MB_OKCANCEL | MB_ICONWARNING)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"Operation has been canceled", -1));
diff --git a/win/tkWinFont.c b/win/tkWinFont.c
index 35a9941..85a0131 100644
--- a/win/tkWinFont.c
+++ b/win/tkWinFont.c
@@ -179,12 +179,6 @@ typedef struct {
static Tcl_ThreadDataKey dataKey;
/*
- * Information cached about the system at startup time.
- */
-
-static Tcl_Encoding systemEncoding;
-
-/*
* Procedures used only in this file.
*/
@@ -213,7 +207,7 @@ static inline void InitSubFont(HDC hdc, HFONT hFont, int base,
SubFont *subFontPtr);
static int CreateNamedSystemLogFont(Tcl_Interp *interp,
Tk_Window tkwin, const char* name,
- LOGFONT* logFontPtr);
+ LOGFONTW* logFontPtr);
static int CreateNamedSystemFont(Tcl_Interp *interp,
Tk_Window tkwin, const char* name, HFONT hFont);
static int LoadFontRanges(HDC hdc, HFONT hFont,
@@ -229,13 +223,13 @@ static inline HFONT SelectFont(HDC hdc, WinFont *fontPtr,
SubFont *subFontPtr, double angle);
static inline void SwapLong(PULONG p);
static inline void SwapShort(USHORT *p);
-static int CALLBACK WinFontCanUseProc(ENUMLOGFONT *lfPtr,
+static int CALLBACK WinFontCanUseProc(ENUMLOGFONTW *lfPtr,
NEWTEXTMETRIC *tmPtr, int fontType,
LPARAM lParam);
-static int CALLBACK WinFontExistProc(ENUMLOGFONT *lfPtr,
+static int CALLBACK WinFontExistProc(ENUMLOGFONTW *lfPtr,
NEWTEXTMETRIC *tmPtr, int fontType,
LPARAM lParam);
-static int CALLBACK WinFontFamilyEnumProc(ENUMLOGFONT *lfPtr,
+static int CALLBACK WinFontFamilyEnumProc(ENUMLOGFONTW *lfPtr,
NEWTEXTMETRIC *tmPtr, int fontType,
LPARAM lParam);
@@ -262,7 +256,6 @@ void
TkpFontPkgInit(
TkMainInfo *mainPtr) /* The application being created. */
{
- systemEncoding = TkWinGetUnicodeEncoding();
TkWinSetupSystemFonts(mainPtr);
}
@@ -331,12 +324,12 @@ CreateNamedSystemLogFont(
Tcl_Interp *interp,
Tk_Window tkwin,
const char* name,
- LOGFONT* logFontPtr)
+ LOGFONTW* logFontPtr)
{
HFONT hFont;
int r;
- hFont = CreateFontIndirect(logFontPtr);
+ hFont = CreateFontIndirectW(logFontPtr);
r = CreateNamedSystemFont(interp, tkwin, name, hFont);
DeleteObject((HGDIOBJ)hFont);
return r;
@@ -392,8 +385,8 @@ TkWinSetupSystemFonts(
Tcl_Interp *interp;
Tk_Window tkwin;
const TkStateMap *mapPtr;
- NONCLIENTMETRICS ncMetrics;
- ICONMETRICS iconMetrics;
+ NONCLIENTMETRICSW ncMetrics;
+ ICONMETRICSW iconMetrics;
HFONT hFont;
interp = (Tcl_Interp *) mainPtr->interp;
@@ -444,7 +437,7 @@ TkWinSetupSystemFonts(
*/
{
- LOGFONT lfFixed = {
+ LOGFONTW lfFixed = {
0, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET,
0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, L""
};
@@ -651,7 +644,7 @@ TkpGetFontFamilies(
* because it only exists under NT.
*/
- EnumFontFamilies(hdc, NULL, (FONTENUMPROC) WinFontFamilyEnumProc,
+ EnumFontFamiliesW(hdc, NULL, (FONTENUMPROCW) WinFontFamilyEnumProc,
(LPARAM) resultObj);
ReleaseDC(hwnd, hdc);
Tcl_SetObjResult(interp, resultObj);
@@ -659,16 +652,15 @@ TkpGetFontFamilies(
static int CALLBACK
WinFontFamilyEnumProc(
- ENUMLOGFONT *lfPtr, /* Logical-font data. */
+ ENUMLOGFONTW *lfPtr, /* Logical-font data. */
NEWTEXTMETRIC *tmPtr, /* Physical-font data (not used). */
int fontType, /* Type of font (not used). */
LPARAM lParam) /* Result object to hold result. */
{
- char *faceName = (char *) lfPtr->elfLogFont.lfFaceName;
Tcl_Obj *resultObj = (Tcl_Obj *) lParam;
Tcl_DString faceString;
- Tcl_ExternalToUtfDString(systemEncoding, faceName, -1, &faceString);
+ Tcl_WinTCharToUtf(lfPtr->elfLogFont.lfFaceName, -1, &faceString);
Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj(
Tcl_DStringValue(&faceString), Tcl_DStringLength(&faceString)));
Tcl_DStringFree(&faceString);
@@ -1574,23 +1566,8 @@ InitFont(
GetTextMetrics(hdc, &tm);
- /*
- * On any version NT, there may fonts with international names. Use the
- * NT-only Unicode version of GetTextFace to get the font's name. If we
- * used the ANSI version on a non-internationalized version of NT, we
- * would get a font name with '?' replacing all the international
- * characters.
- *
- * On a non-internationalized verson of 95, fonts with international names
- * are not allowed, so the ANSI version of GetTextFace will work. On an
- * internationalized version of 95, there may be fonts with international
- * names; the ANSI version will work, fetching the name in the
- * international system code page. Can't use the Unicode version of
- * GetTextFace because it only exists under NT.
- */
-
- GetTextFace(hdc, LF_FACESIZE, buf);
- Tcl_ExternalToUtfDString(systemEncoding, (char *) buf, -1, &faceString);
+ GetTextFaceW(hdc, LF_FACESIZE, buf);
+ Tcl_WinTCharToUtf(buf, -1, &faceString);
fontPtr->font.fid = (Font) fontPtr;
fontPtr->hwnd = hwnd;
@@ -1766,8 +1743,8 @@ AllocFontFamily(
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
hFont = SelectObject(hdc, hFont);
- GetTextFace(hdc, LF_FACESIZE, buf);
- Tcl_ExternalToUtfDString(systemEncoding, (char *) buf, -1, &faceString);
+ GetTextFaceW(hdc, LF_FACESIZE, buf);
+ Tcl_WinTCharToUtf(buf, -1, &faceString);
faceName = Tk_GetUid(Tcl_DStringValue(&faceString));
Tcl_DStringFree(&faceString);
hFont = SelectObject(hdc, hFont);
@@ -2028,7 +2005,7 @@ FindSubFontForChar(
canUse.ch = ch;
canUse.subFontPtr = NULL;
canUse.subFontPtrPtr = subFontPtrPtr;
- EnumFontFamilies(hdc, NULL, (FONTENUMPROC) WinFontCanUseProc,
+ EnumFontFamiliesW(hdc, NULL, (FONTENUMPROCW) WinFontCanUseProc,
(LPARAM) &canUse);
subFontPtr = canUse.subFontPtr;
@@ -2050,7 +2027,7 @@ FindSubFontForChar(
static int CALLBACK
WinFontCanUseProc(
- ENUMLOGFONT *lfPtr, /* Logical-font data. */
+ ENUMLOGFONTW *lfPtr, /* Logical-font data. */
NEWTEXTMETRIC *tmPtr, /* Physical-font data (not used). */
int fontType, /* Type of font (not used). */
LPARAM lParam) /* Result object to hold result. */
@@ -2070,9 +2047,7 @@ WinFontCanUseProc(
fontPtr = canUsePtr->fontPtr;
nameTriedPtr = canUsePtr->nameTriedPtr;
- fallbackName = (char *) lfPtr->elfLogFont.lfFaceName;
- Tcl_ExternalToUtfDString(systemEncoding, fallbackName, -1, &faceString);
- fallbackName = Tcl_DStringValue(&faceString);
+ fallbackName = Tcl_WinTCharToUtf(lfPtr->elfLogFont.lfFaceName, -1, &faceString);
if (SeenName(fallbackName, nameTriedPtr) == 0) {
subFontPtr = CanUseFallback(hdc, fontPtr, fallbackName, ch,
@@ -2482,7 +2457,7 @@ GetScreenFont(
{
Tcl_DString ds;
HFONT hFont;
- LOGFONT lf;
+ LOGFONTW lf;
memset(&lf, 0, sizeof(lf));
lf.lfHeight = -pixelSize;
@@ -2499,11 +2474,11 @@ GetScreenFont(
lf.lfQuality = DEFAULT_QUALITY;
lf.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
- Tcl_UtfToExternalDString(systemEncoding, faceName, -1, &ds);
+ Tcl_WinUtfToTChar(faceName, -1, &ds);
wcsncpy(lf.lfFaceName, (WCHAR *)Tcl_DStringValue(&ds), LF_FACESIZE-1);
Tcl_DStringFree(&ds);
lf.lfFaceName[LF_FACESIZE-1] = 0;
- hFont = CreateFontIndirect(&lf);
+ hFont = CreateFontIndirectW(&lf);
return hFont;
}
@@ -2550,7 +2525,7 @@ FamilyExists(
return 0;
}
- Tcl_UtfToExternalDString(systemEncoding, faceName, -1, &faceString);
+ Tcl_WinUtfToTChar(faceName, -1, &faceString);
/*
* If the family exists, WinFontExistProc() will be called and
@@ -2559,8 +2534,8 @@ FamilyExists(
* non-zero value.
*/
- result = EnumFontFamilies(hdc, (WCHAR*) Tcl_DStringValue(&faceString),
- (FONTENUMPROC) WinFontExistProc, 0);
+ result = EnumFontFamiliesW(hdc, (WCHAR*) Tcl_DStringValue(&faceString),
+ (FONTENUMPROCW) WinFontExistProc, 0);
Tcl_DStringFree(&faceString);
return (result == 0);
}
@@ -2589,7 +2564,7 @@ FamilyOrAliasExists(
static int CALLBACK
WinFontExistProc(
- ENUMLOGFONT *lfPtr, /* Logical-font data. */
+ ENUMLOGFONTW *lfPtr, /* Logical-font data. */
NEWTEXTMETRIC *tmPtr, /* Physical-font data (not used). */
int fontType, /* Type of font (not used). */
LPARAM lParam) /* EnumFontData to hold result. */
diff --git a/win/tkWinImage.c b/win/tkWinImage.c
index 0a8ef73..e1660a9 100644
--- a/win/tkWinImage.c
+++ b/win/tkWinImage.c
@@ -126,6 +126,7 @@ PutPixel(
*/
destPtr[3] = 0;
+ /* FALLTHRU */
case 24:
/*
* Pixel is triplet: 0xBBGGRR.
diff --git a/win/tkWinInit.c b/win/tkWinInit.c
index a94561c..15614a0 100644
--- a/win/tkWinInit.c
+++ b/win/tkWinInit.c
@@ -181,30 +181,24 @@ TkWin32ErrorObj(
LPWSTR lpBuffer = NULL, p = NULL;
WCHAR sBuffer[30];
Tcl_Obj* errPtr = NULL;
-#ifdef _UNICODE
Tcl_DString ds;
-#endif
- FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM
+ FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM
| FORMAT_MESSAGE_IGNORE_INSERTS, NULL, (DWORD)hrError,
LANG_NEUTRAL, (LPWSTR)&lpBuffer, 0, NULL);
if (lpBuffer == NULL) {
lpBuffer = sBuffer;
- wsprintf(sBuffer, L"Error Code: %08lX", hrError);
+ wsprintfW(sBuffer, L"Error Code: %08lX", hrError);
}
if ((p = wcsrchr(lpBuffer, '\r')) != NULL) {
*p = '\0';
}
-#ifdef _UNICODE
Tcl_WinTCharToUtf(lpBuffer, -1, &ds);
errPtr = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds));
Tcl_DStringFree(&ds);
-#else
- errPtr = Tcl_NewStringObj(lpBuffer, (int)strlen(lpBuffer));
-#endif /* _UNICODE */
if (lpBuffer != sBuffer) {
LocalFree((HLOCAL)lpBuffer);
diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c
index 5ee911a..f93c052 100644
--- a/win/tkWinMenu.c
+++ b/win/tkWinMenu.c
@@ -716,7 +716,7 @@ ReconfigureWindowsMenu(
}
}
if (!systemMenu) {
- InsertMenu(winMenuHdl, 0xFFFFFFFF, flags, itemID, lpNewItem);
+ InsertMenuW(winMenuHdl, 0xFFFFFFFF, flags, itemID, lpNewItem);
}
Tcl_DStringFree(&translatedText);
if (itemText != NULL) {
@@ -1100,7 +1100,7 @@ TkWinEmbeddedMenuProc(
if (lResult || (GetCapture() != hwnd)) {
break;
}
-
+ /* FALLTHRU */
default:
lResult = DefWindowProc(hwnd, message, wParam, lParam);
break;
@@ -3213,8 +3213,8 @@ static void
MenuExitHandler(
ClientData clientData) /* Not used */
{
- UnregisterClass(MENU_CLASS_NAME, Tk_GetHINSTANCE());
- UnregisterClass(EMBEDDED_MENU_CLASS_NAME, Tk_GetHINSTANCE());
+ UnregisterClassW(MENU_CLASS_NAME, Tk_GetHINSTANCE());
+ UnregisterClassW(EMBEDDED_MENU_CLASS_NAME, Tk_GetHINSTANCE());
}
/*
@@ -3319,7 +3319,7 @@ SetDefaults(
HFONT menuFont;
/* See: [Bug #3239768] tk8.4.19 (and later) WIN32 menu font support */
struct {
- NONCLIENTMETRICS metrics;
+ NONCLIENTMETRICSW metrics;
#if (WINVER < 0x0600)
int padding;
#endif
@@ -3352,7 +3352,7 @@ SetDefaults(
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, nc.metrics.cbSize,
&nc.metrics, 0);
- menuFont = CreateFontIndirect(&nc.metrics.lfMenuFont);
+ menuFont = CreateFontIndirectW(&nc.metrics.lfMenuFont);
SelectObject(scratchDC, menuFont);
GetTextMetrics(scratchDC, &tm);
GetTextFaceA(scratchDC, LF_FACESIZE, faceName);
@@ -3433,7 +3433,7 @@ SetDefaults(
void
TkpMenuInit(void)
{
- WNDCLASS wndClass;
+ WNDCLASSW wndClass;
wndClass.style = CS_OWNDC;
wndClass.lpfnWndProc = TkWinMenuProc;
@@ -3445,13 +3445,13 @@ TkpMenuInit(void)
wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wndClass.lpszMenuName = NULL;
wndClass.lpszClassName = MENU_CLASS_NAME;
- if (!RegisterClass(&wndClass)) {
+ if (!RegisterClassW(&wndClass)) {
Tcl_Panic("Failed to register menu window class");
}
wndClass.lpfnWndProc = TkWinEmbeddedMenuProc;
wndClass.lpszClassName = EMBEDDED_MENU_CLASS_NAME;
- if (!RegisterClass(&wndClass)) {
+ if (!RegisterClassW(&wndClass)) {
Tcl_Panic("Failed to register embedded menu window class");
}
@@ -3482,7 +3482,7 @@ TkpMenuThreadInit(void)
ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- tsdPtr->menuHWND = CreateWindow(MENU_CLASS_NAME, L"MenuWindow", WS_POPUP,
+ tsdPtr->menuHWND = CreateWindowW(MENU_CLASS_NAME, L"MenuWindow", WS_POPUP,
0, 0, 10, 10, NULL, NULL, Tk_GetHINSTANCE(), NULL);
if (!tsdPtr->menuHWND) {
@@ -3490,7 +3490,7 @@ TkpMenuThreadInit(void)
}
tsdPtr->embeddedMenuHWND =
- CreateWindow(EMBEDDED_MENU_CLASS_NAME, L"EmbeddedMenuWindow",
+ CreateWindowW(EMBEDDED_MENU_CLASS_NAME, L"EmbeddedMenuWindow",
WS_POPUP, 0, 0, 10, 10, NULL, NULL, Tk_GetHINSTANCE(), NULL);
if (!tsdPtr->embeddedMenuHWND) {
diff --git a/win/tkWinPixmap.c b/win/tkWinPixmap.c
index 9850e26..e28f348 100644
--- a/win/tkWinPixmap.c
+++ b/win/tkWinPixmap.c
@@ -100,12 +100,12 @@ Tk_GetPixmap(
LPVOID lpMsgBuf;
repeatError = 1;
- if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ if (FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPWSTR)&lpMsgBuf, 0, NULL)) {
- MessageBox(NULL, (LPWSTR) lpMsgBuf,
+ MessageBoxW(NULL, (LPWSTR) lpMsgBuf,
L"Tk_GetPixmap: Error from CreateDIBSection",
MB_OK | MB_ICONINFORMATION);
LocalFree(lpMsgBuf);
diff --git a/win/tkWinScrlbr.c b/win/tkWinScrlbr.c
index dc98dbd..39aeb3b 100644
--- a/win/tkWinScrlbr.c
+++ b/win/tkWinScrlbr.c
@@ -223,7 +223,7 @@ CreateProc(
| SBS_HORZ;
}
- scrollPtr->hwnd = CreateWindow(L"SCROLLBAR", NULL, style,
+ scrollPtr->hwnd = CreateWindowW(L"SCROLLBAR", NULL, style,
Tk_X(tkwin), Tk_Y(tkwin), Tk_Width(tkwin), Tk_Height(tkwin),
parent, NULL, Tk_GetHINSTANCE(), NULL);
diff --git a/win/tkWinTest.c b/win/tkWinTest.c
index 2cdea38..2ea535d 100644
--- a/win/tkWinTest.c
+++ b/win/tkWinTest.c
@@ -147,7 +147,7 @@ AppendSystemError(
if (Tcl_IsShared(resultPtr)) {
resultPtr = Tcl_DuplicateObj(resultPtr);
}
- length = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM
+ length = FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM
| FORMAT_MESSAGE_IGNORE_INSERTS
| FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL, error,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (WCHAR *) wMsgPtrPtr,
@@ -452,15 +452,12 @@ TestfindwindowObjCmd(
}
if (title[0] == 0)
title = NULL;
-#if 0
- hwnd = FindWindow(class, title);
-#else
/* We want find a window the belongs to us and not some other process */
hwnd = NULL;
myPid = GetCurrentProcessId();
while (1) {
DWORD pid, tid;
- hwnd = FindWindowEx(NULL, hwnd, class, title);
+ hwnd = FindWindowExW(NULL, hwnd, class, title);
if (hwnd == NULL)
break;
tid = GetWindowThreadProcessId(hwnd, &pid);
@@ -473,8 +470,6 @@ TestfindwindowObjCmd(
break; /* Found it */
}
-#endif
-
if (hwnd == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj("failed to find window: ", -1));
AppendSystemError(interp, GetLastError());
@@ -507,7 +502,7 @@ TestgetwindowinfoObjCmd(
int objc,
Tcl_Obj *const objv[])
{
- long hwnd;
+ Tcl_WideInt hwnd;
Tcl_Obj *dictObj = NULL, *classObj = NULL, *textObj = NULL;
Tcl_Obj *childrenObj = NULL;
WCHAR buf[512];
@@ -519,10 +514,10 @@ TestgetwindowinfoObjCmd(
return TCL_ERROR;
}
- if (Tcl_GetLongFromObj(interp, objv[1], &hwnd) != TCL_OK)
+ if (Tcl_GetWideIntFromObj(interp, objv[1], &hwnd) != TCL_OK)
return TCL_ERROR;
- cch = GetClassName(INT2PTR(hwnd), buf, cchBuf);
+ cch = GetClassNameW(INT2PTR(hwnd), buf, cchBuf);
if (cch == 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj("failed to get class name: ", -1));
AppendSystemError(interp, GetLastError());
@@ -539,7 +534,7 @@ TestgetwindowinfoObjCmd(
Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("id", 2),
Tcl_NewLongObj(GetWindowLongA(INT2PTR(hwnd), GWL_ID)));
- cch = GetWindowText(INT2PTR(hwnd), (LPWSTR)buf, cchBuf);
+ cch = GetWindowTextW(INT2PTR(hwnd), (LPWSTR)buf, cchBuf);
Tcl_WinTCharToUtf(buf, cch * sizeof (WCHAR), &ds);
textObj = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds));
Tcl_DStringFree(&ds);
diff --git a/win/tkWinWindow.c b/win/tkWinWindow.c
index 57c948e..ceceee6 100644
--- a/win/tkWinWindow.c
+++ b/win/tkWinWindow.c
@@ -277,7 +277,7 @@ TkpMakeWindow(
* order.
*/
- hwnd = CreateWindowEx(WS_EX_NOPARENTNOTIFY, TK_WIN_CHILD_CLASS_NAME, NULL,
+ hwnd = CreateWindowExW(WS_EX_NOPARENTNOTIFY, TK_WIN_CHILD_CLASS_NAME, NULL,
(DWORD) style, Tk_X(winPtr), Tk_Y(winPtr), Tk_Width(winPtr),
Tk_Height(winPtr), parentWin, NULL, Tk_GetHINSTANCE(), NULL);
SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0,
@@ -953,7 +953,7 @@ TkpMakeTransparentWindowExist(
int style = WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
DWORD exStyle = WS_EX_TRANSPARENT | WS_EX_TOPMOST;
- hWnd = CreateWindowEx(exStyle, TK_WIN_CHILD_CLASS_NAME, NULL, style,
+ hWnd = CreateWindowExW(exStyle, TK_WIN_CHILD_CLASS_NAME, NULL, style,
Tk_X(tkwin), Tk_Y(tkwin), Tk_Width(tkwin), Tk_Height(tkwin),
hParent, NULL, Tk_GetHINSTANCE(), NULL);
winPtr->window = Tk_AttachHWND(tkwin, hWnd);
diff --git a/win/tkWinWm.c b/win/tkWinWm.c
index 4cb0745..167b8ea 100644
--- a/win/tkWinWm.c
+++ b/win/tkWinWm.c
@@ -867,23 +867,18 @@ InitWindowClass(
if (!initialized) {
Tcl_MutexLock(&winWmMutex);
if (!initialized) {
- WNDCLASS class;
+ WNDCLASSW class;
initialized = 1;
- /*
- * The only difference between WNDCLASSW and WNDCLASSA are in
- * pointers, so we can use the generic structure WNDCLASS.
- */
-
- ZeroMemory(&class, sizeof(WNDCLASS));
+ ZeroMemory(&class, sizeof(WNDCLASSW));
class.style = CS_HREDRAW | CS_VREDRAW;
class.hInstance = Tk_GetHINSTANCE();
class.lpszClassName = TK_WIN_TOPLEVEL_CLASS_NAME;
class.lpfnWndProc = WmProc;
if (titlebaricon == NULL) {
- class.hIcon = LoadIcon(Tk_GetHINSTANCE(), L"tk");
+ class.hIcon = LoadIconW(Tk_GetHINSTANCE(), L"tk");
} else {
class.hIcon = GetIcon(titlebaricon, ICON_BIG);
if (class.hIcon == NULL) {
@@ -897,9 +892,9 @@ InitWindowClass(
tsdPtr->iconPtr = titlebaricon;
}
- class.hCursor = LoadCursor(NULL, IDC_ARROW);
+ class.hCursor = LoadCursorW(NULL, (LPCWSTR)IDC_ARROW);
- if (!RegisterClass(&class)) {
+ if (!RegisterClassW(&class)) {
Tcl_Panic("Unable to register TkTopLevel class");
}
}
@@ -1237,7 +1232,7 @@ ReadIconFromFile(
*/
if (lpIR == NULL) {
- SHFILEINFO sfiSM;
+ SHFILEINFOW sfiSM;
Tcl_DString ds, ds2;
DWORD *res;
const char *file;
@@ -1248,15 +1243,15 @@ ReadIconFromFile(
}
Tcl_WinUtfToTChar(file, -1, &ds2);
Tcl_DStringFree(&ds);
- res = (DWORD *)SHGetFileInfo((WCHAR *)Tcl_DStringValue(&ds2), 0, &sfiSM,
+ res = (DWORD *)SHGetFileInfoW((WCHAR *)Tcl_DStringValue(&ds2), 0, &sfiSM,
sizeof(SHFILEINFO), SHGFI_SMALLICON|SHGFI_ICON);
if (res != 0) {
- SHFILEINFO sfi;
+ SHFILEINFOW sfi;
unsigned size;
Tcl_ResetResult(interp);
- res = (DWORD *)SHGetFileInfo((WCHAR *)Tcl_DStringValue(&ds2), 0, &sfi,
+ res = (DWORD *)SHGetFileInfoW((WCHAR *)Tcl_DStringValue(&ds2), 0, &sfi,
sizeof(SHFILEINFO), SHGFI_ICON);
/*
@@ -1886,7 +1881,7 @@ TkWinWmCleanup(
}
tsdPtr->initialized = 0;
- UnregisterClass(TK_WIN_TOPLEVEL_CLASS_NAME, hInstance);
+ UnregisterClassW(TK_WIN_TOPLEVEL_CLASS_NAME, hInstance);
}
/*
@@ -2129,7 +2124,7 @@ UpdateWrapper(
Tcl_WinUtfToTChar(((wmPtr->title != NULL) ?
wmPtr->title : winPtr->nameUid), -1, &titleString);
- wmPtr->wrapper = CreateWindowEx(wmPtr->exStyle,
+ wmPtr->wrapper = CreateWindowExW(wmPtr->exStyle,
TK_WIN_TOPLEVEL_CLASS_NAME,
(LPCWSTR) Tcl_DStringValue(&titleString),
wmPtr->style, x, y, width, height,
@@ -5470,7 +5465,7 @@ WmTitleCmd(
Tcl_DString titleString;
int size = 256;
- GetWindowText(wrapper, buf, size);
+ GetWindowTextW(wrapper, buf, size);
Tcl_WinTCharToUtf(buf, -1, &titleString);
Tcl_SetObjResult(interp, Tcl_NewStringObj(
Tcl_DStringValue(&titleString),
@@ -5493,7 +5488,7 @@ WmTitleCmd(
Tcl_DString titleString;
Tcl_WinUtfToTChar(wmPtr->title, -1, &titleString);
- SetWindowText(wrapper, (LPCWSTR) Tcl_DStringValue(&titleString));
+ SetWindowTextW(wrapper, (LPCWSTR) Tcl_DStringValue(&titleString));
Tcl_DStringFree(&titleString);
}
}
diff --git a/win/tkWinX.c b/win/tkWinX.c
index 2ea5a95..5617db9 100644
--- a/win/tkWinX.c
+++ b/win/tkWinX.c
@@ -69,7 +69,7 @@
static const char winScreenName[] = ":0"; /* Default name of windows display. */
static HINSTANCE tkInstance = NULL; /* Application instance handle. */
static int childClassInitialized; /* Registered child class? */
-static WNDCLASS childClass; /* Window class for child windows. */
+static WNDCLASSW childClass; /* Window class for child windows. */
static int tkPlatformId = 0; /* version of Windows platform */
static int tkWinTheme = 0; /* See TkWinGetPlatformTheme */
static Tcl_Encoding keyInputEncoding = NULL;
@@ -138,7 +138,7 @@ TkGetServerInfo(
OSVERSIONINFOW os;
if (!buffer[0]) {
- HANDLE handle = GetModuleHandle(L"NTDLL");
+ HANDLE handle = GetModuleHandleW(L"NTDLL");
int(__stdcall *getversion)(void *) =
(int(__stdcall *)(void *))GetProcAddress(handle, "RtlGetVersion");
os.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
@@ -179,7 +179,7 @@ HINSTANCE
Tk_GetHINSTANCE(void)
{
if (tkInstance == NULL) {
- tkInstance = GetModuleHandle(NULL);
+ tkInstance = GetModuleHandleW(NULL);
}
return tkInstance;
}
@@ -259,7 +259,7 @@ TkWinXInit(
childClass.hIcon = NULL;
childClass.hCursor = NULL;
- if (!RegisterClass(&childClass)) {
+ if (!RegisterClassW(&childClass)) {
Tcl_Panic("Unable to register TkChild class");
}
@@ -267,7 +267,7 @@ TkWinXInit(
* Initialize input language info
*/
- if (GetLocaleInfo(LANGIDFROMLCID(PTR2INT(GetKeyboardLayout(0))),
+ if (GetLocaleInfoW(LANGIDFROMLCID(PTR2INT(GetKeyboardLayout(0))),
LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER,
(LPWSTR) &lpCP, sizeof(lpCP)/sizeof(WCHAR))
&& TranslateCharsetInfo(INT2PTR(lpCP), &lpCs, TCI_SRCCODEPAGE)) {
@@ -309,7 +309,7 @@ TkWinXCleanup(
if (childClassInitialized) {
childClassInitialized = 0;
- UnregisterClass(TK_WIN_CHILD_CLASS_NAME, hInstance);
+ UnregisterClassW(TK_WIN_CHILD_CLASS_NAME, hInstance);
}
if (unicodeEncoding != NULL) {
@@ -371,11 +371,11 @@ TkWinGetPlatformId(void)
char pBuffer[200];
memset(pBuffer, 0, dwSize);
- if (RegOpenKeyEx(HKEY_CURRENT_USER, szSubKey, 0L,
+ if (RegOpenKeyExW(HKEY_CURRENT_USER, szSubKey, 0L,
KEY_READ, &hKey) != ERROR_SUCCESS) {
tkWinTheme = TK_THEME_WIN_XP;
} else {
- RegQueryValueEx(hKey, szCurrent, NULL, NULL, (LPBYTE) pBuffer, &dwSize);
+ RegQueryValueExW(hKey, szCurrent, NULL, NULL, (LPBYTE) pBuffer, &dwSize);
RegCloseKey(hKey);
if (strcmp(pBuffer, "Windows Standard") == 0) {
tkWinTheme = TK_THEME_WIN_CLASSIC;
diff --git a/win/ttkWinMonitor.c b/win/ttkWinMonitor.c
index 3060aa1..8bcfca2 100644
--- a/win/ttkWinMonitor.c
+++ b/win/ttkWinMonitor.c
@@ -70,26 +70,26 @@ static void RegisterSystemColors(Tcl_Interp *interp)
static HWND
CreateThemeMonitorWindow(HINSTANCE hinst, Tcl_Interp *interp)
{
- WNDCLASSEX wc;
+ WNDCLASSEXW wc;
HWND hwnd = NULL;
WCHAR title[32] = L"TtkMonitorWindow";
WCHAR name[32] = L"TtkMonitorClass";
- wc.cbSize = sizeof(WNDCLASSEX);
+ wc.cbSize = sizeof(WNDCLASSEXW);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = (WNDPROC)WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hinst;
- wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
- wc.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wc.hIcon = LoadIconW(NULL, (LPCWSTR)IDI_APPLICATION);
+ wc.hIconSm = LoadIconW(NULL, (LPCWSTR)IDI_APPLICATION);
+ wc.hCursor = LoadCursorW(NULL, (LPCWSTR)IDC_ARROW);
wc.hbrBackground = (HBRUSH)COLOR_WINDOW;
wc.lpszMenuName = name;
wc.lpszClassName = name;
- if (RegisterClassEx(&wc)) {
- hwnd = CreateWindow( name, title, WS_OVERLAPPEDWINDOW,
+ if (RegisterClassExW(&wc)) {
+ hwnd = CreateWindowW( name, title, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, hinst, NULL );
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR) interp);
diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c
index 1633f2e..c877c09 100644
--- a/win/ttkWinXPTheme.c
+++ b/win/ttkWinXPTheme.c
@@ -99,7 +99,7 @@ LoadXPThemeProcs(HINSTANCE *phlib)
* if we are running at least on Windows XP.
*/
HINSTANCE handle;
- *phlib = handle = LoadLibrary(L"uxtheme.dll");
+ *phlib = handle = LoadLibraryW(L"uxtheme.dll");
if (handle != 0)
{
/*