Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Windows class not created error?

Windows class not created error?

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    TheDelChop
    wrote on last edited by
    #1

    Hi, I am experiencing some real trouble with a simple windows program that I am trying to create. After running the CreateDialog() function, windows returns the error "Windows class not created". I am having trouble determing what this message is really telling me. The result of this error message is that after processing the WM_SETFONT message inside the DlgProc for the Dialog Box that it creates, Windows always processes the WM_DESTROY instead of the WM_INITDIALOG which is the next message that my other working windows programs processes which creates and displays the dialog box. I have posted my WinAPI function below: int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int nCmdShow) { MSG msg; HWND mainWnd; hInst = hInstance; // Make instance available globally InitCommonControls(); // Create a dummy window so the dialog box can have a parent window, then // create the dialog box itself. mainWnd = CreateWindow("", "", 0, 0, 0, 0, 0, NULL,(HMENU)-1, hInstance, 0); MainDlgBox = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_AURACONNECT), mainWnd, (DLGPROC)DlgProc); DWORD Err = GetLastError(); SetClassLong(mainWnd,GCL_HICON,IDI_EXE); // Standard Windows message loop while(GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } return msg.wParam; } Thank you for anyone who can offer any help. Joe

    M 1 Reply Last reply
    0
    • T TheDelChop

      Hi, I am experiencing some real trouble with a simple windows program that I am trying to create. After running the CreateDialog() function, windows returns the error "Windows class not created". I am having trouble determing what this message is really telling me. The result of this error message is that after processing the WM_SETFONT message inside the DlgProc for the Dialog Box that it creates, Windows always processes the WM_DESTROY instead of the WM_INITDIALOG which is the next message that my other working windows programs processes which creates and displays the dialog box. I have posted my WinAPI function below: int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int nCmdShow) { MSG msg; HWND mainWnd; hInst = hInstance; // Make instance available globally InitCommonControls(); // Create a dummy window so the dialog box can have a parent window, then // create the dialog box itself. mainWnd = CreateWindow("", "", 0, 0, 0, 0, 0, NULL,(HMENU)-1, hInstance, 0); MainDlgBox = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_AURACONNECT), mainWnd, (DLGPROC)DlgProc); DWORD Err = GetLastError(); SetClassLong(mainWnd,GCL_HICON,IDI_EXE); // Standard Windows message loop while(GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } return msg.wParam; } Thank you for anyone who can offer any help. Joe

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      Can you post your DlgProc code? Also, if the dialog is the main window of the app, does it need the dummy parent window? Mark

      T 1 Reply Last reply
      0
      • M Mark Salsbery

        Can you post your DlgProc code? Also, if the dialog is the main window of the app, does it need the dummy parent window? Mark

        T Offline
        T Offline
        TheDelChop
        wrote on last edited by
        #3

        My DlgProc is rather lengthy, so I don't think I can post it, but is that what is most likely causing error? I don't know if it needs a dummy window, I'll try it without it.

        M 1 Reply Last reply
        0
        • T TheDelChop

          My DlgProc is rather lengthy, so I don't think I can post it, but is that what is most likely causing error? I don't know if it needs a dummy window, I'll try it without it.

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #4

          TheDelChop wrote:

          but is that what is most likely causing error?

          Actually I thought that might be the case, since you stated you had other similar working apps. Looking at your code again this morning, though, I would try changng this line: SetClassLong(mainWnd,GCL_HICON,IDI_EXE); to SetClassLong(mainWnd,GCL_HICON,LoadIcon(hInstance, MAKEINTRESOURCE(IDI_EXE));

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups