antrobs Posted June 8, 2007 Posted June 8, 2007 Does someone know how to used RGN file in coding in MASM? Need some help here mates......AnTroBs
Loki Posted June 8, 2007 Posted June 8, 2007 Check out lena's 36th tut. It will tell you everything you need.
Angel-55 Posted June 8, 2007 Posted June 8, 2007 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 & Loki it right Lena had a source in here tutorial that shows it's usage so check it out too it would be usefull
antrobs Posted June 9, 2007 Author Posted June 9, 2007 @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,186FONT 8,"MS Sans Serif"STYLE 0x90000800EXSTYLE 0x00000000BEGIN CONTROL "?",IDC_BUTTON1002,"Button",0x50010000,163,132,10,10,0x00000000ENDIDD_DLG1003 DIALOGEX 0,0,100,186FONT 8,"MS Sans Serif"STYLE 0x90000800EXSTYLE 0x00000000BEGIN CONTROL "?",IDC_BUTTON1004,"Button",0x50010000,163,132,10,10,0x00000000END 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.... P.S.>Just Practicing and learning coding in MASM GrEeTz, aNtRoBs
Loki Posted June 11, 2007 Posted June 11, 2007 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?
antrobs Posted June 12, 2007 Author Posted June 12, 2007 @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... gReRtZ, aNtRobS
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now