How create dialog box with DialogBoxIndirect function

0

I have code

     DLGITEMTEMPLATE* item1 = new DLGITEMTEMPLATE();
     item1->style = BS_PUSHBUTTON;
     item1->x = 10;
     item1->y = 10;
     item1->cx = 10;
     item1->cy = 10;
     item1->id = Modal_Button1;
     DLGTEMPLATE* dlgtmp =new DLGTEMPLATE();
     dlgtmp->cdit = 1;
     dlgtmp->style =  WS_SYSMENU;
     dlgtmp->x = 0;
     dlgtmp->y = 0;
     dlgtmp->cx = 100;
     dlgtmp->cy = 100;
     DialogBoxIndirect(((LPCREATESTRUCT)lParam)->hInstance, dlgtmp, hwnd, DlgProc);

    BOOL CALLBACK DlgProc(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lParam)
   {
        switch (iMsg)
    {

    case WM_INITDIALOG:
        return TRUE;
    }
    return FALSE;
}

I have no idea how connect item1 to dlgtemp!

The error is thrown when I try use DialogBoxIndirect function.

Exception thrown at 0x004C302F in Program.exe: 0xC0000005: Access violation reading location 0x00320005. 
winapi
asked on Stack Overflow Oct 2, 2020 by sasha • edited Oct 2, 2020 by sasha

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0