Thread: using the MSVC++ recource editor

  1. #1
    Unregistered
    Guest

    using the MSVC++ recource editor

    How do I use the MSVC++ recource editor (the one where you just drag controls and stuff onto dialog boxes, stuff like that...) to edit the contents of the actual main Window of my program?

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Win32:
    By making the dialog box the main wnd of your program (not using CreateWindow/CreateWindowEx) - use CreateDialog/CreateDialogParam to create the (modeless) dialog from the resource. You will have to change your message handling loop thingy too; return FALSE to unhandled msgs for default system handling. If you want default keyboard handling for your dialog box (like 'tabbing' through controls) then use IsDialogMessage.
    Note that no WM_CREATE is sent; use WM_INITDIALOG instead.
    Other than that a 'DialogProc' is more or less the same as a 'WndProc'. To kill off the dlg when system menu exit/system close button is used, call DestroyWindow (and postQuitMessage). This is done within WM_COMMAND handler (looking for id=IDCANCEL, which is system defined). This is delivered to the WM_COMMAND as the low word of the WPARAM ie LOWORD(wParam)==IDCANCEL.

    There is another way if you wish to retain a main wnd (actually there are a few). One method would involve attaching your dialog to the main wnd - but you'd still have to create the dlg and handle the msgs as above (much in the same way that tab cntrl pages might be done), with the added minor hassle of still having to deal with the main wnd's msg handling (create and position the dialog in the main wnd's WM_CREATE and use DestroyWindow on dlg in main wnd's WM_DESTROY).

    MFC: Use the wizard.

    Hope that is of some help.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. WYSIWYG editor problem
    By Akkernight in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 04-01-2009, 08:50 AM
  2. Replies: 12
    Last Post: 08-05-2003, 02:16 PM
  3. GCC (cygwin) much faster than MSVC, Borland?
    By Sargnagel in forum C Programming
    Replies: 15
    Last Post: 08-05-2003, 03:15 AM
  4. OpenGL terrain demo (EDITOR)
    By Jeremy G in forum Game Programming
    Replies: 2
    Last Post: 03-30-2003, 08:11 PM
  5. PFE (prorgammers file editor, for Windows)
    By Unregistered in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 06-09-2002, 11:01 AM