can't find windows class

can't find windows class

Hi,
I try to create a dialog box using DialogBoxParam function but I get the following error:

ret = DialogBoxParam(ghInstance,IDD_DIALOG_list,hWnd,LOC(listdlgProc), 0)

ERROR_CANNOT_FIND_WND_CLASS Cannot find window class. 1407

Why does this error occur?
Thanks,
archana

5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi,

It is most likely that your construction of the IDD_DIALOG_list is incorrect. This argument contains the DLGTEMPLATE-structure immediately followed by a menu array, a class array and a title array. This main template is followed bij "n" DLGITEMTEMPLATEs, in which "n" is defined in the DLGTEMPLATE.
Each DLGITEMTEMPLATE is followed by 3 arrays containing class, title and creation date elements.
Be sure each array starts at a WORD (=integer*2) boundary.
I will advise you to carefully follow the rules in the documentation of the templates, because is it a hell of a job to get it working.

Guus

Hi,

This is the About dialogbox resource from the .rc file in my project:

/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//

ABOUTDLG DIALOG FIXED PURE 22, 17, 167, 64
STYLE DS_MODALFRAME | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "About checkbox_listview"
BEGIN
DEFPUSHBUTTON "OK",IDOK,132,2,32,14
ICON "checkbox_listview",-1,2,3,1,1
LTEXT "CompanyName",IDC_VER1,30,2,100,8
LTEXT "FileDescription",IDC_VER2,30,10,82,8
LTEXT "ProductVersion",IDC_VER3,114,10,16,8
LTEXT "LegalCopyright ",IDC_VER4,30,18,137,8
LTEXT "LegalTrademarks",IDC_VER5,30,34,136,27
CONTROL "",501,"Static",SS_BLACKRECT,28,31,138,1
END

#endif // Neutral resources
/////////////////////////////////////////////////////////////////////////////

and this is the IDD_DIALOG_LIST resource from the same .rc file:

/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//

IDD_DIALOG_list DIALOG FIXED PURE 0, 0, 212, 127
STYLE DS_MODALFRAME | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,155,7,50,14
PUSHBUTTON "Cancel",IDCANCEL,155,24,50,14
CONTROL "List1",IDC_LIST1,"SysListView32",LVS_REPORT | WS_BORDER |
WS_TABSTOP,7,7,147,113
END

////////////////////////////////////////////////////////
lpszName = "AboutDlg"C
ret = DialogBoxParam(ghInstance,LOC(lpszName),hWnd,&
LOC(AboutDlgProc), 0)

This call succeeds.
______________________________________________________

ret = DialogBoxParam(ghInstance,IDD_DIALOG_LIST1,hWnd,&
LOC(AboutDlgProc), 0)

This call fails.
______________________________________________________
How is the argument for the second different from the first. What must the dialogbox template argument be.Thanks
-archana

Hi Archana,

Sorry I overwhelmed you with my reply on the dialog template, but I was focused on the way I fill in the template and that is completely via a Fortran routine. I get the information for the build of the dialog during runtime and then the building of a template indeed is a hell of a job.

I don't see the problem in the way you apply it. The only thing I see is you use the name IDD_DIALOG_LIST1, but I assume this is a typo.

Guus

Hi,
This project is a new one. This DialogBox call fails irrespective of which resource_id I use,IDD_DIALOG_LIST, IDD_DIALOG1. And get last error returns 1407:Can't find windows class.
I have other projects where I have succesfully used the same command with a similar call to DialogBox as this one. Is it some library I have to include?. I think the problem could be with the resource definition because I can use AboutDlgProc as the default callback routine.
-archana

Leave a Comment

Please sign in to add a comment. Not a member? Join today