Thread: Res files/interface/controls

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    26

    Res files/interface/controls

    Hello.
    I have a file .rc looking like this:

    ######################
    (...)
    ID_WINDOW DIALOG 107, 23, 302, 161
    STYLE WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
    CAPTION "WINDOW"
    FONT 8, "MS Sans Serif"
    MENU IDMAINMENU
    BEGIN
    LTEXT "search for:", 401, 6, 6, 44, 12
    EDITTEXT ID_INPUT_TEXT, 51, 6, 158, 12, ES_AUTOHSCROLL
    PUSHBUTTON "search", ID_BT_SEARCH, 217, 6, 78, 12
    (......)
    ##################

    this would be the main window...

    **how can I use that code from the rc on my file.c??**
    all I have seen is that I would have to do some CreateWindow()
    for the buttons, listbox.....
    but doing this way, that code above from the rc file is useless!


    Thanks,
    Jester
    #pwd
    Brazil

  2. #2
    Registered User
    Join Date
    Dec 2001
    Posts
    26
    Oh, one more thing!
    The only thing I did with suscess was the Menu using MAKEINTRESOURCE()...
    but I don't know how to place the other elements (buttons, listbox...) from the .rc file in my .c file!
    #pwd
    Brazil

  3. #3
    Registered User
    Join Date
    Dec 2001
    Posts
    421
    If you are creating your own window, rather than using the dialog resource, then you are going to have to use CreateWindow() to create all the controls that you want to put on that window.

    If you want to use the resources, then either DialogBox() (modal) or CreateDialog() (modeless) is what you need.

    good luck
    U.
    Quidquid latine dictum sit, altum sonatur.
    Whatever is said in Latin sounds profound.

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Once you have created a dialog in the Resource editor you must #include both

    "resource.h" and "script.rc"

    Then use MAKEINTRESOURCE(ID_WINDOW) in the DialogBox() or CreateDialog() call.

    (I use MSVC 6)

    If you are creating one on the fly, need to register a Windows class with RegisterClass() and then call CreateWindow for it and all the controls.
    Last edited by novacain; 01-13-2002 at 11:02 PM.
    "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
    Registered User
    Join Date
    Dec 2001
    Posts
    26

    finally it worked

    it worked!!! finally!!!
    I did only one CreateDialog and it worked the way I want....the app has just one window....

    Thanks for the help
    #pwd
    Brazil

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 03-27-2009, 04:21 AM
  2. 800x600 res Applications..?
    By csonx_p in forum Windows Programming
    Replies: 31
    Last Post: 07-01-2008, 04:12 AM
  3. C programing doubt
    By sivasankari in forum C Programming
    Replies: 2
    Last Post: 04-29-2008, 09:19 AM
  4. Combobox problem
    By gargamel in forum Windows Programming
    Replies: 2
    Last Post: 05-06-2005, 01:37 PM
  5. How do you use float????
    By LittleLotte in forum C Programming
    Replies: 7
    Last Post: 02-03-2005, 02:48 AM