CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Error 1812 by DialogBoxIndirectParam()

  1. #1
    Join Date
    Apr 2006

    Error 1812 by DialogBoxIndirectParam()

    I want to create a modal dialog box without .rc (just because I use eclipse cdt wich seems to be unable to use .rc)

    here's my code:

    int cCamEditor::doDialog(vector<cCommand*> commands, cCamera *cam) {
        DLGTEMPLATE tmpl;
        tmpl.style = WS_VISIBLE | WS_CHILDWINDOW;
        tmpl.dwExtendedStyle = 0;
        tmpl.cdit = 2;
        tmpl.x = 30;
        tmpl.y = 30;
        tmpl.cx = 100;
        tmpl.cy = 40;
        DialogBoxIndirectParam(this->hInstance, &tmpl, this->hParent, cCamEditor::dlgProc, (LPARAM)this);
        char s[255];
        sprintf(s, "Error Code: %d", GetLastError());
        MessageBox (NULL, s, "Error", MB_OK);
        return true;
    BOOL CALLBACK cCamEditor::dlgProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
        cCamEditor *This = reinterpret_cast<cCamEditor*>(GetWindowLong(hwnd, GWL_USERDATA));    
        switch (message) {
            case WM_INITDIALOG:
                SetWindowLong(hwnd, GWL_USERDATA, lParam);
                This->btnOK     = CreateWindow ("BUTTON", "OK",  WS_VISIBLE|WS_CHILD, 10, 190, 60, 20, hwnd, NULL, This->hInstance, NULL);
                This->btnCancel = CreateWindow ("BUTTON", "Cancel", WS_VISIBLE|WS_CHILD, 80, 190, 60, 20, hwnd, NULL, This->hInstance, NULL);
                return 1;
            case WM_COMMAND: 
                if (lParam == (LPARAM) This->btnOK) {
                        EndDialog (hwnd, 1);
                        This->retval = true;
                } else if (lParam == (LPARAM) This->btnCancel){
                        EndDialog (hwnd, 0);
                        This->retval = false;
                return DefDlgProc (hwnd, message, wParam, lParam);
        return TRUE;    
    DialogBoxIndirectParam() raises error code 1812.

    is there anybody who knows how to fix that?

    I'm using the MinGW compiler.

  2. #2
    Join Date
    Jul 2005

    Re: Error 1812 by DialogBoxIndirectParam()

    It seems that you need a resource section. Error code 1812 means:

    "The specified image file did not contain a resource section. "
    Please don't forget to rate users who helped you!

  3. #3
    Join Date
    May 2005

    Re: Error 1812 by DialogBoxIndirectParam()

    If a post helped you dont forget to "Rate This Post"

    My Article: Capturing Windows Regardless of Their Z-Order


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)