A
A
Andrey Sivukha2020-12-27 19:32:33
assembler
Andrey Sivukha, 2020-12-27 19:32:33

How to work with WinAPI in a FASM function?

It is necessary to use WinAPI functions in a function written in FASM, but the line

format MS COFF
does not allow compilation with WinAPI functions. Tell me how to do it.
format MS COFF
include 'include\win32w.inc'
public drawLine as '[email protected]'

section '.data' data readable writeable
_class TCHAR 'FASMWIN32',0
_title TCHAR 'Win32 program template',0
_error TCHAR 'Startup failed.',0

wc WNDCLASS 0,WindowProc,0,0,NULL,NULL,NULL,COLOR_BACKGROUND,NULL,_class

section '.code' code readable executable     ; ?????? ????

proc drawLine, x:DWORD, y:DWORD
    invoke  GetModuleHandle
    mov [wc.hInstance],eax
    invoke  LoadIcon,0,IDI_APPLICATION
    mov [wc.hIcon],eax
    invoke  LoadCursor,0,IDC_ARROW
    mov [wc.hCursor],eax
    invoke CreateSolidBrush, 0xFFFFFF  ; ????? ???
    mov [wc.hbrBackground], eax
    invoke  RegisterClass,wc
    test    eax,eax
    jz  error

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question