Resource Editor Help

This is a discussion on Resource Editor Help within the C++ Programming forums, part of the General Programming Boards category; I downloaded the Sage Resource editor, but when i make my resource, it doesnt make a header file. I was ...

  1. #1
    Programmer Frantic-'s Avatar
    Join Date
    Dec 2004
    Posts
    114

    Resource Editor Help

    I downloaded the Sage Resource editor, but when i make my resource, it doesnt make a header file.

    I was wondering if:

    1.) You know any sites that teach how to make header files

    or

    2.) Do you know it isnt making my header files and do you know of any other free editors?

  2. #2
    fuh
    fuh is offline
    Attack hamster fuh's Avatar
    Join Date
    Dec 2002
    Posts
    176
    You can make header files for resources pretty easily.
    EXAMPLE: resource.h
    Code:
    //***************************************************
    //Icons                  Range: 1000 - 1999     Prefix: IDI
    //***************************************************
    #define IDI_MYICON       1000
    #define IDI_MYICON_SM    1001     //SM is the small icon
    
    //***************************************************
    //Bitmaps                Range: 2000 - 2999     Prefix: IDB
    //***************************************************
    #define IDB_MYBITMAP     2000
    #define IDB_STOLENBMP    2001
    #define IDB_WHATSTHIS    2002
    
    //***************************************************
    //Wave Sounds            Range: 3000 - 3999     Prefix: IDW
    //***************************************************
    #define IDW_YOUWIN       3000
    #define IDW_YOULOSE      3001
    
    //***************************************************
    //That's all folks!
    //***************************************************
    There are a lot more types of resources including menus (9000 - 9999) but this pretty much covers it. Look online if you want to learn about the other types of resources.

    Hope that helps,
    fuh
    Last edited by fuh; 01-30-2005 at 09:08 AM.
    Stupid things pop singers say

    "I get to go to lots of overseas places, like Canada."
    - Britney Spears

    "I love what you've done with the place!"
    -Jessica Simpson upon meeting the Secretary of Interior during tour of the White House

  3. #3
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    The prefixes and the number range are just conventions, btw.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  4. #4
    fuh
    fuh is offline
    Attack hamster fuh's Avatar
    Join Date
    Dec 2002
    Posts
    176
    I know, but it helps me to do them that way.
    Stupid things pop singers say

    "I get to go to lots of overseas places, like Canada."
    - Britney Spears

    "I love what you've done with the place!"
    -Jessica Simpson upon meeting the Secretary of Interior during tour of the White House

  5. #5
    Programmer Frantic-'s Avatar
    Join Date
    Dec 2004
    Posts
    114
    if its not too much, does anyone mind breaking down the code, and giving an example of how to execute it in my source?

  6. #6
    fuh
    fuh is offline
    Attack hamster fuh's Avatar
    Join Date
    Dec 2002
    Posts
    176
    Code:
        wincl.hIcon = LoadIcon (NULL, IDI_MYICON);
        wincl.hIconSm = LoadIcon (NULL, IDI_MYICON_SM);
    That's for the icons in my example when wincl is a WNDCLASSEX.
    Stupid things pop singers say

    "I get to go to lots of overseas places, like Canada."
    - Britney Spears

    "I love what you've done with the place!"
    -Jessica Simpson upon meeting the Secretary of Interior during tour of the White House

  7. #7
    Programmer Frantic-'s Avatar
    Join Date
    Dec 2004
    Posts
    114
    ok, so i would place this in my source code, with the correct ID and what not, and it would open the res file, execute that code and display the results?

  8. #8
    fuh
    fuh is offline
    Attack hamster fuh's Avatar
    Join Date
    Dec 2002
    Posts
    176
    No, that isn't correct. You'd place that in, for example, "resource.h"

    The resource file would be something like this:
    Code:
    #include "resource.h"
    
    //**************************************************
    //Icons*********************************************
    //**************************************************
    IDI_MYICON     ICON     "MyIcon.ico"
    IDI_MYICON_SM  ICON     "MyIconSM.ico"
    Last edited by fuh; 01-30-2005 at 10:31 AM.
    Stupid things pop singers say

    "I get to go to lots of overseas places, like Canada."
    - Britney Spears

    "I love what you've done with the place!"
    -Jessica Simpson upon meeting the Secretary of Interior during tour of the White House

  9. #9
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    No. You place this in a header file, which you include from both your source and the resource file.

    Then you use a resource compiler, which will create an object file from the resource file. This object file you link together with the various object files from compiling your C++ code.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  10. #10
    Programmer Frantic-'s Avatar
    Join Date
    Dec 2004
    Posts
    114
    ok, lets see if i got this straight

    I have made a resource file, resource.res

    In that resource file, i have made a dialog box with a title of dialogBox, with two command buttons.

    IDOK , 1
    IDCANCLE , 2

    are my button symbols and numbers.

    The resource editor gave my dialog box a number of 100, and id buttons numbers 1 and 2.

    So im guessing id make a header file like this, well call it resource.

    -----------------------------------------------------------------------------------------

    Code:
    #define IDD_DialogBox       100
    And in my source id put something like:
    ------------------------------------------------------------------------------------
    Code:
    #include "resource.h"
    
    IDD_DialogBox     DIALOG     "<*i dont even have a guess as to what to put here*>"

  11. #11
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    i dont even have a guess as to what to put here
    You define the resource. For icons and such, you put a filename here. For dialogs, string tables and menus, you use their respective weird definition syntaxes.

    The WinSDK documentation should contain information on this.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  12. #12
    Programmer Frantic-'s Avatar
    Join Date
    Dec 2004
    Posts
    114
    was everything else correct?

    EDIT:

    and it should be

    IDD_DialogBox DIALOG;
    Last edited by Frantic-; 01-30-2005 at 11:56 AM.

  13. #13
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Umm... I believe you should #include <windows.h> from the resource file too, that will add definitions such as IDOK.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  14. #14
    Programmer Frantic-'s Avatar
    Join Date
    Dec 2004
    Posts
    114
    Code:
    #include <windows.h>
    #include <tchar.h>
    #include "resource.h"
    
    BOOL MainDialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
    {
    	return FALSE;
    }
    
    int _tmain(void)
    {
    	DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_DialogBox), 
    		NULL, (DLGPROC)MainDialogProc, 0);
    	return 0;
    }
    this is my source code. Not workin, i get leterally like 20 errors saying NULL command/s ignored

    Here is my header file

    Code:
    #include windows.h
    
    #define IDD_DialogBox       100

  15. #15
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    That would be
    #include <windows.h>
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Sorting out a resource manager
    By psychopath in forum Game Programming
    Replies: 1
    Last Post: 11-10-2008, 06:12 PM
  2. unmanaged resource
    By George2 in forum C++ Programming
    Replies: 2
    Last Post: 01-03-2008, 03:23 AM
  3. CreateProcess with Resource of executable, not the Filename
    By Ktulu in forum Windows Programming
    Replies: 4
    Last Post: 11-04-2006, 12:07 AM
  4. resource problem/question
    By stallion in forum Windows Programming
    Replies: 4
    Last Post: 01-29-2003, 01:08 PM
  5. Serial Communications in C
    By ExDigit in forum Windows Programming
    Replies: 7
    Last Post: 01-09-2002, 09:52 AM

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