Dialogs in memory? How ridiculous...

This is a discussion on Dialogs in memory? How ridiculous... within the Windows Programming forums, part of the Platform Specific Boards category; Hi, I'm trying to get the sample code from MSDN for "Creating a Template in Memory" (Platform SDK->User Interface Services->Windowing->Dialog ...

  1. #1
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,262

    Wink Dialogs in memory? How ridiculous...

    Hi,

    I'm trying to get the sample code from MSDN for "Creating a Template in Memory" (Platform SDK->User Interface Services->Windowing->Dialog Boxes->Using Dialog Boxes) to work, but after calling the DisplayMyMessage with GetModuleHandle(NULL), my window's handle and a test message as parameters, nothing happened.

    Using FormatMessage with GetLastError() gives "Invalid window handle.", which is rubbish, because I can see the window and all the other functions don't have a problem with it. What else could stop this from working?

  2. #2
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,262
    Hmm, if I change the DLGTEMPLATE's cdit member from 3 to 0 or 1, it works. The cdit member tells DialogBoxIndirect how many controls are on the dialog. I think MSDN made a boo boo defining the "Help button" and "Static text control" somewhere, or they're misaligned or something. I really would like to use more than one control in my dialogs

    Am I on my own with this one?

  3. #3
    Visionary Philosopher Sayeh's Avatar
    Join Date
    Aug 2002
    Posts
    212
    there is a difference between a dialog template (DITL) and a dialog (DLOG). A dialog template is a dialoge item list, not a window. It needs to be associated with a dialog, which is a window.
    It is not the spoon that bends, it is you who bends around the spoon.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Question regarding Memory Leak
    By clegs in forum C++ Programming
    Replies: 29
    Last Post: 12-07-2007, 12:57 AM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 10:22 AM
  3. Suggestions on this C style code
    By Joelito in forum C Programming
    Replies: 11
    Last Post: 06-07-2007, 03:22 AM
  4. Shared Memory - shmget questions
    By hendler in forum C Programming
    Replies: 1
    Last Post: 11-29-2005, 01:15 AM
  5. Memory allocation and deallocation
    By Micko in forum C++ Programming
    Replies: 3
    Last Post: 08-19-2005, 06:45 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21