Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Xeno

need help in win32 programming

This topic is 6515 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi! im trying to create modal dialogbox on run-time , and this is the code im using: DLGTEMPLATE dTemplate; dTemplate.style = WS_POPUP | WS_SYSMENU | WS_CAPTION | WS_VISIBLE; dTemplate.cdit = 0; dTemplate.cx = 450; dTemplate.cy =100; dTemplate.x =0; dTemplate.y =0; DialogBoxIndirect(CApp.GetHInst(),&dTemplate,CApp.GetHWnd(),(DLGPROC)DlgProc8); while CApp.GetHWnd() is the parent hwnd and CApp.GetHInst is the parent instance when im trying to create the dialog in that way i get this error: ERROR_RESOURCE_NAME_NOT_FOUND somebody knows why? thanks . roy.

Share this post


Link to post
Share on other sites
Advertisement
According to my copy of the MSDN Library "DLGTEMPLATE structure is always immediately followed by three variable-length arrays that specify the menu, class, and title for the dialog box." In your code you seem to be forgetting to take care of these "variable-length arrays".

Here is how the MSDN Library handles them:


lpw = (LPWORD) (lpdt + 1);
*lpw++ = 0; // no menu
*lpw++ = 0; // predefined dialog box class (by default)

lpwsz = (LPWSTR) lpw;
nchar = 1+ MultiByteToWideChar (CP_ACP, 0, "My Dialog",
-1, lpwsz, 50);
lpw += nchar;


lpw is a LPWORD, lpwsz is a LPWSTR, and lpdt is a LPDLGTEMPLATE. Obviosly they dynamically allocate the DLGTEMPLATE structure and you would need to alter the code to adjust for the fact that you do not.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!