Thread: CreateDialog fails (Using resource but not MFC)

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    22

    CreateDialog fails (Using resource but not MFC)

    I am trying to show a dialog that I have created in reasource editor (without using MFC). I call CreateDialog like this.
    Code:
    det.hwnd = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_PREFS_DIALOG), pps->hwnd, (DLGPROC)PrefsDialogProc);
    but it fails. GetLastError() returns 1814, which is "The specified resource name cannot be found in the image file." IDD_PREFS_DIALOG is the only thing in the .rc file and it is a FORMVIEW. I have code from another project that is virtually identical and it works. I am not quite sure where to look for the problem. Any help would be appreciated. Oh, almost forgot, Compiling on MSVC++ 6.0

    Chris

  2. #2
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    You're sure you have it defined in you resource header file?
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  3. #3
    Registered User
    Join Date
    Oct 2002
    Posts
    22
    Yes, I am, that is why it is so puzzling to me.
    Code:
    #define IDD_PREFS_DIALOG                101
    (of course MSVC did this for me, but still, it is there)

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    You have included the script.rc and resource.h?

    (but if not it should be kicking up an error fo an unknown identifier)

    Try a simple dlg with the same code.

    Ensure that the callback is entered by putting a break point on the main switch.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  5. #5
    Alexander Kabanets
    Join Date
    Mar 2005
    Location
    Paris
    Posts
    1
    Is any menu of the dialog defined?

    I had the error when a dialog with menu was defined but corresponding menu wasn't added to the resources of the project.

  6. #6
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    I think the problem might have been solved in the last two YEARS.......
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Sorting out a resource manager
    By psychopath in forum Game Programming
    Replies: 1
    Last Post: 11-10-2008, 07:12 PM
  2. 256-Color Bitmap in MFC Resource :: Doesn't Load Right
    By SyntaxBubble in forum Windows Programming
    Replies: 2
    Last Post: 09-16-2003, 03:55 PM
  3. WIndows programming?
    By hostensteffa in forum Windows Programming
    Replies: 7
    Last Post: 06-07-2002, 08:52 PM
  4. Release MFC Programs & Dynamic MFC DLL :: MFC
    By kuphryn in forum Windows Programming
    Replies: 2
    Last Post: 05-18-2002, 06:42 PM
  5. Serial Communications in C
    By ExDigit in forum Windows Programming
    Replies: 7
    Last Post: 01-09-2002, 10:52 AM