flat assembler
Message board for the users of flat assembler.

Index > Windows > Some questions about resources

Author
Thread Post new topic Reply to topic
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt
I have a few questions concerning resources and there use. Question
specifically:
Code:
section '.rsrc' resource from 'res/noteit.res' data readable    

...
1. Does windows automatically create the window from the resource file?
2. How would create the window with the features from the resource file without a label?
3. How would you access individual features from a resource file?

Any help and explanation would be helpful and most apreciated. Wink
Matt

_________________
Gimme a sledge hammer! I'LL FIX IT!
Post 29 Dec 2004, 00:45
View user's profile Send private message Reply with quote
IronFelix



Joined: 09 Dec 2004
Posts: 141
Location: Russia, Murmansk region
IronFelix
I try to give you some answers:

1. Windows doesn't automatically create window, you should use CreateDialogParam (or other from this series) to create modeless dialog box or DialogBoxParam (or other) to create modal dialog box.
2. I didn't understand what you mean saying 'label'. If it is ID of the resource, it must be for resource to be compiled. If you doesn't know ID you may try to use such functions as FindResource, LockResource etc., but i am not sure it will helps you. If you say about it's handle you should use GetDlgItem function to get HWNDs of dialog child, or LoadIcon, LoadCursor, LoadImage, LoadBitmap, LoadMenu etc. for other resource types.
3. If i understood you right, you want to use some resources. All of them have ID. If you don't know it see 2.

Best regards.
Post 29 Dec 2004, 06:34
View user's profile Send private message Reply with quote
IronFelix



Joined: 09 Dec 2004
Posts: 141
Location: Russia, Murmansk region
IronFelix
I forgot to tell you about EnumResourceLanguages, EnumResourceTypes, and EnumResourceNames functions. You can use then to enumerate all resources and try to get what you need.

Regards.
Post 29 Dec 2004, 06:44
View user's profile Send private message Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt
Thanks IronFelix,
By the second quetion I mean something like this:

Code:
myresource:
     section '.rsrc' resource from 'res/noteit.res' data readable    


I am making a dialog in RadASM and was wondering how to Create the dialog without any label by the data?

I found this code for my dialog, do you use the data in this text?

Code:
#define IDD_DLG1 1000
#define IDC_BTN1 1001
#define IDC_BTN1 1002
#define IDC_CBO1 1003
#define IDC_LST1 1004
#define IDC_STC1 1005
#define IDC_STC1 1006
#define IDC_BTN2 1007
IDD_DLG1 DIALOGEX 6,6,172,237
CAPTION "Screen Mode"
FONT 8,"MS Sans Serif",0,0
STYLE 0x10CE0000
EXSTYLE 0x00000000
BEGIN
  CONTROL "Create Mode List",IDC_BTN1,"Button",0x50010000,4,3,78,20,0x00000000
  CONTROL "Run Program",IDC_BTN1,"Button",0x50010000,88,3,80,20,0x00000000
  CONTROL "",IDC_CBO1,"ComboBox",0x50010003,4,42,162,15,0x00000000
  CONTROL "",IDC_LST1,"ListBox",0x50010141,4,72,162,135,0x00000200
  CONTROL "DEVICES",IDC_STC1,"Static",0x50000000,4,33,30,8,0x00000000
  CONTROL "SCREEN MODE LIST",IDC_STC1,"Static",0x50000000,4,60,72,8,0x00000000
  CONTROL "CLOSE",IDC_BTN2,"Button",0x50010000,4,210,162,20,0x00000000
END
    
[/code]
Post 29 Dec 2004, 10:25
View user's profile Send private message Reply with quote
IronFelix



Joined: 09 Dec 2004
Posts: 141
Location: Russia, Murmansk region
IronFelix
You are welcome, madmatt!

I also use RadASM and like it very much. To use dialog created by RadASM you should compile *.rc file produced by RadASM with a resource compiler (RC.EXE). You can find it in MASM or somewhere else. As a result you wiil get *.RES file containing compiled resource Then using 'section ...' FASM links it with your EXE or DLL.
Then you code such thing:

invoke CreateDialogParam,hInst,IDD_DLG1,0,DlgProc,0
mov [hwndDialog],eax

where hwndDialog is initialized or uninitialized data:

hwndDialog dd ? (or 0 for example)

You can create *.rc files manually (i usually did it to link some bitmaps, icons etc.), but last version of RadASM can now correctly produce such files (not only dialogs).

Regards.
Post 29 Dec 2004, 13:02
View user's profile Send private message Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt
All Right, thanks, thats the info I needed. It's going to be easier than I thought!
Post 29 Dec 2004, 22:22
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.