-
June 6th, 2019, 10:26 AM
#1
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:
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)?
-
June 6th, 2019, 10:32 AM
#2
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...
-
June 6th, 2019, 11:14 AM
#3
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.
-
June 6th, 2019, 11:36 AM
#4
Re: CreateDialog() without using Resource.h and '.rc' file..?
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.
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.2)
-
June 6th, 2019, 12:28 PM
#5
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..!
-
June 6th, 2019, 01:39 PM
#6
Re: CreateDialog() without using Resource.h and '.rc' file..?
 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! 
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?
Victor Nijegorodov
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|