Jump to content
Tuts 4 You

Rgn File Coding


antrobs

Recommended Posts

Maybe Goppit's tutorial about MASM coding will help you, it has that subject and a source is included too it a nice tutorial check it i think Teddy published it here in the forum :D & Loki it right Lena had a source in here tutorial that shows it's usage

so check it out too it would be usefull ;)

Link to comment

@Loki

@Angel-55

Ya! i know those 2 stuff exist but, i'm sorry for not elaborating my problem properly....What i want is to make my About dialog with an RGN file too...

(code is from goppits' tut and adding some code to it)

For example:

#define IDD_DLG1001 1001
#define IDC_BUTTON1002 1002
#define IDD_DLG1003 1003
#define IDC_BUTTON1004 10042001 BITMAP DISCARDABLE "main.bmp"
2002 RCDATA DISCARDABLE "mainregion.rgn"
2003 BITMAP DISCARDABLE "about.bmp"
2004 RCDATA DISCARDABLE "aboutregion.rgn"IDD_DLG1001 DIALOGEX 0,0,200,186
FONT 8,"MS Sans Serif"
STYLE 0x90000800
EXSTYLE 0x00000000
BEGIN
CONTROL "?",IDC_BUTTON1002,"Button",0x50010000,163,132,10,10,0x00000000
END
IDD_DLG1003 DIALOGEX 0,0,100,186
FONT 8,"MS Sans Serif"
STYLE 0x90000800
EXSTYLE 0x00000000
BEGIN
CONTROL "?",IDC_BUTTON1004,"Button",0x50010000,163,132,10,10,0x00000000
END

MY MAIN PROCEDURE:

DlgProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM 
.if uMsg == WM_INITDIALOG
invoke SetWindowPos,hWnd, HWND_TOPMOST,0,0,0,0,SWP_NOACTIVATE + SWP_NOMOVE + SWP_NOSIZE
invoke LoadBitmap,hInstance,2001
invoke CreatePatternBrush,eax
mov brush, eax
invoke FindResource,hInstance,2002,RT_RCDATA
mov hResInfo,eax
invoke LoadResource,hInstance,hResInfo
mov hResData, eax
invoke SizeofResource,hInstance,hResInfo
mov sizeRsrc,eax
invoke LockResource,hResData
mov pRsrc, eax
invoke ExtCreateRegion,NULL,sizeRsrc,pRsrc
invoke SetWindowRgn,hWnd,eax,TRUE
.elseif uMsg==WM_CTLCOLORDLG
mov eax, brush
ret
.elseif uMsg==WM_COMMAND
mov eax,wParam
.if eax==1002
invoke DialogBoxParam, hInstance, 1003, NULL, addr AbtProc, NULL
.endif
.elseif uMsg==WM_LBUTTONDBLCLK
invoke SendMessage,hWnd,WM_CLOSE,0,0
.elseif uMsg==WM_LBUTTONDOWN
invoke SendMessage,hWnd,WM_NCLBUTTONDOWN,HTCAPTION,lParam
.elseif uMsg == WM_CLOSE
invoke DeleteObject,brush
invoke EndDialog, hWnd, 0
.endif
xor eax,eax
ret
DlgProc endp

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

MY ABOUT:

AbtProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM 
.if uMsg == WM_INITDIALOG
invoke SetWindowPos,hWnd, HWND_TOPMOST,0,0,0,0,SWP_NOACTIVATE + SWP_NOMOVE + SWP_NOSIZE
invoke LoadBitmap,hInstance,2003
invoke CreatePatternBrush,eax
mov brush, eax
invoke FindResource,hInstance,2004,RT_RCDATA
mov hResInfo,eax
invoke LoadResource,hInstance,hResInfo
mov hResData, eax
invoke SizeofResource,hInstance,hResInfo
mov sizeRsrc,eax
invoke LockResource,hResData
mov pRsrc, eax
invoke ExtCreateRegion,NULL,sizeRsrc,pRsrc
invoke SetWindowRgn,hWnd,eax,TRUE
.elseif uMsg==WM_CTLCOLORDLG
mov eax, brush
ret
.elseif uMsg == WM_CLOSE
invoke DeleteObject,brush
invoke EndDialog, hWnd, 0
.endif
xor eax,eax
ret
AbtProc endp

Does this sample do the trick or there's some better other ways to do it.... :dunno:

P.S.>Just Practicing and learning coding in MASM :D

GrEeTz,

aNtRoBs

Link to comment

Your code looks fine. You've declared the two regions and the bitmaps and loaded them as diaglogs.

Nothing wrong there that I can see (although I've not tried to compile it).

Is it not working for you, or were you just wondering if there was a quicker way?

Link to comment

@Loki

Is it not working for you, or were you just wondering if there was a quicker way?

I think is the second thing...(wondering if there was a quicker way) or some sort of optimization thing... :rolleyes:

gReRtZ,

aNtRobS

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...