Dialog Boxes

This is a discussion on Dialog Boxes within the Windows Programming forums, part of the Platform Specific Boards category; I use Bloodshed Dev C++, and I created a C windows file. I can not get dialog boxes to work. ...

  1. #1
    Unregistered
    Guest

    Dialog Boxes

    I use Bloodshed Dev C++, and I created a C windows file. I can not get dialog boxes to work. I enter the code into the resource file (.rc) and it pops out a parse error. I dont understand. The code is generated from the program, but it doesnt work.
    Josh
    http://www.xp-users.com

  2. #2
    Registered User The15th's Avatar
    Join Date
    Aug 2001
    Posts
    125
    Hi there Josh;

    I have never used Bloodshed but does it come with a Resource Editor? if it does just make a new resource and be sure to include its header file. after that is done you need to create the dialog box from your program. its hard for me to see where your going wrong with no info on the prase error or any code that your using so i will show you how to make a dialog from sratch.

    case IDM_WHATEVER:
    DialogBox(g_hInst, (LPCTSTR)IDD_NAME, hWnd, (DLGPROC)DlgNameProc);
    break;

    LRESULT CALLBACK DlgNameProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
    {
    switch (message)
    {
    case WM_INITDIALOG:

    return TRUE;

    case WM_COMMAND:
    if (LOWORD(wParam) == IDOK )
    {
    EndDialog(hDlg, LOWOR (wParam));
    return TRUE;
    }

    if (LOWORD(wParam) = IDCANCEL)
    {
    EndDialog(hDlg, LOWORD(wParam));
    return TRUE;
    }

    break;
    }
    return FALSE;
    }

    anyway that will load a dlg for you. if you still get errors then please show us some code, it helps...
    arrh, i got nothing good to say.
    http://www.praxis1.vic.edu.au/home/dcola/

  3. #3
    Unregistered
    Guest
    yes, it does have a resource editor, but it doesnt work to put it in there, that is where I am getting the parse error.

    here is what I type in:
    100 DIALOG 0, 0, 200, 200
    <b>STYLE WS_VISIBLE | WS_SYSMENU | WS_POPUP | WS_CAPTION | DS_MODALFRAME<b>
    the bold is the line the puter tells me is the problem

    if you need the rest of it, just tell me.
    Josh

  4. #4
    Registered User
    Join Date
    Jan 2002
    Posts
    2
    Ok, I get a load of errors when I do that:
    g_hinst undeclared
    hWnd undeclared
    DlgNameProc undeclared
    parse error before '_attribute_'
    hDlg undeclared
    parse error before 'break'
    some error written all messed up (dont know what it says)
    DlgNameProc undeclared
    and another one I cant read

    lots of errors.
    all I did was type the code in, where it is supposed to go, and push compile. should I have done something else?

    Josh

  5. #5
    Registered User ExDigit's Avatar
    Join Date
    Jan 2002
    Posts
    31
    Oh, I really object to Dev-C++'s resource builder. I use lcc's resource editor and use Dev-C++ to compile.

    Okay, this is a simple problem.. which in my opinion I think Dev-C++ should do for you - it confused me for ages.

    Simply add:
    #include <windows.h>
    At the top of the resource file and click Compile Resource. Worked fine for me.. This is a quick resource file I made:

    #include <windows.h>
    100 DIALOG 0, 0, 200, 200
    STYLE WS_VISIBLE | WS_SYSMENU | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | DS_MODALFRAME
    CAPTION "My Dialog Box"
    FONT 8,"Helv"
    BEGIN
    END


    Hope all goes well, good luck!

  6. #6
    Registered User
    Join Date
    Jan 2002
    Posts
    2
    OK, now I got the resource file to work, but when I compile it using theforger's tuturial, I go to the menu item, click the one that goes to my dialog, and it exits. What do I do now?
    Josh
    http://www.xp-users.com

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, 09:56 PM
  2. Dialog Boxes
    By Thantos in forum Windows Programming
    Replies: 7
    Last Post: 08-26-2003, 01:49 PM
  3. Dialog Boxes and Sliders
    By AtomRiot in forum Windows Programming
    Replies: 4
    Last Post: 01-29-2003, 08:36 AM
  4. Dialog Boxes
    By cerion in forum Windows Programming
    Replies: 4
    Last Post: 06-10-2002, 07:54 PM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 10:44 AM

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