flat assembler
Message board for the users of flat assembler.
Index
> Windows > LoadIcon and LoadImage |
Author |
|
Vasilev Vjacheslav 10 May 2006, 16:23
for moving without caption
Code: cmp ax,WM_LBUTTONDOWN jz .move .move: invoke ReleaseCapture invoke SendMessage,[hWnd],WM_NCLBUTTONDOWN,HTCAPTION,NULL jmp .processed for load simple bmp's you can use LoadBitmap and for icons you can use LoadIcon |
|||
10 May 2006, 16:23 |
|
smoke 11 May 2006, 05:39
thanks very much for this ! but i have some problems with adding this code . (im still a newb ..) so if you could tell me what im doing wrong .. i'll attach the code
Code: format PE GUI 4.0 entry start include 'win32a.inc' HTCAPTION = 56 WM_COMMAND1 = 109 ID_EXIT = 105 ID_NAME = 103 ID_SERIAL = 104 ID_GENERATE = 201 ID_CAPTION = 101 ID_CAPTION1 = 102 section '.code' code readable executable start: invoke GetModuleHandle,0 invoke DialogBoxParam,eax,37,HWND_DESKTOP,DialogProc,0 invoke ExitProcess,0 proc DialogProc hwnddlg,msg,wparam,lparam push ebx esi edi cmp [msg],WM_COMMAND je wmcommand cmp [msg],WM_CLOSE je wmclose cmp [msg],WM_COMMAND1 je wmclose xor eax,eax jmp finish cmp ax,WM_LBUTTONDOWN jz .move .move: invoke ReleaseCapture invoke SendMessage,[hwnddlg],WM_NCLBUTTONDOWN,HTCAPTION,NULL jmp processed wmcommand: cmp [wparam],BN_CLICKED shl 16 + ID_EXIT je wmclose wmcommand1: cmp [wparam],BN_CLICKED shl 16 + ID_GENERATE jne finish cmp [chg],1 je finish mov [chg],1 invoke GetDlgItemText,[hwnddlg],ID_CAPTION,namebuffer xor ecx,ecx xor ebx,ebx l00p1: mov [inputserial+ecx],0 inc bl inc ecx cmp bl,10h jne l00p1 xor ecx,ecx xor edx,edx xor ebx,ebx l00p: mov dl,byte [namebuffer+ecx] xor dl,byte [namebuffer+ecx+1] add dl,29h mov [inputserial+ecx],dl inc ecx inc bl cmp bl,10h jne l00p mov [inputserial+ecx],0 invoke SetDlgItemText,[hwnddlg],ID_CAPTION1,inputserial mov [chg],0 jmp finish wmclose: invoke EndDialog,[hwnddlg],0 processed: mov eax,1 finish: pop edi esi ebx ret endp section '.idata' import data readable writeable library kernel,'KERNEL32.DLL',\ user,'USER32.DLL' import kernel,\ GetModuleHandle,'GetModuleHandleA',\ lstrlen,'lstrlen',\ ExitProcess,'ExitProcess' import user,\ DialogBoxParam,'DialogBoxParamA',\ CheckRadioButton,'CheckRadioButton',\ GetDlgItemText,'GetDlgItemTextA',\ SetDlgItemText,'SetDlgItemTextA',\ IsDlgButtonChecked,'IsDlgButtonChecked',\ MessageBox,'MessageBoxA',\ SendMessage,'SendMessageA',\ ReleaseCapture,'ReleaseCapture',\ EndDialog,'EndDialog' ;################# namebuffer rb 200h inputserial rb 200h chg dd 0 ;################# section '.rsrc' resource data readable directory RT_DIALOG,dialogs resource dialogs,\ 37,LANG_ENGLISH+SUBLANG_DEFAULT,demonstration dialog demonstration,'Keygen',70,70,200,110,WM_NCLBUTTONDOWN+WS_POPUP+WS_SYSMENU+DS_MODALFRAME dialogitem 'EDIT','',ID_CAPTION,60,10,130,12,WS_VISIBLE+WS_BORDER+WS_TABSTOP dialogitem 'EDIT','',ID_CAPTION1,60,30,130,12,WS_VISIBLE+WS_BORDER+WS_TABSTOP dialogitem 'STATIC','Name:',ID_NAME,8,10,40,20,WS_VISIBLE+WS_TABSTOP+BS_TEXT dialogitem 'BUTTON','Generate',ID_GENERATE,20,65,70,20,WS_VISIBLE+WS_TABSTOP+BS_PUSHBUTTON dialogitem 'BUTTON','Exit',ID_EXIT,110,65,70,20,WS_VISIBLE+WS_TABSTOP+BS_PUSHBUTTON dialogitem 'STATIC','Serial:',ID_SERIAL,8,30,40,20,WS_VISIBLE+WS_TABSTOP+BS_TEXT enddialog |
|||
11 May 2006, 05:39 |
|
Vasilev Vjacheslav 11 May 2006, 15:16
Code: push ebx esi edi cmp [msg],WM_COMMAND je wmcommand cmp [msg],WM_CLOSE je wmclose cmp [msg],WM_COMMAND1 je wmclose xor eax,eax jmp finish cmp ax,WM_LBUTTONDOWN jz .move must be Code: push ebx esi edi cmp [msg],WM_COMMAND je wmcommand cmp [msg],WM_CLOSE je wmclose cmp ax,WM_LBUTTONDOWN jz .move cmp [msg],WM_COMMAND1 je wmclose xor eax,eax jmp finish |
|||
11 May 2006, 15:16 |
|
smoke 14 May 2006, 20:36
hmm weird , but the code doesnt work , Vasilev Vjacheslav can you check my code again ? maybe i defined something wrong ?
|
|||
14 May 2006, 20:36 |
|
Kenneth 14 May 2006, 23:16
HTCAPTION is 2, not 56. http://board.flatassembler.net/topic.php?t=4015 has those missing constants for future reference.
and Code: cmp ax,WM_LBUTTONDOWN should be Code: cmp [msg],WM_LBUTTONDOWN |
|||
14 May 2006, 23:16 |
|
OzzY 17 May 2006, 15:39
I'll use this thread to ask some question about bitmaps too.
* I want a bitmap to act as a button. So, I add it to my dialog and make it answer to clicks. Now, how can I change it when mouse is over it and when user clicked it? Example: 1) I have a button in gray, black and white colors. 2) When user place the mouse in it, it changes to another picture that is colored. 3) When the user click it, it changes the picture to another one that gives the effect of button pressed. 4) When mouse leaves the bitmap, it changes to the original gray, black and white one. Any ideas? |
|||
17 May 2006, 15:39 |
|
Vasilev Vjacheslav 17 May 2006, 18:00
OzzY, take a look to masm examples for such button
|
|||
17 May 2006, 18:00 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.