flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
RIxRIpt 23 Nov 2014, 11:13
Quote: What should I do with WindowProc? You can find an example in FASM\EXAMPLES\WIN64\TEMPLATE\TEMPLATE.ASM |
|||
![]() |
|
SeryZone 23 Nov 2014, 18:17
Now, how to make mainmenu?
Code: format PE64 GUI 5.0 entry start include 'win64a.inc' PROGRAM_WIDTH = 1280 PROGRAM_HEIGHT = 720 section '.text' code readable executable start: sub rsp,8 invoke GetModuleHandle,0 mov [wc.hInstance],rax invoke LoadIcon,0,IDI_APPLICATION mov [wc.hIcon],rax mov [wc.hIconSm],rax invoke LoadCursor,0,IDC_ARROW mov [wc.hCursor],rax invoke RegisterClassEx,wc test rax,rax jz error invoke CreateWindowEx,0,_class,_title,WS_VISIBLE+WS_DLGFRAME+WS_SYSMENU,128,128,PROGRAM_WIDTH,PROGRAM_HEIGHT,NULL,NULL,[wc.hInstance],NULL test rax,rax jz error msg_loop: invoke GetMessage,msg,NULL,0,0 cmp eax,1 jb end_loop jne msg_loop invoke TranslateMessage,msg invoke DispatchMessage,msg jmp msg_loop error: invoke MessageBox,NULL,_error,NULL,MB_ICONERROR+MB_OK end_loop: invoke ExitProcess,[msg.wParam] proc WindowProc uses rbx rsi rdi, hwnd,wmsg,wparam,lparam ; Note that first four parameters are passed in registers, ; while names given in the declaration of procedure refer to the stack ; space reserved for them - you may store them there to be later accessible ; if the contents of registers gets destroyed. This may look like: ; mov [hwnd],rcx ; mov [wmsg],edx ; mov [wparam],r8 ; mov [lparam],r9 cmp edx,WM_DESTROY je .wmdestroy .defwndproc: invoke DefWindowProc,rcx,rdx,r8,r9 jmp .finish .wmdestroy: invoke PostQuitMessage,0 xor eax,eax .finish: ret endp section '.data' data readable writeable _title TCHAR 'Mandel Machine Movie Maker',0 _class TCHAR 'MMMM',0 _error TCHAR 'Startup failed. Hahahahaha',0 wc WNDCLASSEX sizeof.WNDCLASSEX,0,WindowProc,0,0,NULL,NULL,NULL,COLOR_BTNFACE+1,NULL,_class,NULL msg MSG section '.idata' import data readable writeable library kernel32,'KERNEL32.DLL',\ user32,'USER32.DLL' include 'api\kernel32.inc' include 'api\user32.inc' section '.rsrc' resource data readable menu main_menu menuitem '&File',0,MFR_POPUP menuitem '&Load...',10 menuitem '&Close',11 menuseparator menuitem 'E&xit',1,MFR_END menuitem '&Help',0,MFR_POPUP + MFR_END menuitem '&ABOUT...',12,MFR_END |
|||
![]() |
|
tthsqe 25 Nov 2014, 03:09
this is a lot of windows specific issue. you can find some examples on how to do this on this board.
options: 1) you can put the menu in the resource section and call LoadMenu before RegisterClass 2) manually create the menu in the winodwProc by api calls I am familiar with 1) because it is easiest |
|||
![]() |
|
bitshifter 25 Nov 2014, 03:29
Go learn the Win32 API from TheForger, then come back to FASM later...
http://www.winprog.org/tutorial/ |
|||
![]() |
|
SeryZone 25 Nov 2014, 16:54
bitshifter wrote: Go learn the Win32 API from TheForger, then come back to FASM later... And how to learn this? It fully English (My English is not amazing!!!) + I badly undertand C++. It is hard for me. |
|||
![]() |
|
JohnFound 25 Nov 2014, 17:27
@SeryZone There are many articles in Russian as well, for example here: http://wasm.ru/wault/
Read them carefully! You know, without foreign languages you can't learn programming on decent level. (And especially assembler, where the literature is missing) |
|||
![]() |
|
SeryZone 26 Nov 2014, 23:11
How to apply MultiSelect for Open dialog???
Code: .openseq: mov dword[of.lStructSize],sizeof.OPENFILENAME mov dword[of.lpstrFile],OFN_ALLOWMULTISELECT ;that's is not correctly mov dword[of.lpstrFile],OpenFileString mov dword[of.nMaxFile],1024 invoke GetOpenFileNameA,of test rax,rax jz .returnz invoke CreateFileA,OpenFileString,GENERIC_READ,0,0,OPEN_EXISTING,0,0 mov r15,rax test rax,rax jz .returnz |
|||
![]() |
|
DOS386 01 Dec 2014, 03:01
> + How to decompress file using deflate algorithm.
3 options: 0. use ZLIB.DLL 1. implement it natively 2. find some C code, compile and include into your program Please open a separate thread about Deflate. > It fully English (My English is not amazing!!!) + I badly > undertand C++. It is hard for me. Indeed it's hard to learn programming without English. Moving this from "Main" into "Windows". |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.