use AppInstance

This commit is contained in:
Glenn Maynard
2002-12-16 02:08:58 +00:00
parent b0d45c22d1
commit 989995a31f
2 changed files with 3 additions and 12 deletions
@@ -12,15 +12,7 @@ BOOL CALLBACK LoadingWindow_Win32::WndProc( HWND hWnd, UINT msg, WPARAM wParam,
LoadingWindow_Win32::LoadingWindow_Win32() LoadingWindow_Win32::LoadingWindow_Win32()
{ {
handle = NULL; hwnd = CreateDialog(handle.Get(), MAKEINTRESOURCE(IDD_LOADING_DIALOG), NULL, WndProc);
hwnd = NULL;
/* Little trick to get an HINSTANCE of ourself without having access to the hwnd ... */
TCHAR szFullAppPath[MAX_PATH];
GetModuleFileName(NULL, szFullAppPath, MAX_PATH);
handle = LoadLibrary(szFullAppPath);
hwnd = CreateDialog(handle, MAKEINTRESOURCE(IDD_LOADING_DIALOG), NULL, WndProc);
SetText("Initializing hardware..."); SetText("Initializing hardware...");
Paint(); Paint();
@@ -30,8 +22,6 @@ LoadingWindow_Win32::~LoadingWindow_Win32()
{ {
if(hwnd) if(hwnd)
EndDialog(hwnd, 0); EndDialog(hwnd, 0);
if(handle)
FreeLibrary(handle);
} }
void LoadingWindow_Win32::Paint() void LoadingWindow_Win32::Paint()
@@ -4,9 +4,10 @@
/* Loading window using a Windows dialog. */ /* Loading window using a Windows dialog. */
#include "LoadingWindow.h" #include "LoadingWindow.h"
#include <windows.h> #include <windows.h>
#include "../../archutils/Win32/AppInstance.h"
class LoadingWindow_Win32: public LoadingWindow { class LoadingWindow_Win32: public LoadingWindow {
HINSTANCE handle; AppInstance handle;
HWND hwnd; HWND hwnd;
CString text; CString text;