Well after a couple of years doing dialog box, buttons, listviews, etc the hard way (ie CreateWindowEX), I have decieded to move on.
I guess the first question is I still want to use as much pure Win32/API as possible (no MFC) so is using the resource editor and Dialog or CreateDialog the best way to do this?
My second question is how do I do it? I make a quick dialog using an IDD_PROPAGE_MEDIUM. Now I am trying to get it to just come up. I have tried CreateDialog() and Dialog() with out any luck. Someone want to help me out?
Doing this I get a NULL g_hWnd
Code:
/*---------------------------------*/
//Include
#include "Main.h"
/*---------------------------------*/
//Global VARs
HWND g_hWnd; //Holds The Window Handle
HINSTANCE g_hInst; //Holds The Window Instance
TCHAR g_szClass[] = "Test Window";//Class Title
HANDLE g_hMutex = NULL; //Handle For The Mutex
/*---------------------------------*/
//Modual VARs
int m_iWidth = 500; //Main Window Width
int m_iHeight = 500; //Main Window Height
int m_iX = CENTERX(m_iWidth); //Main Window's X Position
int m_iY = CENTERY(m_iHeight); //Main Window's Y Position
/*---------------------------------*/
//Modual Functions
BOOL CALLBACK DialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
/*---------------------------------*/
/*###########################################################################################*/
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow)
{
/*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
MSG _msg; //VAR To Hold Our Main Messages
/*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
if(!Startup(g_szClass)) //Run My Custom Start Function
return -1;
g_hWnd = CreateDialog(hInst, MAKEINTRESOURCE(IDD_MAIN), NULL, DialogProc);
ShowWindow(g_hWnd, SW_SHOW);
int i;
while(i = GetMessage(&_msg, NULL, 0, 0)) //Window Message Loop
{
if (i == -1)
break;
TranslateMessage(&_msg);
DispatchMessage(&_msg);
}
return ((int)_msg.wParam); //Exit The Program
}
/*###########################################################################################*/
BOOL CALLBACK DialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
case WM_INITDIALOG:
return TRUE;
case WM_CLOSE:
DestroyWindow(hWnd); //Closes the dialog box
PostQuitMessage(0); //Exit the program
return TRUE;
}
return FALSE;
}
If I use Dialog instead I can get the window to come up, but if I even try to click on it I cant. Its like its not being drawn/redrawn. So I am stuck.
Any help would be great thanks.
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com
I don't get it either, from what I can tell it SHOULD work too, which is why this is starting to get frustrating. All I wanted to do was make Windows faster instead of having to code everything by hand
Ok so if I use GetDesktopWindow() instead of NULL:
CreateDialog(g_hInst,MAKEINTRESOURCE(IDD_MAIN),GetDesktopWindow(),Main_DlgProc);
I get a window like DialogBox gives me, but I can't click on it or anything (See attached)
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com