CreateDialog() without using Resource.h and '.rc' file..?
Trying to create a Modeless Dialog Box in WinAPI but without using a predefined Resource file.
How would I go about doing that with CreateDialog()?
Documentation states for the second parameter:
Quote:
lpName
Type: LPCTSTR
The dialog box template. This parameter is either the pointer to a null-terminated character string that specifies the name of the dialog box template or an integer value that specifies the resource identifier of the dialog box template.
Could someone provide an example that uses a "null-terminated character string"?
How do I define the characteristics of the Dialog Box if I'm not using a Resource.h or .rc template?
Have tried researching examples online but they all seem to use Resource files.
Also, how do I determine the correct value to place in the first parameter (HINSTANCE)?
Re: CreateDialog() without using Resource.h and '.rc' file..?
Oh... I found THIS:
https://www.codeproject.com/articles...-inputbox-in-c
Let me know if there's anything else to add... :wave:
Re: CreateDialog() without using Resource.h and '.rc' file..?
The dialog box doesn't appear.
Main window becomes inactive when I call CreateWindow() but no Dialog Box appears.
Re: CreateDialog() without using Resource.h and '.rc' file..?
Quote:
Trying to create a Modeless Dialog Box in WinAPI but without using a predefined Resource file.
Have a look at CreateDialogIndirectParam() https://docs.microsoft.com/en-us/win...indirectparama
This lets you specify the contents of a dialog using structures in your program rather than a resource file.
Re: CreateDialog() without using Resource.h and '.rc' file..?
Oh I found the error...
I was forgetting to call DefWindowProc(hWnd, msg, WP, LP); in my AboutProc message handler:
Code:
LRESULT CALLBACK AboutProc(HWND hWnd, MSG msg, WPARAM WP, LPARAM LP)
{
default:
DefWindowProc(hWnd, msg, WP, LP);
}
Without that line of code the call to CreateWindow() is not processed until completion so the Dialog Box never displays.
It's an elementary error but one worth noting as a possible cause of this behaviour.
Appreciate your help..!
Re: CreateDialog() without using Resource.h and '.rc' file..?
Quote:
Originally Posted by
Arianax
Oh I found the error...
I was forgetting to call DefWindowProc(hWnd, msg, WP, LP); in my AboutProc message handler:
Glad you solved your problem! :thumb:
However, two questions:
1. is it so important for you to not use MFC, but only the plain Win32 API?
2. What prevents you to use resource template (.rc) file?