Related Projects > NASMX

res file problems im having

(1/2) > >>

william427:
this is in a res file the top one is for dialog and the second is for button.
my question is does the two numbers have to be 1000 and 1001 or is this any made up numbers?


thanks




--- Code: ---#define IDD_DLG1 1000
#define IDC_BTN1 1001


--- End code ---

encryptor256:
Looks like WinAPI issue.

Those looks like made up numbers.

Wikibooks page under the title: "Windows Programming/Resource Script Reference".

Resource Identificator, ID: "IDs are allowed in range 0..65535 and preferred in range 1..32767.".


--- Code: ---#define ID_MY_LEG 798
#define ID_MY_SOMETHING_ELSE 6664
#define ID_WHO_CARES_ABOUT_THIS_ID 11233

--- End code ---

There are system resources too, like icons, cursors.

* Maybe it (- the range of resource id) depends on resource compiler that you are using.

Gunner:
Made up by the programmer, which is what I do.

Each dialog will start with a thousand base:
IDD_MAIN = 1000
IDD_ABOUT = 2000
IDD_OPTIONS = 3000
etc...

And controls on each dialog will go off that base number, i.e. controls on IDD_MAIN will be 1001, 1002, 1003, etc.  Controls on IDD_ABOUT will be 2001, 2002, 2003, etc.  This will allow about 999 controls on each dialog without clashing with another dialog.  Menus might start at 500 and go up.  Submenu items will go off that base number:  Main menu = 500, subitems will be 501, 502, 503, etc...  File menu might be 600 and subitems will be 601, 602, 603, etc...

You as the programmer, will make the rules on how you program.

william427:
im still having a bit of trouble
without changing the rc file how do I change the caption at run time or is it possible?
thanks




--- Code: ---%include "c:\nasm\ini\win32\WIN32N.INC"
IDD_DLG1 equ 1000
IDC_BTN1 equ 1001

MSGhWnd   equ 0
MSGmsg    equ 4
MSGwParam equ 8
MSGlParam equ 12


EXTERN GetModuleHandleA
IMPORT GetModuleHandleA Kernel32.dll
EXTERN DialogBoxParamA                 
IMPORT DialogBoxParamA user32.dll     
EXTERN MessageBoxA
IMPORT MessageBoxA user32.dll
EXTERN ExitProcess
IMPORT ExitProcess kernel32.dll


               
section .code USE32
..start:

push dword 0
call [GetModuleHandleA]
mov [mywindowinstance], eax

push dword 0               
push dword mydialog
push dword 0
push dword IDD_DLG1
push dword [mywindowinstance]
call [DialogBoxParamA]

mydialog:
cmp dword [esp+4+MSGwParam],1001
je exitout

cmp dword [esp+4+MSGmsg], WM_CLOSE
je exitout

jmp returnback

exitout:
push dword 0
call [ExitProcess]
jmp returnback

testout:
;;push dword MB_OK
;;push dword textinside 
;;push dword textinside
;;push dword 0           
;;call [MessageBoxA]
returnback:
mov eax, 0
ret 16

section .data USE32

mywindowinstance dd 0



--- End code ---



--- Code: ---#define IDD_DLG1 1000
#define IDC_BTN1 1001





IDD_DLG1 DIALOGEX 10,10,150,100
STYLE DS_MODALFRAME | DS_3DLOOK | DS_CENTER | DS_CENTERMOUSE | WS_CAPTION
CAPTION "Test_dialog"
FONT 8,"Tahoma"
STYLE WS_VISIBLE|WS_OVERLAPPEDWINDOW
BEGIN   
  CONTROL "EXIT",IDC_BTN1,"Button",WS_CHILD|WS_VISIBLE|WS_TABSTOP,15,21,39,15
    EDITTEXT        206,3,50,100,12,ES_AUTOHSCROLL
END

--- End code ---

Gunner:

--- Quote from: william427 on August 08, 2014, 12:25:17 PM ---without changing the rc file how do I change the caption at run time or is it possible?

--- End quote ---

What have you tried?  What research have you done?  Have you used the Windows API in another language?  If so, it is the same here.

You could use SetWindowTextA or SetWindowTextW for Unicode, which eventually just sends the message WM_SETTEXT; so instead of SetWindowText, you could just use SendMessage.

Navigation

[0] Message Index

[#] Next page

Go to full version