Commit 55f024af authored by Alexandre Julliard's avatar Alexandre Julliard

wordpad: Use the main module instance instead of getting it from the window.

parent 6bb300fa
......@@ -50,7 +50,7 @@ static LPWSTR get_print_file_filter(HWND hMainWnd)
const WCHAR files_prn[] = {'*','.','P','R','N',0};
const WCHAR files_all[] = {'*','.','*','\0'};
LPWSTR p;
HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtr(hMainWnd, GWLP_HINSTANCE);
HINSTANCE hInstance = GetModuleHandleW(0);
p = wszPrintFilter;
LoadStringW(hInstance, STRING_PRINTER_FILES_PRN, p, MAX_STRING_LEN);
......@@ -88,7 +88,7 @@ void registry_read_pagemargins(HKEY hKey)
static void AddTextButton(HWND hRebarWnd, UINT string, UINT command, UINT id)
{
REBARBANDINFOW rb;
HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtr(hRebarWnd, GWLP_HINSTANCE);
HINSTANCE hInstance = GetModuleHandleW(0);
WCHAR text[MAX_STRING_LEN];
HWND hButton;
......@@ -846,7 +846,7 @@ LRESULT preview_command(HWND hWnd, WPARAM wParam)
{
HWND hReBar = GetDlgItem(hWnd, IDC_REBAR);
WCHAR name[MAX_STRING_LEN];
HINSTANCE hInst = (HINSTANCE)GetWindowLongPtrW(hWnd, GWLP_HINSTANCE);
HINSTANCE hInst = GetModuleHandleW(0);
if(preview.hdc2)
{
......
......@@ -85,7 +85,7 @@ static void DoLoadStrings(void)
static const WCHAR files_txt[] = {'*','.','t','x','t','\0'};
static const WCHAR files_all[] = {'*','.','*','\0'};
HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtr(hMainWnd, GWLP_HINSTANCE);
HINSTANCE hInstance = GetModuleHandleW(0);
LoadStringW(hInstance, STRING_RICHTEXT_FILES_RTF, p, MAX_STRING_LEN);
p += lstrlenW(p) + 1;
......@@ -683,8 +683,7 @@ static void set_bar_states(void)
static void preview_exit(HWND hMainWnd)
{
HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtr(hMainWnd, GWLP_HINSTANCE);
HMENU hMenu = LoadMenuW(hInstance, MAKEINTRESOURCEW(IDM_MAINMENU));
HMENU hMenu = LoadMenuW(GetModuleHandleW(0), MAKEINTRESOURCEW(IDM_MAINMENU));
HWND hEditorWnd = GetDlgItem(hMainWnd, IDC_EDITOR);
set_bar_states();
......@@ -701,7 +700,7 @@ static void preview_exit(HWND hMainWnd)
static void set_fileformat(WPARAM format)
{
HICON hIcon;
HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtr(hMainWnd, GWLP_HINSTANCE);
HINSTANCE hInstance = GetModuleHandleW(0);
fileFormat = format;
if(format & SF_TEXT)
......@@ -980,8 +979,7 @@ static void DialogOpenFile(void)
static void dialog_about(void)
{
HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtr(hMainWnd, GWLP_HINSTANCE);
HICON icon = LoadImageW(hInstance, MAKEINTRESOURCEW(IDI_WORDPAD), IMAGE_ICON, 48, 48, LR_SHARED);
HICON icon = LoadImageW(GetModuleHandleW(0), MAKEINTRESOURCEW(IDI_WORDPAD), IMAGE_ICON, 48, 48, LR_SHARED);
ShellAboutW(hMainWnd, wszAppTitle, 0, icon);
}
......@@ -1088,7 +1086,7 @@ static void dialog_viewproperties(void)
PROPSHEETPAGEW psp[2];
PROPSHEETHEADERW psh;
size_t i;
HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtr(hMainWnd, GWLP_HINSTANCE);
HINSTANCE hInstance = GetModuleHandleW(0);
LPCPROPSHEETPAGEW ppsp = (LPCPROPSHEETPAGEW)&psp;
psp[0].dwSize = sizeof(PROPSHEETPAGEW);
......@@ -1414,7 +1412,7 @@ static INT_PTR CALLBACK newfile_proc(HWND hWnd, UINT message, WPARAM wParam, LPA
{
case WM_INITDIALOG:
{
HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtr(hMainWnd, GWLP_HINSTANCE);
HINSTANCE hInstance = GetModuleHandleW(0);
WCHAR buffer[MAX_STRING_LEN];
HWND hListWnd = GetDlgItem(hWnd, IDC_NEWFILE);
......@@ -1459,8 +1457,7 @@ static INT_PTR CALLBACK paraformat_proc(HWND hWnd, UINT message, WPARAM wParam,
{
case WM_INITDIALOG:
{
HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtr(hMainWnd,
GWLP_HINSTANCE);
HINSTANCE hInstance = GetModuleHandleW(0);
WCHAR buffer[MAX_STRING_LEN];
HWND hListWnd = GetDlgItem(hWnd, IDC_PARA_ALIGN);
HWND hLeftWnd = GetDlgItem(hWnd, IDC_PARA_LEFT);
......@@ -1752,7 +1749,7 @@ static int context_menu(LPARAM lParam)
static LRESULT OnCreate( HWND hWnd )
{
HWND hToolBarWnd, hFormatBarWnd, hReBarWnd, hFontListWnd, hSizeListWnd, hRulerWnd;
HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtr(hWnd, GWLP_HINSTANCE);
HINSTANCE hInstance = GetModuleHandleW(0);
HANDLE hDLL;
TBADDBITMAP ab;
int nStdBitmaps = 0;
......@@ -2018,7 +2015,7 @@ static LRESULT OnCommand( HWND hWnd, WPARAM wParam, LPARAM lParam)
case ID_FILE_NEW:
{
HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtr(hWnd, GWLP_HINSTANCE);
HINSTANCE hInstance = GetModuleHandleW(0);
int ret = DialogBox(hInstance, MAKEINTRESOURCE(IDD_NEWFILE), hWnd,
newfile_proc);
......@@ -2334,25 +2331,15 @@ static LRESULT OnCommand( HWND hWnd, WPARAM wParam, LPARAM lParam)
break;
case ID_DATETIME:
{
HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtr(hWnd, GWLP_HINSTANCE);
DialogBoxW(hInstance, MAKEINTRESOURCEW(IDD_DATETIME), hWnd, datetime_proc);
DialogBoxW(GetModuleHandleW(0), MAKEINTRESOURCEW(IDD_DATETIME), hWnd, datetime_proc);
break;
}
case ID_PARAFORMAT:
{
HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtr(hWnd, GWLP_HINSTANCE);
DialogBoxW(hInstance, MAKEINTRESOURCEW(IDD_PARAFORMAT), hWnd,
paraformat_proc);
}
DialogBoxW(GetModuleHandleW(0), MAKEINTRESOURCEW(IDD_PARAFORMAT), hWnd, paraformat_proc);
break;
case ID_TABSTOPS:
{
HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtr(hWnd, GWLP_HINSTANCE);
DialogBoxW(hInstance, MAKEINTRESOURCEW(IDD_TABSTOPS), hWnd, tabstops_proc);
}
DialogBoxW(GetModuleHandleW(0), MAKEINTRESOURCEW(IDD_PARAFORMAT), hWnd, tabstops_proc);
break;
case ID_ABOUT:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment