mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-06 07:37:09 +00:00
notepad: Use the explicit W-form of the functions.
This commit is contained in:
parent
f706c68cf9
commit
27c8839f66
|
@ -47,11 +47,11 @@ VOID ShowLastError(void)
|
||||||
LPWSTR lpMsgBuf;
|
LPWSTR lpMsgBuf;
|
||||||
WCHAR szTitle[MAX_STRING_LEN];
|
WCHAR szTitle[MAX_STRING_LEN];
|
||||||
|
|
||||||
LoadString(Globals.hInstance, STRING_ERROR, szTitle, SIZEOF(szTitle));
|
LoadStringW(Globals.hInstance, STRING_ERROR, szTitle, SIZEOF(szTitle));
|
||||||
FormatMessage(
|
FormatMessageW(
|
||||||
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
||||||
NULL, error, 0, (LPWSTR)&lpMsgBuf, 0, NULL);
|
NULL, error, 0, (LPWSTR)&lpMsgBuf, 0, NULL);
|
||||||
MessageBox(NULL, lpMsgBuf, szTitle, MB_OK | MB_ICONERROR);
|
MessageBoxW(NULL, lpMsgBuf, szTitle, MB_OK | MB_ICONERROR);
|
||||||
LocalFree(lpMsgBuf);
|
LocalFree(lpMsgBuf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,13 +70,13 @@ static void UpdateWindowCaption(void)
|
||||||
if (Globals.szFileTitle[0] != '\0')
|
if (Globals.szFileTitle[0] != '\0')
|
||||||
lstrcpyW(szCaption, Globals.szFileTitle);
|
lstrcpyW(szCaption, Globals.szFileTitle);
|
||||||
else
|
else
|
||||||
LoadString(Globals.hInstance, STRING_UNTITLED, szCaption, SIZEOF(szCaption));
|
LoadStringW(Globals.hInstance, STRING_UNTITLED, szCaption, SIZEOF(szCaption));
|
||||||
|
|
||||||
LoadString(Globals.hInstance, STRING_NOTEPAD, szNotepad, SIZEOF(szNotepad));
|
LoadStringW(Globals.hInstance, STRING_NOTEPAD, szNotepad, SIZEOF(szNotepad));
|
||||||
lstrcatW(szCaption, hyphenW);
|
lstrcatW(szCaption, hyphenW);
|
||||||
lstrcatW(szCaption, szNotepad);
|
lstrcatW(szCaption, szNotepad);
|
||||||
|
|
||||||
SetWindowText(Globals.hMainWnd, szCaption);
|
SetWindowTextW(Globals.hMainWnd, szCaption);
|
||||||
}
|
}
|
||||||
|
|
||||||
int DIALOG_StringMsgBox(HWND hParent, int formatId, LPCWSTR szString, DWORD dwFlags)
|
int DIALOG_StringMsgBox(HWND hParent, int formatId, LPCWSTR szString, DWORD dwFlags)
|
||||||
|
@ -85,19 +85,19 @@ int DIALOG_StringMsgBox(HWND hParent, int formatId, LPCWSTR szString, DWORD dwFl
|
||||||
WCHAR szResource[MAX_STRING_LEN];
|
WCHAR szResource[MAX_STRING_LEN];
|
||||||
|
|
||||||
/* Load and format szMessage */
|
/* Load and format szMessage */
|
||||||
LoadString(Globals.hInstance, formatId, szResource, SIZEOF(szResource));
|
LoadStringW(Globals.hInstance, formatId, szResource, SIZEOF(szResource));
|
||||||
wnsprintfW(szMessage, SIZEOF(szMessage), szResource, szString);
|
wnsprintfW(szMessage, SIZEOF(szMessage), szResource, szString);
|
||||||
|
|
||||||
/* Load szCaption */
|
/* Load szCaption */
|
||||||
if ((dwFlags & MB_ICONMASK) == MB_ICONEXCLAMATION)
|
if ((dwFlags & MB_ICONMASK) == MB_ICONEXCLAMATION)
|
||||||
LoadString(Globals.hInstance, STRING_ERROR, szResource, SIZEOF(szResource));
|
LoadStringW(Globals.hInstance, STRING_ERROR, szResource, SIZEOF(szResource));
|
||||||
else
|
else
|
||||||
LoadString(Globals.hInstance, STRING_NOTEPAD, szResource, SIZEOF(szResource));
|
LoadStringW(Globals.hInstance, STRING_NOTEPAD, szResource, SIZEOF(szResource));
|
||||||
|
|
||||||
/* Display Modal Dialog */
|
/* Display Modal Dialog */
|
||||||
if (hParent == NULL)
|
if (hParent == NULL)
|
||||||
hParent = Globals.hMainWnd;
|
hParent = Globals.hMainWnd;
|
||||||
return MessageBox(hParent, szMessage, szResource, dwFlags);
|
return MessageBoxW(hParent, szMessage, szResource, dwFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void AlertFileNotFound(LPCWSTR szFileName)
|
static void AlertFileNotFound(LPCWSTR szFileName)
|
||||||
|
@ -109,7 +109,7 @@ static int AlertFileNotSaved(LPCWSTR szFileName)
|
||||||
{
|
{
|
||||||
WCHAR szUntitled[MAX_STRING_LEN];
|
WCHAR szUntitled[MAX_STRING_LEN];
|
||||||
|
|
||||||
LoadString(Globals.hInstance, STRING_UNTITLED, szUntitled, SIZEOF(szUntitled));
|
LoadStringW(Globals.hInstance, STRING_UNTITLED, szUntitled, SIZEOF(szUntitled));
|
||||||
return DIALOG_StringMsgBox(NULL, STRING_NOTSAVED, szFileName[0] ? szFileName : szUntitled,
|
return DIALOG_StringMsgBox(NULL, STRING_NOTSAVED, szFileName[0] ? szFileName : szUntitled,
|
||||||
MB_ICONQUESTION|MB_YESNOCANCEL);
|
MB_ICONQUESTION|MB_YESNOCANCEL);
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ BOOL FileExists(LPCWSTR szFilename)
|
||||||
WIN32_FIND_DATAW entry;
|
WIN32_FIND_DATAW entry;
|
||||||
HANDLE hFile;
|
HANDLE hFile;
|
||||||
|
|
||||||
hFile = FindFirstFile(szFilename, &entry);
|
hFile = FindFirstFileW(szFilename, &entry);
|
||||||
FindClose(hFile);
|
FindClose(hFile);
|
||||||
|
|
||||||
return (hFile != INVALID_HANDLE_VALUE);
|
return (hFile != INVALID_HANDLE_VALUE);
|
||||||
|
@ -138,7 +138,7 @@ static VOID DoSaveFile(VOID)
|
||||||
LPSTR pTemp;
|
LPSTR pTemp;
|
||||||
DWORD size;
|
DWORD size;
|
||||||
|
|
||||||
hFile = CreateFile(Globals.szFileName, GENERIC_WRITE, FILE_SHARE_WRITE,
|
hFile = CreateFileW(Globals.szFileName, GENERIC_WRITE, FILE_SHARE_WRITE,
|
||||||
NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||||
if(hFile == INVALID_HANDLE_VALUE)
|
if(hFile == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
|
@ -211,8 +211,8 @@ void DoOpenFile(LPCWSTR szFileName)
|
||||||
if (!DoCloseFile())
|
if (!DoCloseFile())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
hFile = CreateFile(szFileName, GENERIC_READ, FILE_SHARE_READ, NULL,
|
hFile = CreateFileW(szFileName, GENERIC_READ, FILE_SHARE_READ, NULL,
|
||||||
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||||
if(hFile == INVALID_HANDLE_VALUE)
|
if(hFile == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
AlertFileNotFound(szFileName);
|
AlertFileNotFound(szFileName);
|
||||||
|
@ -262,7 +262,7 @@ void DoOpenFile(LPCWSTR szFileName)
|
||||||
if (GetWindowTextW(Globals.hEdit, log, sizeof(log)/sizeof(log[0])) && !lstrcmpW(log, dotlog))
|
if (GetWindowTextW(Globals.hEdit, log, sizeof(log)/sizeof(log[0])) && !lstrcmpW(log, dotlog))
|
||||||
{
|
{
|
||||||
static const WCHAR lfW[] = { '\r','\n',0 };
|
static const WCHAR lfW[] = { '\r','\n',0 };
|
||||||
SendMessageW(Globals.hEdit, EM_SETSEL, GetWindowTextLength(Globals.hEdit), -1);
|
SendMessageW(Globals.hEdit, EM_SETSEL, GetWindowTextLengthW(Globals.hEdit), -1);
|
||||||
SendMessageW(Globals.hEdit, EM_REPLACESEL, TRUE, (LPARAM)lfW);
|
SendMessageW(Globals.hEdit, EM_REPLACESEL, TRUE, (LPARAM)lfW);
|
||||||
DIALOG_EditTimeDate();
|
DIALOG_EditTimeDate();
|
||||||
SendMessageW(Globals.hEdit, EM_REPLACESEL, TRUE, (LPARAM)lfW);
|
SendMessageW(Globals.hEdit, EM_REPLACESEL, TRUE, (LPARAM)lfW);
|
||||||
|
@ -278,7 +278,7 @@ VOID DIALOG_FileNew(VOID)
|
||||||
|
|
||||||
/* Close any files and prompt to save changes */
|
/* Close any files and prompt to save changes */
|
||||||
if (DoCloseFile()) {
|
if (DoCloseFile()) {
|
||||||
SetWindowText(Globals.hEdit, empty_strW);
|
SetWindowTextW(Globals.hEdit, empty_strW);
|
||||||
SendMessageW(Globals.hEdit, EM_EMPTYUNDOBUFFER, 0, 0);
|
SendMessageW(Globals.hEdit, EM_EMPTYUNDOBUFFER, 0, 0);
|
||||||
SetFocus(Globals.hEdit);
|
SetFocus(Globals.hEdit);
|
||||||
}
|
}
|
||||||
|
@ -294,7 +294,7 @@ VOID DIALOG_FileOpen(VOID)
|
||||||
|
|
||||||
ZeroMemory(&openfilename, sizeof(openfilename));
|
ZeroMemory(&openfilename, sizeof(openfilename));
|
||||||
|
|
||||||
GetCurrentDirectory(SIZEOF(szDir), szDir);
|
GetCurrentDirectoryW(SIZEOF(szDir), szDir);
|
||||||
lstrcpyW(szPath, txt_files);
|
lstrcpyW(szPath, txt_files);
|
||||||
|
|
||||||
openfilename.lStructSize = sizeof(openfilename);
|
openfilename.lStructSize = sizeof(openfilename);
|
||||||
|
@ -309,7 +309,7 @@ VOID DIALOG_FileOpen(VOID)
|
||||||
openfilename.lpstrDefExt = szDefaultExt;
|
openfilename.lpstrDefExt = szDefaultExt;
|
||||||
|
|
||||||
|
|
||||||
if (GetOpenFileName(&openfilename))
|
if (GetOpenFileNameW(&openfilename))
|
||||||
DoOpenFile(openfilename.lpstrFile);
|
DoOpenFile(openfilename.lpstrFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,7 +333,7 @@ BOOL DIALOG_FileSaveAs(VOID)
|
||||||
|
|
||||||
ZeroMemory(&saveas, sizeof(saveas));
|
ZeroMemory(&saveas, sizeof(saveas));
|
||||||
|
|
||||||
GetCurrentDirectory(SIZEOF(szDir), szDir);
|
GetCurrentDirectoryW(SIZEOF(szDir), szDir);
|
||||||
lstrcpyW(szPath, txt_files);
|
lstrcpyW(szPath, txt_files);
|
||||||
|
|
||||||
saveas.lStructSize = sizeof(OPENFILENAMEW);
|
saveas.lStructSize = sizeof(OPENFILENAMEW);
|
||||||
|
@ -347,7 +347,7 @@ BOOL DIALOG_FileSaveAs(VOID)
|
||||||
OFN_HIDEREADONLY | OFN_ENABLESIZING;
|
OFN_HIDEREADONLY | OFN_ENABLESIZING;
|
||||||
saveas.lpstrDefExt = szDefaultExt;
|
saveas.lpstrDefExt = szDefaultExt;
|
||||||
|
|
||||||
if (GetSaveFileName(&saveas)) {
|
if (GetSaveFileNameW(&saveas)) {
|
||||||
SetFileName(szPath);
|
SetFileName(szPath);
|
||||||
UpdateWindowCaption();
|
UpdateWindowCaption();
|
||||||
DoSaveFile();
|
DoSaveFile();
|
||||||
|
@ -372,9 +372,9 @@ static int notepad_print_header(HDC hdc, RECT *rc, BOOL dopage, BOOL header, int
|
||||||
/* Write the header or footer */
|
/* Write the header or footer */
|
||||||
GetTextExtentPoint32W(hdc, text, lstrlenW(text), &szMetric);
|
GetTextExtentPoint32W(hdc, text, lstrlenW(text), &szMetric);
|
||||||
if (dopage)
|
if (dopage)
|
||||||
ExtTextOut(hdc, (rc->left + rc->right - szMetric.cx) / 2,
|
ExtTextOutW(hdc, (rc->left + rc->right - szMetric.cx) / 2,
|
||||||
header ? rc->top : rc->bottom - szMetric.cy,
|
header ? rc->top : rc->bottom - szMetric.cy,
|
||||||
ETO_CLIPPED, rc, text, lstrlenW(text), NULL);
|
ETO_CLIPPED, rc, text, lstrlenW(text), NULL);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -392,12 +392,12 @@ static BOOL notepad_print_page(HDC hdc, RECT *rc, BOOL dopage, int page, LPTEXTI
|
||||||
{
|
{
|
||||||
static const WCHAR failedW[] = { 'S','t','a','r','t','P','a','g','e',' ','f','a','i','l','e','d',0 };
|
static const WCHAR failedW[] = { 'S','t','a','r','t','P','a','g','e',' ','f','a','i','l','e','d',0 };
|
||||||
static const WCHAR errorW[] = { 'P','r','i','n','t',' ','E','r','r','o','r',0 };
|
static const WCHAR errorW[] = { 'P','r','i','n','t',' ','E','r','r','o','r',0 };
|
||||||
MessageBox(Globals.hMainWnd, failedW, errorW, MB_ICONEXCLAMATION);
|
MessageBoxW(Globals.hMainWnd, failedW, errorW, MB_ICONEXCLAMATION);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GetTextMetrics(hdc, &tm);
|
GetTextMetricsW(hdc, &tm);
|
||||||
y = rc->top + notepad_print_header(hdc, rc, dopage, TRUE, page, Globals.szFileName) * tm.tmHeight;
|
y = rc->top + notepad_print_header(hdc, rc, dopage, TRUE, page, Globals.szFileName) * tm.tmHeight;
|
||||||
b = rc->bottom - 2 * notepad_print_header(hdc, rc, FALSE, FALSE, page, Globals.szFooter) * tm.tmHeight;
|
b = rc->bottom - 2 * notepad_print_header(hdc, rc, FALSE, FALSE, page, Globals.szFooter) * tm.tmHeight;
|
||||||
|
|
||||||
|
@ -433,7 +433,7 @@ static BOOL notepad_print_page(HDC hdc, RECT *rc, BOOL dopage, int page, LPTEXTI
|
||||||
/* Find out how much we should print if line wrapping is enabled */
|
/* Find out how much we should print if line wrapping is enabled */
|
||||||
if (Globals.bWrapLongLines)
|
if (Globals.bWrapLongLines)
|
||||||
{
|
{
|
||||||
GetTextExtentExPoint(hdc, tInfo->lptr, tInfo->len, rc->right - rc->left, &n, NULL, &szMetrics);
|
GetTextExtentExPointW(hdc, tInfo->lptr, tInfo->len, rc->right - rc->left, &n, NULL, &szMetrics);
|
||||||
if (n < tInfo->len && tInfo->lptr[n] != ' ')
|
if (n < tInfo->len && tInfo->lptr[n] != ' ')
|
||||||
{
|
{
|
||||||
m = n;
|
m = n;
|
||||||
|
@ -446,7 +446,7 @@ static BOOL notepad_print_page(HDC hdc, RECT *rc, BOOL dopage, int page, LPTEXTI
|
||||||
n = tInfo->len;
|
n = tInfo->len;
|
||||||
|
|
||||||
if (dopage)
|
if (dopage)
|
||||||
ExtTextOut(hdc, rc->left, y, ETO_CLIPPED, rc, tInfo->lptr, n, NULL);
|
ExtTextOutW(hdc, rc->left, y, ETO_CLIPPED, rc, tInfo->lptr, n, NULL);
|
||||||
|
|
||||||
tInfo->len -= n;
|
tInfo->len -= n;
|
||||||
|
|
||||||
|
@ -507,7 +507,7 @@ VOID DIALOG_FilePrint(VOID)
|
||||||
/* Let commdlg manage copy settings */
|
/* Let commdlg manage copy settings */
|
||||||
printer.nCopies = (WORD)PD_USEDEVMODECOPIES;
|
printer.nCopies = (WORD)PD_USEDEVMODECOPIES;
|
||||||
|
|
||||||
if (!PrintDlg(&printer)) return;
|
if (!PrintDlgW(&printer)) return;
|
||||||
|
|
||||||
Globals.hDevMode = printer.hDevMode;
|
Globals.hDevMode = printer.hDevMode;
|
||||||
Globals.hDevNames = printer.hDevNames;
|
Globals.hDevNames = printer.hDevNames;
|
||||||
|
@ -522,7 +522,7 @@ VOID DIALOG_FilePrint(VOID)
|
||||||
di.fwType = 0;
|
di.fwType = 0;
|
||||||
|
|
||||||
/* Get the file text */
|
/* Get the file text */
|
||||||
size = GetWindowTextLength(Globals.hEdit) + 1;
|
size = GetWindowTextLengthW(Globals.hEdit) + 1;
|
||||||
pTemp = HeapAlloc(GetProcessHeap(), 0, size * sizeof(WCHAR));
|
pTemp = HeapAlloc(GetProcessHeap(), 0, size * sizeof(WCHAR));
|
||||||
if (!pTemp)
|
if (!pTemp)
|
||||||
{
|
{
|
||||||
|
@ -530,9 +530,9 @@ VOID DIALOG_FilePrint(VOID)
|
||||||
ShowLastError();
|
ShowLastError();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
size = GetWindowText(Globals.hEdit, pTemp, size);
|
size = GetWindowTextW(Globals.hEdit, pTemp, size);
|
||||||
|
|
||||||
if (StartDoc(printer.hDC, &di) > 0)
|
if (StartDocW(printer.hDC, &di) > 0)
|
||||||
{
|
{
|
||||||
/* Get the page margins in pixels. */
|
/* Get the page margins in pixels. */
|
||||||
rc.top = MulDiv(Globals.iMarginTop, GetDeviceCaps(printer.hDC, LOGPIXELSY), 2540) -
|
rc.top = MulDiv(Globals.iMarginTop, GetDeviceCaps(printer.hDC, LOGPIXELSY), 2540) -
|
||||||
|
@ -549,7 +549,7 @@ VOID DIALOG_FilePrint(VOID)
|
||||||
lfFont.lfHeight = MulDiv(lfFont.lfHeight, GetDeviceCaps(printer.hDC, LOGPIXELSY), get_dpi());
|
lfFont.lfHeight = MulDiv(lfFont.lfHeight, GetDeviceCaps(printer.hDC, LOGPIXELSY), get_dpi());
|
||||||
/* Make the font a bit lighter */
|
/* Make the font a bit lighter */
|
||||||
lfFont.lfWeight -= 100;
|
lfFont.lfWeight -= 100;
|
||||||
hTextFont = CreateFontIndirect(&lfFont);
|
hTextFont = CreateFontIndirectW(&lfFont);
|
||||||
old_font = SelectObject(printer.hDC, hTextFont);
|
old_font = SelectObject(printer.hDC, hTextFont);
|
||||||
|
|
||||||
for (copy = 1; copy <= printer.nCopies; copy++)
|
for (copy = 1; copy <= printer.nCopies; copy++)
|
||||||
|
@ -604,7 +604,7 @@ VOID DIALOG_FilePrinterSetup(VOID)
|
||||||
printer.Flags = PD_PRINTSETUP;
|
printer.Flags = PD_PRINTSETUP;
|
||||||
printer.nCopies = 1;
|
printer.nCopies = 1;
|
||||||
|
|
||||||
PrintDlg(&printer);
|
PrintDlgW(&printer);
|
||||||
|
|
||||||
Globals.hDevMode = printer.hDevMode;
|
Globals.hDevMode = printer.hDevMode;
|
||||||
Globals.hDevNames = printer.hDevNames;
|
Globals.hDevNames = printer.hDevNames;
|
||||||
|
@ -612,7 +612,7 @@ VOID DIALOG_FilePrinterSetup(VOID)
|
||||||
|
|
||||||
VOID DIALOG_FileExit(VOID)
|
VOID DIALOG_FileExit(VOID)
|
||||||
{
|
{
|
||||||
PostMessage(Globals.hMainWnd, WM_CLOSE, 0, 0l);
|
PostMessageW(Globals.hMainWnd, WM_CLOSE, 0, 0l);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID DIALOG_EditUndo(VOID)
|
VOID DIALOG_EditUndo(VOID)
|
||||||
|
@ -653,12 +653,12 @@ VOID DIALOG_EditTimeDate(VOID)
|
||||||
|
|
||||||
GetLocalTime(&st);
|
GetLocalTime(&st);
|
||||||
|
|
||||||
GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &st, NULL, szDate, MAX_STRING_LEN);
|
GetTimeFormatW(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &st, NULL, szDate, MAX_STRING_LEN);
|
||||||
SendMessageW(Globals.hEdit, EM_REPLACESEL, TRUE, (LPARAM)szDate);
|
SendMessageW(Globals.hEdit, EM_REPLACESEL, TRUE, (LPARAM)szDate);
|
||||||
|
|
||||||
SendMessageW(Globals.hEdit, EM_REPLACESEL, TRUE, (LPARAM)spaceW);
|
SendMessageW(Globals.hEdit, EM_REPLACESEL, TRUE, (LPARAM)spaceW);
|
||||||
|
|
||||||
GetDateFormat(LOCALE_USER_DEFAULT, 0, &st, NULL, szDate, MAX_STRING_LEN);
|
GetDateFormatW(LOCALE_USER_DEFAULT, 0, &st, NULL, szDate, MAX_STRING_LEN);
|
||||||
SendMessageW(Globals.hEdit, EM_REPLACESEL, TRUE, (LPARAM)szDate);
|
SendMessageW(Globals.hEdit, EM_REPLACESEL, TRUE, (LPARAM)szDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -672,19 +672,19 @@ VOID DIALOG_EditWrap(VOID)
|
||||||
DWORD size;
|
DWORD size;
|
||||||
LPWSTR pTemp;
|
LPWSTR pTemp;
|
||||||
|
|
||||||
size = GetWindowTextLength(Globals.hEdit) + 1;
|
size = GetWindowTextLengthW(Globals.hEdit) + 1;
|
||||||
pTemp = HeapAlloc(GetProcessHeap(), 0, size * sizeof(WCHAR));
|
pTemp = HeapAlloc(GetProcessHeap(), 0, size * sizeof(WCHAR));
|
||||||
if (!pTemp)
|
if (!pTemp)
|
||||||
{
|
{
|
||||||
ShowLastError();
|
ShowLastError();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GetWindowText(Globals.hEdit, pTemp, size);
|
GetWindowTextW(Globals.hEdit, pTemp, size);
|
||||||
modify = SendMessageW(Globals.hEdit, EM_GETMODIFY, 0, 0);
|
modify = SendMessageW(Globals.hEdit, EM_GETMODIFY, 0, 0);
|
||||||
DestroyWindow(Globals.hEdit);
|
DestroyWindow(Globals.hEdit);
|
||||||
GetClientRect(Globals.hMainWnd, &rc);
|
GetClientRect(Globals.hMainWnd, &rc);
|
||||||
if( Globals.bWrapLongLines ) dwStyle |= WS_HSCROLL | ES_AUTOHSCROLL;
|
if( Globals.bWrapLongLines ) dwStyle |= WS_HSCROLL | ES_AUTOHSCROLL;
|
||||||
Globals.hEdit = CreateWindowEx(WS_EX_CLIENTEDGE, editW, NULL, dwStyle,
|
Globals.hEdit = CreateWindowExW(WS_EX_CLIENTEDGE, editW, NULL, dwStyle,
|
||||||
0, 0, rc.right, rc.bottom, Globals.hMainWnd,
|
0, 0, rc.right, rc.bottom, Globals.hMainWnd,
|
||||||
NULL, Globals.hInstance, NULL);
|
NULL, Globals.hInstance, NULL);
|
||||||
SendMessageW(Globals.hEdit, WM_SETFONT, (WPARAM)Globals.hFont, FALSE);
|
SendMessageW(Globals.hEdit, WM_SETFONT, (WPARAM)Globals.hFont, FALSE);
|
||||||
|
@ -709,11 +709,11 @@ VOID DIALOG_SelectFont(VOID)
|
||||||
cf.lpLogFont=&lf;
|
cf.lpLogFont=&lf;
|
||||||
cf.Flags=CF_SCREENFONTS | CF_INITTOLOGFONTSTRUCT;
|
cf.Flags=CF_SCREENFONTS | CF_INITTOLOGFONTSTRUCT;
|
||||||
|
|
||||||
if( ChooseFont(&cf) )
|
if( ChooseFontW(&cf) )
|
||||||
{
|
{
|
||||||
HFONT currfont=Globals.hFont;
|
HFONT currfont=Globals.hFont;
|
||||||
|
|
||||||
Globals.hFont=CreateFontIndirect( &lf );
|
Globals.hFont=CreateFontIndirectW( &lf );
|
||||||
Globals.lfFont=lf;
|
Globals.lfFont=lf;
|
||||||
SendMessageW( Globals.hEdit, WM_SETFONT, (WPARAM)Globals.hFont, TRUE );
|
SendMessageW( Globals.hEdit, WM_SETFONT, (WPARAM)Globals.hFont, TRUE );
|
||||||
if( currfont!=NULL )
|
if( currfont!=NULL )
|
||||||
|
@ -741,7 +741,7 @@ VOID DIALOG_Search(VOID)
|
||||||
/* We only need to create the modal FindReplace dialog which will */
|
/* We only need to create the modal FindReplace dialog which will */
|
||||||
/* notify us of incoming events using hMainWnd Window Messages */
|
/* notify us of incoming events using hMainWnd Window Messages */
|
||||||
|
|
||||||
Globals.hFindReplaceDlg = FindText(&Globals.find);
|
Globals.hFindReplaceDlg = FindTextW(&Globals.find);
|
||||||
assert(Globals.hFindReplaceDlg !=0);
|
assert(Globals.hFindReplaceDlg !=0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -775,13 +775,13 @@ VOID DIALOG_Replace(VOID)
|
||||||
/* We only need to create the modal FindReplace dialog which will */
|
/* We only need to create the modal FindReplace dialog which will */
|
||||||
/* notify us of incoming events using hMainWnd Window Messages */
|
/* notify us of incoming events using hMainWnd Window Messages */
|
||||||
|
|
||||||
Globals.hFindReplaceDlg = ReplaceText(&Globals.find);
|
Globals.hFindReplaceDlg = ReplaceTextW(&Globals.find);
|
||||||
assert(Globals.hFindReplaceDlg !=0);
|
assert(Globals.hFindReplaceDlg !=0);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID DIALOG_HelpContents(VOID)
|
VOID DIALOG_HelpContents(VOID)
|
||||||
{
|
{
|
||||||
WinHelp(Globals.hMainWnd, helpfileW, HELP_INDEX, 0);
|
WinHelpW(Globals.hMainWnd, helpfileW, HELP_INDEX, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID DIALOG_HelpSearch(VOID)
|
VOID DIALOG_HelpSearch(VOID)
|
||||||
|
@ -791,7 +791,7 @@ VOID DIALOG_HelpSearch(VOID)
|
||||||
|
|
||||||
VOID DIALOG_HelpHelp(VOID)
|
VOID DIALOG_HelpHelp(VOID)
|
||||||
{
|
{
|
||||||
WinHelp(Globals.hMainWnd, helpfileW, HELP_HELPONHELP, 0);
|
WinHelpW(Globals.hMainWnd, helpfileW, HELP_HELPONHELP, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID DIALOG_HelpAboutNotepad(VOID)
|
VOID DIALOG_HelpAboutNotepad(VOID)
|
||||||
|
@ -801,8 +801,8 @@ VOID DIALOG_HelpAboutNotepad(VOID)
|
||||||
HICON icon = LoadImageW(Globals.hInstance, MAKEINTRESOURCEW(IDI_NOTEPAD),
|
HICON icon = LoadImageW(Globals.hInstance, MAKEINTRESOURCEW(IDI_NOTEPAD),
|
||||||
IMAGE_ICON, 48, 48, LR_SHARED);
|
IMAGE_ICON, 48, 48, LR_SHARED);
|
||||||
|
|
||||||
LoadString(Globals.hInstance, STRING_NOTEPAD, szNotepad, SIZEOF(szNotepad));
|
LoadStringW(Globals.hInstance, STRING_NOTEPAD, szNotepad, SIZEOF(szNotepad));
|
||||||
ShellAbout(Globals.hMainWnd, szNotepad, notepadW, icon);
|
ShellAboutW(Globals.hMainWnd, szNotepad, notepadW, icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -832,8 +832,8 @@ static INT_PTR WINAPI DIALOG_PAGESETUP_DlgProc(HWND hDlg, UINT msg, WPARAM wPara
|
||||||
{
|
{
|
||||||
case IDOK:
|
case IDOK:
|
||||||
/* save user input and close dialog */
|
/* save user input and close dialog */
|
||||||
GetDlgItemText(hDlg, IDC_PAGESETUP_HEADERVALUE, Globals.szHeader, SIZEOF(Globals.szHeader));
|
GetDlgItemTextW(hDlg, IDC_PAGESETUP_HEADERVALUE, Globals.szHeader, SIZEOF(Globals.szHeader));
|
||||||
GetDlgItemText(hDlg, IDC_PAGESETUP_FOOTERVALUE, Globals.szFooter, SIZEOF(Globals.szFooter));
|
GetDlgItemTextW(hDlg, IDC_PAGESETUP_FOOTERVALUE, Globals.szFooter, SIZEOF(Globals.szFooter));
|
||||||
|
|
||||||
Globals.iMarginTop = GetDlgItemInt(hDlg, IDC_PAGESETUP_TOPVALUE, NULL, FALSE) * 100;
|
Globals.iMarginTop = GetDlgItemInt(hDlg, IDC_PAGESETUP_TOPVALUE, NULL, FALSE) * 100;
|
||||||
Globals.iMarginBottom = GetDlgItemInt(hDlg, IDC_PAGESETUP_BOTTOMVALUE, NULL, FALSE) * 100;
|
Globals.iMarginBottom = GetDlgItemInt(hDlg, IDC_PAGESETUP_BOTTOMVALUE, NULL, FALSE) * 100;
|
||||||
|
@ -852,7 +852,7 @@ static INT_PTR WINAPI DIALOG_PAGESETUP_DlgProc(HWND hDlg, UINT msg, WPARAM wPara
|
||||||
/* FIXME: Bring this to work */
|
/* FIXME: Bring this to work */
|
||||||
static const WCHAR sorryW[] = { 'S','o','r','r','y',',',' ','n','o',' ','h','e','l','p',' ','a','v','a','i','l','a','b','l','e',0 };
|
static const WCHAR sorryW[] = { 'S','o','r','r','y',',',' ','n','o',' ','h','e','l','p',' ','a','v','a','i','l','a','b','l','e',0 };
|
||||||
static const WCHAR helpW[] = { 'H','e','l','p',0 };
|
static const WCHAR helpW[] = { 'H','e','l','p',0 };
|
||||||
MessageBox(Globals.hMainWnd, sorryW, helpW, MB_ICONEXCLAMATION);
|
MessageBoxW(Globals.hMainWnd, sorryW, helpW, MB_ICONEXCLAMATION);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -863,8 +863,8 @@ static INT_PTR WINAPI DIALOG_PAGESETUP_DlgProc(HWND hDlg, UINT msg, WPARAM wPara
|
||||||
|
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
/* fetch last user input prior to display dialog */
|
/* fetch last user input prior to display dialog */
|
||||||
SetDlgItemText(hDlg, IDC_PAGESETUP_HEADERVALUE, Globals.szHeader);
|
SetDlgItemTextW(hDlg, IDC_PAGESETUP_HEADERVALUE, Globals.szHeader);
|
||||||
SetDlgItemText(hDlg, IDC_PAGESETUP_FOOTERVALUE, Globals.szFooter);
|
SetDlgItemTextW(hDlg, IDC_PAGESETUP_FOOTERVALUE, Globals.szFooter);
|
||||||
SetDlgItemInt(hDlg, IDC_PAGESETUP_TOPVALUE, Globals.iMarginTop / 100, FALSE);
|
SetDlgItemInt(hDlg, IDC_PAGESETUP_TOPVALUE, Globals.iMarginTop / 100, FALSE);
|
||||||
SetDlgItemInt(hDlg, IDC_PAGESETUP_BOTTOMVALUE, Globals.iMarginBottom / 100, FALSE);
|
SetDlgItemInt(hDlg, IDC_PAGESETUP_BOTTOMVALUE, Globals.iMarginBottom / 100, FALSE);
|
||||||
SetDlgItemInt(hDlg, IDC_PAGESETUP_LEFTVALUE, Globals.iMarginLeft / 100, FALSE);
|
SetDlgItemInt(hDlg, IDC_PAGESETUP_LEFTVALUE, Globals.iMarginLeft / 100, FALSE);
|
||||||
|
|
|
@ -74,7 +74,7 @@ VOID SetFileName(LPCWSTR szFileName)
|
||||||
{
|
{
|
||||||
lstrcpyW(Globals.szFileName, szFileName);
|
lstrcpyW(Globals.szFileName, szFileName);
|
||||||
Globals.szFileTitle[0] = 0;
|
Globals.szFileTitle[0] = 0;
|
||||||
GetFileTitle(szFileName, Globals.szFileTitle, sizeof(Globals.szFileTitle));
|
GetFileTitleW(szFileName, Globals.szFileTitle, sizeof(Globals.szFileTitle));
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
|
@ -205,10 +205,10 @@ static VOID NOTEPAD_LoadSettingFromRegistry(void)
|
||||||
Globals.lfFont.lfPitchAndFamily = FIXED_PITCH | FF_DONTCARE;
|
Globals.lfFont.lfPitchAndFamily = FIXED_PITCH | FF_DONTCARE;
|
||||||
lstrcpyW(Globals.lfFont.lfFaceName, systemW);
|
lstrcpyW(Globals.lfFont.lfFaceName, systemW);
|
||||||
|
|
||||||
LoadString(Globals.hInstance, STRING_PAGESETUP_HEADERVALUE, Globals.szHeader,
|
LoadStringW(Globals.hInstance, STRING_PAGESETUP_HEADERVALUE, Globals.szHeader,
|
||||||
sizeof(Globals.szHeader) / sizeof(Globals.szHeader[0]));
|
sizeof(Globals.szHeader) / sizeof(Globals.szHeader[0]));
|
||||||
LoadString(Globals.hInstance, STRING_PAGESETUP_FOOTERVALUE, Globals.szFooter,
|
LoadStringW(Globals.hInstance, STRING_PAGESETUP_FOOTERVALUE, Globals.szFooter,
|
||||||
sizeof(Globals.szFooter) / sizeof(Globals.szFooter[0]));
|
sizeof(Globals.szFooter) / sizeof(Globals.szFooter[0]));
|
||||||
|
|
||||||
if(RegOpenKeyW(HKEY_CURRENT_USER, notepad_reg_key, &hkey) == ERROR_SUCCESS)
|
if(RegOpenKeyW(HKEY_CURRENT_USER, notepad_reg_key, &hkey) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
|
@ -319,11 +319,11 @@ static VOID NOTEPAD_InitData(VOID)
|
||||||
static const WCHAR txt_files[] = { '*','.','t','x','t',0 };
|
static const WCHAR txt_files[] = { '*','.','t','x','t',0 };
|
||||||
static const WCHAR all_files[] = { '*','.','*',0 };
|
static const WCHAR all_files[] = { '*','.','*',0 };
|
||||||
|
|
||||||
LoadString(Globals.hInstance, STRING_TEXT_FILES_TXT, p, MAX_STRING_LEN);
|
LoadStringW(Globals.hInstance, STRING_TEXT_FILES_TXT, p, MAX_STRING_LEN);
|
||||||
p += lstrlenW(p) + 1;
|
p += lstrlenW(p) + 1;
|
||||||
lstrcpyW(p, txt_files);
|
lstrcpyW(p, txt_files);
|
||||||
p += lstrlenW(p) + 1;
|
p += lstrlenW(p) + 1;
|
||||||
LoadString(Globals.hInstance, STRING_ALL_FILES, p, MAX_STRING_LEN);
|
LoadStringW(Globals.hInstance, STRING_ALL_FILES, p, MAX_STRING_LEN);
|
||||||
p += lstrlenW(p) + 1;
|
p += lstrlenW(p) + 1;
|
||||||
lstrcpyW(p, all_files);
|
lstrcpyW(p, all_files);
|
||||||
p += lstrlenW(p) + 1;
|
p += lstrlenW(p) + 1;
|
||||||
|
@ -353,7 +353,7 @@ static VOID NOTEPAD_InitMenuPopup(HMENU menu, int index)
|
||||||
EnableMenuItem(menu, CMD_DELETE, enable);
|
EnableMenuItem(menu, CMD_DELETE, enable);
|
||||||
|
|
||||||
EnableMenuItem(menu, CMD_SELECT_ALL,
|
EnableMenuItem(menu, CMD_SELECT_ALL,
|
||||||
GetWindowTextLength(Globals.hEdit) ? MF_ENABLED : MF_GRAYED);
|
GetWindowTextLengthW(Globals.hEdit) ? MF_ENABLED : MF_GRAYED);
|
||||||
}
|
}
|
||||||
|
|
||||||
static LPWSTR NOTEPAD_StrRStr(LPWSTR pszSource, LPWSTR pszLast, LPWSTR pszSrch)
|
static LPWSTR NOTEPAD_StrRStr(LPWSTR pszSource, LPWSTR pszLast, LPWSTR pszSrch)
|
||||||
|
@ -380,10 +380,10 @@ void NOTEPAD_DoFind(FINDREPLACEW *fr)
|
||||||
int fileLen;
|
int fileLen;
|
||||||
DWORD pos;
|
DWORD pos;
|
||||||
|
|
||||||
fileLen = GetWindowTextLength(Globals.hEdit) + 1;
|
fileLen = GetWindowTextLengthW(Globals.hEdit) + 1;
|
||||||
content = HeapAlloc(GetProcessHeap(), 0, fileLen * sizeof(WCHAR));
|
content = HeapAlloc(GetProcessHeap(), 0, fileLen * sizeof(WCHAR));
|
||||||
if (!content) return;
|
if (!content) return;
|
||||||
GetWindowText(Globals.hEdit, content, fileLen);
|
GetWindowTextW(Globals.hEdit, content, fileLen);
|
||||||
|
|
||||||
SendMessageW(Globals.hEdit, EM_GETSEL, 0, (LPARAM)&pos);
|
SendMessageW(Globals.hEdit, EM_GETSEL, 0, (LPARAM)&pos);
|
||||||
switch (fr->Flags & (FR_DOWN|FR_MATCHCASE))
|
switch (fr->Flags & (FR_DOWN|FR_MATCHCASE))
|
||||||
|
@ -423,10 +423,10 @@ static void NOTEPAD_DoReplace(FINDREPLACEW *fr)
|
||||||
DWORD pos;
|
DWORD pos;
|
||||||
DWORD pos_start;
|
DWORD pos_start;
|
||||||
|
|
||||||
fileLen = GetWindowTextLength(Globals.hEdit) + 1;
|
fileLen = GetWindowTextLengthW(Globals.hEdit) + 1;
|
||||||
content = HeapAlloc(GetProcessHeap(), 0, fileLen * sizeof(WCHAR));
|
content = HeapAlloc(GetProcessHeap(), 0, fileLen * sizeof(WCHAR));
|
||||||
if (!content) return;
|
if (!content) return;
|
||||||
GetWindowText(Globals.hEdit, content, fileLen);
|
GetWindowTextW(Globals.hEdit, content, fileLen);
|
||||||
|
|
||||||
SendMessageW(Globals.hEdit, EM_GETSEL, (WPARAM)&pos_start, (LPARAM)&pos);
|
SendMessageW(Globals.hEdit, EM_GETSEL, (WPARAM)&pos_start, (LPARAM)&pos);
|
||||||
switch (fr->Flags & (FR_DOWN|FR_MATCHCASE))
|
switch (fr->Flags & (FR_DOWN|FR_MATCHCASE))
|
||||||
|
@ -457,10 +457,10 @@ static void NOTEPAD_DoReplaceAll(FINDREPLACEW *fr)
|
||||||
|
|
||||||
SendMessageW(Globals.hEdit, EM_SETSEL, 0, 0);
|
SendMessageW(Globals.hEdit, EM_SETSEL, 0, 0);
|
||||||
while(TRUE){
|
while(TRUE){
|
||||||
fileLen = GetWindowTextLength(Globals.hEdit) + 1;
|
fileLen = GetWindowTextLengthW(Globals.hEdit) + 1;
|
||||||
content = HeapAlloc(GetProcessHeap(), 0, fileLen * sizeof(WCHAR));
|
content = HeapAlloc(GetProcessHeap(), 0, fileLen * sizeof(WCHAR));
|
||||||
if (!content) return;
|
if (!content) return;
|
||||||
GetWindowText(Globals.hEdit, content, fileLen);
|
GetWindowTextW(Globals.hEdit, content, fileLen);
|
||||||
|
|
||||||
SendMessageW(Globals.hEdit, EM_GETSEL, 0, (LPARAM)&pos);
|
SendMessageW(Globals.hEdit, EM_GETSEL, 0, (LPARAM)&pos);
|
||||||
switch (fr->Flags & (FR_DOWN|FR_MATCHCASE))
|
switch (fr->Flags & (FR_DOWN|FR_MATCHCASE))
|
||||||
|
@ -529,12 +529,11 @@ static LRESULT WINAPI NOTEPAD_WndProc(HWND hWnd, UINT msg, WPARAM wParam,
|
||||||
|
|
||||||
if (!Globals.bWrapLongLines) dwStyle |= WS_HSCROLL | ES_AUTOHSCROLL;
|
if (!Globals.bWrapLongLines) dwStyle |= WS_HSCROLL | ES_AUTOHSCROLL;
|
||||||
|
|
||||||
Globals.hEdit = CreateWindowEx(WS_EX_CLIENTEDGE, editW, NULL,
|
Globals.hEdit = CreateWindowExW(WS_EX_CLIENTEDGE, editW, NULL,
|
||||||
dwStyle,
|
dwStyle, 0, 0, rc.right, rc.bottom, hWnd,
|
||||||
0, 0, rc.right, rc.bottom, hWnd,
|
|
||||||
NULL, Globals.hInstance, NULL);
|
NULL, Globals.hInstance, NULL);
|
||||||
|
|
||||||
Globals.hFont = CreateFontIndirect(&Globals.lfFont);
|
Globals.hFont = CreateFontIndirectW(&Globals.lfFont);
|
||||||
SendMessageW(Globals.hEdit, WM_SETFONT, (WPARAM)Globals.hFont, FALSE);
|
SendMessageW(Globals.hEdit, WM_SETFONT, (WPARAM)Globals.hFont, FALSE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -544,7 +543,7 @@ static LRESULT WINAPI NOTEPAD_WndProc(HWND hWnd, UINT msg, WPARAM wParam,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_DESTROYCLIPBOARD:
|
case WM_DESTROYCLIPBOARD:
|
||||||
/*MessageBox(Globals.hMainWnd, "Empty clipboard", "Debug", MB_ICONEXCLAMATION);*/
|
/*MessageBoxW(Globals.hMainWnd, "Empty clipboard", "Debug", MB_ICONEXCLAMATION);*/
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
|
@ -579,7 +578,7 @@ static LRESULT WINAPI NOTEPAD_WndProc(HWND hWnd, UINT msg, WPARAM wParam,
|
||||||
WCHAR szFileName[MAX_PATH];
|
WCHAR szFileName[MAX_PATH];
|
||||||
HANDLE hDrop = (HANDLE) wParam;
|
HANDLE hDrop = (HANDLE) wParam;
|
||||||
|
|
||||||
DragQueryFile(hDrop, 0, szFileName, SIZEOF(szFileName));
|
DragQueryFileW(hDrop, 0, szFileName, SIZEOF(szFileName));
|
||||||
DragFinish(hDrop);
|
DragFinish(hDrop);
|
||||||
DoOpenFile(szFileName);
|
DoOpenFile(szFileName);
|
||||||
break;
|
break;
|
||||||
|
@ -590,7 +589,7 @@ static LRESULT WINAPI NOTEPAD_WndProc(HWND hWnd, UINT msg, WPARAM wParam,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return DefWindowProc(hWnd, msg, wParam, lParam);
|
return DefWindowProcW(hWnd, msg, wParam, lParam);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -601,13 +600,13 @@ static int AlertFileDoesNotExist(LPCWSTR szFileName)
|
||||||
WCHAR szMessage[MAX_STRING_LEN];
|
WCHAR szMessage[MAX_STRING_LEN];
|
||||||
WCHAR szResource[MAX_STRING_LEN];
|
WCHAR szResource[MAX_STRING_LEN];
|
||||||
|
|
||||||
LoadString(Globals.hInstance, STRING_DOESNOTEXIST, szResource, SIZEOF(szResource));
|
LoadStringW(Globals.hInstance, STRING_DOESNOTEXIST, szResource, SIZEOF(szResource));
|
||||||
wsprintfW(szMessage, szResource, szFileName);
|
wsprintfW(szMessage, szResource, szFileName);
|
||||||
|
|
||||||
LoadString(Globals.hInstance, STRING_ERROR, szResource, SIZEOF(szResource));
|
LoadStringW(Globals.hInstance, STRING_ERROR, szResource, SIZEOF(szResource));
|
||||||
|
|
||||||
nResult = MessageBox(Globals.hMainWnd, szMessage, szResource,
|
nResult = MessageBoxW(Globals.hMainWnd, szMessage, szResource,
|
||||||
MB_ICONEXCLAMATION | MB_YESNO);
|
MB_ICONEXCLAMATION | MB_YESNO);
|
||||||
|
|
||||||
return(nResult);
|
return(nResult);
|
||||||
}
|
}
|
||||||
|
@ -726,7 +725,7 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show)
|
||||||
static const WCHAR className[] = {'N','o','t','e','p','a','d',0};
|
static const WCHAR className[] = {'N','o','t','e','p','a','d',0};
|
||||||
static const WCHAR winName[] = {'N','o','t','e','p','a','d',0};
|
static const WCHAR winName[] = {'N','o','t','e','p','a','d',0};
|
||||||
|
|
||||||
aFINDMSGSTRING = RegisterWindowMessage(FINDMSGSTRING);
|
aFINDMSGSTRING = RegisterWindowMessageW(FINDMSGSTRINGW);
|
||||||
|
|
||||||
ZeroMemory(&Globals, sizeof(Globals));
|
ZeroMemory(&Globals, sizeof(Globals));
|
||||||
Globals.hInstance = hInstance;
|
Globals.hInstance = hInstance;
|
||||||
|
@ -742,7 +741,7 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show)
|
||||||
class.lpszMenuName = MAKEINTRESOURCEW(MAIN_MENU);
|
class.lpszMenuName = MAKEINTRESOURCEW(MAIN_MENU);
|
||||||
class.lpszClassName = className;
|
class.lpszClassName = className;
|
||||||
|
|
||||||
if (!RegisterClassEx(&class)) return FALSE;
|
if (!RegisterClassExW(&class)) return FALSE;
|
||||||
|
|
||||||
/* Setup windows */
|
/* Setup windows */
|
||||||
|
|
||||||
|
@ -759,9 +758,9 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show)
|
||||||
x = y = CW_USEDEFAULT;
|
x = y = CW_USEDEFAULT;
|
||||||
|
|
||||||
Globals.hMainWnd =
|
Globals.hMainWnd =
|
||||||
CreateWindow(className, winName, WS_OVERLAPPEDWINDOW, x, y,
|
CreateWindowW(className, winName, WS_OVERLAPPEDWINDOW, x, y,
|
||||||
main_rect.right - main_rect.left, main_rect.bottom - main_rect.top,
|
main_rect.right - main_rect.left, main_rect.bottom - main_rect.top,
|
||||||
NULL, NULL, Globals.hInstance, NULL);
|
NULL, NULL, Globals.hInstance, NULL);
|
||||||
if (!Globals.hMainWnd)
|
if (!Globals.hMainWnd)
|
||||||
{
|
{
|
||||||
ShowLastError();
|
ShowLastError();
|
||||||
|
@ -775,16 +774,16 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show)
|
||||||
UpdateWindow(Globals.hMainWnd);
|
UpdateWindow(Globals.hMainWnd);
|
||||||
DragAcceptFiles(Globals.hMainWnd, TRUE);
|
DragAcceptFiles(Globals.hMainWnd, TRUE);
|
||||||
|
|
||||||
HandleCommandLine(GetCommandLine());
|
HandleCommandLine(GetCommandLineW());
|
||||||
|
|
||||||
hAccel = LoadAcceleratorsW(hInstance, MAKEINTRESOURCEW(ID_ACCEL));
|
hAccel = LoadAcceleratorsW(hInstance, MAKEINTRESOURCEW(ID_ACCEL));
|
||||||
|
|
||||||
while (GetMessage(&msg, 0, 0, 0))
|
while (GetMessageW(&msg, 0, 0, 0))
|
||||||
{
|
{
|
||||||
if (!TranslateAccelerator(Globals.hMainWnd, hAccel, &msg) && !IsDialogMessage(Globals.hFindReplaceDlg, &msg))
|
if (!TranslateAcceleratorW(Globals.hMainWnd, hAccel, &msg) && !IsDialogMessageW(Globals.hFindReplaceDlg, &msg))
|
||||||
{
|
{
|
||||||
TranslateMessage(&msg);
|
TranslateMessage(&msg);
|
||||||
DispatchMessage(&msg);
|
DispatchMessageW(&msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return msg.wParam;
|
return msg.wParam;
|
||||||
|
|
Loading…
Reference in a new issue