Win32 API Common Dialog Boxes

Ok.
I've been STUMPED by common dialog boxes. I can get nearly everything else to work - but these. I know the code, but will somebody PLEASE PLEASE take me through it, step by step, including where to put the damn code in the first place so it will work.

THANKS to all who help.
Adam

Comments

  • Hmmm... not a very specific question...
    Well, suppose you have a menu item, like Help->About and you want to show an about dialog box.

    First of all in the WNDPROC function of your window you search for a WM_COMMAND message with the ID of the menu item (eg. IDM_ABOUT) in the low-order byte of wParam [ LOWORD(wParam) ].
    Then, I suppose you've created a dialog resource, with all the necessary stuff.

    Just call CreateDialog, with something like this:

    CreateDialog(hInst, MAKEINTRESOURCE(IDD_ABOUT), hWnd, (DLGPROC) AboutDlgProc);

    where:
    hInst -> handle to current instance
    IDD_ABOUT -> the ID of your resource
    hWnd -> handle to parent window. Can be NULL (if I remember well ;))
    AboutDlgProc -> the DLGPROC function to handle dialog messages (like WndProc)

    A DLGPROC is defined in this way:
    LRESULT CALLBACK AboutDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);

    Hope this will help you

    bye
    nICO


  • Sorry, but that ISN'T what I was looking for. I know how to make dialogs and everything appear, as such, but I'm screwed when it comes to the 'COMMON DIALOG BOXES', being, the standard Open dialog and the Save dialog and the Color choose dialog, and things like that. They are PRE-DEFINED, but I don't know where to go. Read the first message if you didn't see what I said.

    Thanks for the help anyway,
    Adam
  • Ooops, sorry I misunderstood!
    Well, now that I've understand what you need to do... I don't know how to answer you!
    I tried using them various times, without success, so at least I chose to draw them manually, and manually implement all the functions: it's a very boring and quite long work, so if you find how to use premade ones, use them!

    bye
    nICO
  • : Ok.
    : I've been STUMPED by common dialog boxes. I can get nearly everything else to work - but these. I know the code, but will somebody PLEASE PLEASE take me through it, step by step, including where to put the damn code in the first place so it will work.
    :
    : THANKS to all who help.
    : Adam
    :

    see if this is of any help:
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/UserInput/CommonDialogBoxLibrary/UsingCommonDialogBoxes.asp#open_file
  • Thanks for the address. However, It wasn't of any help :(. But! I found the answer to my problem. It's a compatibility thing. If you're running Windows 95/98, not XP/2000, you can't put

    -- Code--
    ofn.lStructSize = sizeof(OPENFILENAME);
    -- End --

    as your lStructSize member, or it won't work. Instead, use this line:

    -- Code--
    ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
    -- End --

    Hope this helps anyone with my problem.
  • : Thanks for the address. However, It wasn't of any help :(. But! I found the answer to my problem. It's a compatibility thing. If you're running Windows 95/98, not XP/2000, you can't put
    :
    : -- Code--
    : ofn.lStructSize = sizeof(OPENFILENAME);
    : -- End --
    :
    : as your lStructSize member, or it won't work. Instead, use this line:
    :
    : -- Code--
    : ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
    : -- End --
    :
    : Hope this helps anyone with my problem.
    :

    I seem to remember that defining _WIN32_WINNT to the appropriate value (0x0400 for pre-win2k) before including windows.h takes care of that ...

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories