Thread: Dialog Boxes

  1. #1
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681

    Dialog Boxes

    Ok trying to create a dialog box. I had to download a third party software to create the RC file.

    Here is the code to call the dialog box:
    Code:
    tmp = DialogBox ( hInst, TEXT("DLG_0100"), hwnd, LogInProc);
    Resource File:
    Code:
    DLG_0100 DIALOG 118, 44, 180, 180
    STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
    CAPTION "Login"
    FONT 8, "MS Sans Serif"
    BEGIN
        EDITTEXT        101, 45, 23, 85, 18
        CTEXT           "Enter Your Name", 102, 45, 9, 85, 15
        CTEXT           "Enter the Password", 103, 45, 47, 85, 15
        EDITTEXT        104, 45, 58, 85, 15, ES_PASSWORD
        PUSHBUTTON      "Validate", 105, 37, 146, 40, 14, NOT WS_TABSTOP
        EDITTEXT        106, 45, 103, 85, 15, WS_DISABLED | NOT WS_TABSTOP
        PUSHBUTTON      "OK", 107, 107, 146, 40, 14, NOT WS_VISIBLE
    END
    Dialog Proc
    Code:
    BOOL CALLBACK LogInProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
    {
    switch ( message)
        {
        case WM_INITDIALOG:
            MessageBoxPrintf(TEXT("DIALOG"), TEXT("Dialog Started"));
            return TRUE;
            
        case WM_COMMAND:
            switch ( LOWORD (wParam) )
                {
                case 105:
                     EndDialog (hDlg, 0);
                     return TRUE;
                }
            break;
        }
        return FALSE;
    }
    Ok first off I know the dialog box doesn't do anything, thats because I'm trying to get it up first. I have never worked with RC files before and my book expects that I'm using MV C++ and that it will make my RC files for me.

    The error I'm getting is 1812 "ERROR_RESOURCE_DATA_NOT_FOUND" when calling the CreateDialog

    Any help or a link to a good tutorial would be great. Thanks

  2. #2
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644

    Re: Dialog Boxes

    Originally posted by Thantos
    ...Ok first off I know the dialog box doesn't do anything, thats because I'm trying to get it up first. I have never worked with RC files before and my book expects that I'm using MV C++ and that it will make my RC files for me....
    What compiler are you using?

    What is your o/s (operating system)?

    what version of the compiler are you using?

    what book are you using?

  3. #3
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Dang sorry forgot to add that.

    Dev C++ 4.9.8.1
    Win XP Pro
    Using Charles Petzold ver 5 (loosely)

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    >>tmp = DialogBox ( hInst, TEXT("DLG_0100"), hwnd, LogInProc);

    try

    tmp = DialogBox ( hInst, MAKEINTRESOURCE(DLG_0100), hwnd, LogInProc );

    make sure you have included

    resouce.h and script.rc files (these should be created by the resource editor and contain the dialog data)
    "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
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Thanks will have to try that. I scraped the dialog box and went with a seperate window for the login.

  6. #6
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644
    If you want, try MFC. It's easier overall to use, and the dialog editor really good.

  7. #7
    Registered User
    Join Date
    Jul 2003
    Posts
    8
    For some reason I can't get dialogs to work right in Dev-C++, but when I used Borland's compiler it worked perfectly!

  8. #8
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    I would suggest you stay away from MFC until you have a reasonable grasp of the API. Then have a look at it, and use it if you like it/have too.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Common Dialog boxes GetOpenFileName()
    By A10 in forum Windows Programming
    Replies: 3
    Last Post: 09-02-2008, 08:56 PM
  2. Dialog Boxes and Sliders
    By AtomRiot in forum Windows Programming
    Replies: 4
    Last Post: 01-29-2003, 08:36 AM
  3. Dialog Boxes
    By cerion in forum Windows Programming
    Replies: 4
    Last Post: 06-10-2002, 06:54 PM
  4. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM