News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Resource.rc File

Started by Force, February 15, 2012, 11:28:21 AM

Previous topic - Next topic

Force

Hi


I saw different Commands in Resource.rc files of sample programs

for example:

STYLE   0X10C80880
EXSTYLE 0X00000001

STYLE   0X10CA0800

or

CONTROL "",IDC_EDT8,"Edit",0x50010000,12,7,108,11,0x00000200

I dont know mean of those numbers (values)  (0X10C80880   0X00000001  0X10CA0800  --  0x50010000 0x00000200 )


How can i know mean of them ? Is there anybody who knows mean of them ?
Never Stop Until You Are Better Than The Best

ragdog

Hi

Style== Defines the window style of the dialog box. The window style specifies whether the box is a pop-up or a child window.
Exstyle==Defines extended window styles for a dialog box. In a resource definition, the EXSTYLE statement is placed with the optional statements before the beginning of the body of the resource definition.

You can all read it about Resource-Definition by Msdn
http://msdn.microsoft.com/en-us/library/windows/desktop/aa381043%28v=vs.85%29.aspx

Greets,

dedndave

there is a help file named rc.hlp
oddly, it is located in masm32\bin, rather than masm32\help
i think he wants to keep it with the rc.exe and rc.dll files

Force

What I mean is


Somebody makes it like that =  MENUITEM SEPARATOR
but another1 makes like that = MENUITEM "",,0X00000800

i think mean of both of them is same but as u see 2nd one made it
with 0x00000800 value

or

EDITTEXT        IDC_EDT8,12,7,108,11,ES_AUTOHSCROLL NOT WS_BORDER,WS_EX_STATICEDGE

CONTROL "",IDC_EDT8,"Edit",0x50010000,12,7,108,11,0x00000200

both of lines are same too

2nd line is different , progarammer used just numerical values there

i asked about those numerical values

anyway thanks
Never Stop Until You Are Better Than The Best

ragdog

Quote
Somebody makes it like that =  MENUITEM SEPARATOR
but another1 makes like that = MENUITEM "",,0X00000800

For the definition can your look in Masm32\include\resource.h >>/* Menu flags

#define MF_SEPARATOR        0x00000800L

dedndave

those values are constants that are defined in masm32\include\resource.h

with the previous version of the masm32 package, there was an update to the resource.h file
http://www.masm32.com/board/index.php?topic=12791.msg98764#msg98764

the current version should already be updated

so - one programmer may have used the constants explicitly - the other used the names defined in resource.h
using the names is a better practice

at the beginning of the resource file, you can use
#include "\masm32\include\resource.h"

in some cases, i wanted my resource to work whether they had the old or new resource.h file
so - for the ones that did not appear in the older version, i might have done something like this
;###################################################################

#include "\masm32\include\resource.h"

#ifndef  CREATEPROCESS_MANIFEST_RESOURCE_ID
#define  CREATEPROCESS_MANIFEST_RESOURCE_ID  1
#endif

#ifndef  RT_MANIFEST
#define  RT_MANIFEST                         24
#endif

#ifndef  VS_VERSION_INFO
#define  VS_VERSION_INFO                     1
#endif

#ifndef  VOS_NT_WINDOWS32
#define  VOS_NT_WINDOWS32                    0x00040004L
#endif

#ifndef  VFT_APP
#define  VFT_APP                             0x00000001L
#endif

;*******************************************************************


that way, the resource file will build properly, whether or not the constants are defined in resource. h

Force

THANKS ragdog n dedndave  :U

I understand now    Solution is in resource.h file
Never Stop Until You Are Better Than The Best

raymond

Most programmers will use the long definitions when "manually" preparing resources. It's somewhat easier and more understandable as compared to seraching for the numerical codes through the resource.h file.

However, if you use a resource editor to "immediately" see what you will be getting, most (if not all) of those editors will prepare the resource file with the numerical codes. When you see numerical codes in an .rc file, the odds are VERY high that the programmer used a resource editor to prepare that resource file.
When you assume something, you risk being wrong half the time
http://www.ray.masmcode.com

Force

yes Raymond

after expert programmer friends helping

I researched resource.h file carefully yesterday.
In fact dedndave is right by saying"using the names is a better practice" for beginners like me
But knowing numerical codes is important also, because if i dont know mean of them
I can't understand what programmer is trying to do in sample program

and numerical code makes easy to alot of things
for example  i knew that
        ;================================
        ; Centre window
        ;================================

        mov Wwd, 430
        mov Wht, 277

        invoke GetSystemMetrics,SM_CXSCREEN
        invoke TopXY,Wwd,eax
        mov Wtx, eax

        invoke GetSystemMetrics,SM_CYSCREEN
        invoke TopXY,Wht,eax
        mov Wty, eax


But Some programmers make it easy in resource

STYLE 0X10CA0800 ; (Center of Screen and no resize)

Hope I am not boring for ppl around here by asking questions
I just wanna learn more then Your experiences are too importan for me

THANKS

FORCE
Never Stop Until You Are Better Than The Best

dedndave

the TopXY routine takes the desired window dimension and the screen dimension and calculates the X or Y
it is pretty simple, really

this line of code returns the screen width in EAX
        invoke GetSystemMetrics,SM_CXSCREEN

Wwd is the desired window width

the TopXY routine subtracts the desired window width from the screen width
then, it divides the result by 2
that gives you an X screen position for the left side of the window

the same calculation is made again, using screen height and desired window height to get the Y position

there are many reasons for creating a window in code or in resource
you get more control over window attributes when created in code
if you create it in resource, it is probably faster to write   :P