All tutorials have many classes and hard find how init Scintilla64.dll and Lexilla.dll
format PE64 GUI 5.0 on 'nul'
entry Start
;FMA work on AMD Ryzen 3500 i na Intel I5 8400 2017 god
macro PrintInt chTxt,chVal { cinvoke sprintf,Status22,chTxt,chVal
invoke MessageBox, 0,Status22, 0, 0 }
return EQU ret
macro Msg chT { invoke MessageBox,0,chT,0,0 }
;macro dbMsg chT { }
include 'C:\fasmw17316\include\win64a.inc'
include 'C:\fasmw17316\INCLUDE\MACRO\STRUCT.INC'
include '2.txt'
;winflgs = WS_VISIBLE + WS_POPUP
;winflgs = WS_VISIBLE + WS_OVERLAPPEDWINDOW
winflgs = WS_CAPTION + WS_SYSMENU + WS_THICKFRAME + WS_MINIMIZEBOX + WS_MAXIMIZEBOX + WS_MAXIMIZE + WS_CLIPCHILDREN
section '.data' data readable writeable executable
WinFlgMod dd winflgs
IntWinParams dd 700,500
BackGroundClr db 34,40,39,0 ;RGBA av 0x00000000 kak ABGR
TextClr db 151,190,255,0 ;RGBA
FaceName db "Arial",0 ;Courier New
dd 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
msg MSG
hwnd dq 0
wc WNDCLASSEX sizeof.WNDCLASSEX,0,WindowProc,0,0,NULL,NULL,NULL,COLOR_BTNFACE+1,NULL,_class,NULL
_class db 'Scintilla',0
_title db 'Scintilla',0
pu dq 0,SCI_GETDIRECTFUNCTION,0,0
section '.code' code readable writeable executable
tmpfun dq 0
tmpAa dq 4033
;GetLexerName dq 0
;CreateLexer dq 0
Start:
sub rsp,8
;create window
invoke GetModuleHandle,0
mov [wc.hInstance],rax
invoke LoadIcon,0,IDI_APPLICATION
mov [wc.style],CS_HREDRAW or CS_VREDRAW
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
;direct2D draw i v WS_EX_NOREDIRECTIONBITMAP = 0 !
WS_EX_NOREDIRECTIONBITMAP = 0;x00200000 ;this only Win8.1\Win 10
WS_EX_COMPOSITED = 0x02000000 ;WS_EX_TRANSPARENT
invoke CreateWindowEx,WS_EX_NOREDIRECTIONBITMAP,_class,_title,dword [WinFlgMod],0,0,dword [IntWinParams],dword [IntWinParams+4],NULL,NULL,[wc.hInstance],NULL
mov [hwnd],rax
test rax,rax
jz error
invoke ShowWindow,rax,1
;init Scintilla
ziii2:
SCI_SETILEXER = 4033 ;GetDirectFunction=2184
invoke CreateLexer,'cpp' ;ok ret eax,rdx
mov [tmpAa],rax
;mov rax,-2;SCI_SETILEXER
;add rdx,rax
mov [tmpfun],rdx ;rdx ?
mov rcx,tmpAa
invoke tmpfun,4033,0,0 ;this crash
;Scintilla_DirectFunction show IDA pro function code:
;mov rax, [rcx]
;jmp qword ptr [rax+210h]
invoke Scintilla_DirectFunction,tmpfun ;this crash
Backzz1:
invoke PeekMessage,msg, 0, 0, 0, PM_REMOVE
test eax,eax
jz .2
invoke TranslateMessage, msg
invoke DispatchMessage, msg
.2: invoke Sleep,40
cmp byte [FocusWinLost],0
jz .render ;if no sleep,10 fps:35000 Ryzen 3500 !
invoke Sleep,40
;Msg 'lost'
jmp .norender
.render:
.norender:
.norenderZ:
cmp [CloseWin],1
jnz Backzz1
error:
invoke MessageBox,0,'End',0,0
invoke ExitProcess, 0
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],rdx
mov [wparam],r8
mov [lparam],r9
cmp edx,WM_CREATE
jnz .rr
ret
.rr:
cmp edx,WM_KILLFOCUS
jnz .0
mov byte [FocusWinLost],1
ret
.0: cmp edx,WM_SETFOCUS
jnz .0b
mov byte [FocusWinLost],0
ret
.0b:
rept 0 {
cmp edx, WM_PAINT
jnz .1
invoke BeginPaint,[hwnd], ps ;*=mozno bez
;Win32Application.cpp bez BeginPaint
;v DX12 Win 7 delali tut OnRender();
;rizsovali kogda win resize\move\unhide
invoke EndPaint,[hwnd], ps ;*
ret
.1:
}
;KeyPr
cmp edx, WM_KEYDOWN
cmp [wparam],VK_ESCAPE
jz .wmdestroy
;jnz .zznoescp
jnz .4
mov eax,dword [wparam]
mov dword [KeyPr],eax
ret
.4:
cmp edx, WM_LBUTTONDOWN
jnz .02
mov [mous_btn],1
;invoke MessageBox,0,'ok',0,0
ret
.02: cmp edx, WM_LBUTTONUP
jnz .03
mov [mous_btn],0
ret
.03: cmp edx, WM_RBUTTONDOWN
jnz .02b
mov [mous_rbtn],1
;invoke MessageBox,0,'ok',0,0
ret
.02b: cmp edx, WM_RBUTTONUP
jnz .03b
mov [mous_rbtn],0
ret
.03b:
;mouse wheel
cmp edx, WM_MOUSEWHEEL
jnz .2
mov ax,word [wparam+2]
test ax,ax
jl .WheelDwn
mov byte [MousWheel], 1 ;Mous koleso krutili v pered
ret
.WheelDwn:
mov byte [MousWheel], 2 ;Mous koleso krutili nazad
ret
.2:
cmp edx,WM_DESTROY
je .wmdestroy
.defwndproc:
invoke DefWindowProc,[hwnd],[wmsg],[wparam],[lparam]
jmp .finish
.wmdestroy:
;invoke PostQuitMessage,dword 0 ;bugi i net exit Msg-a !
mov [CloseWin],1
xor eax,eax
.finish:
ret
mous_btn db 0
mous_rbtn db 0
FocusWinLost db 0
KeyPr dd 0
ps dq 0,0,0,0
CloseWin db 0
MousWheel db 0
endp
section '.bss' readable writeable
Status22 rb 10000
section '.idata' import data readable writeable executable
library msvcrt,'MSVCRT.DLL',\
kernel32,'KERNEL32.DLL',\
user32,'USER32.DLL',\
gdi32,'GDI32.DLL',\
comctl32,'COMCTL32.DLL',\
D2gui, 'D2GUI.DLL',\
MFPlay, 'MFPlay.DLL',\
lexer, 'Lexilla.dll',\
Scintilla, 'Scintilla64.dll',\
winmm, 'WINMM.DLL'
import Scintilla,\
GetStringTypeW,'GetStringTypeW',\
Scintilla_DirectFunction,'Scintilla_DirectFunction'
import lexer,\
LexerNameFromID, 'LexerNameFromID',\
GetLexerFactory, 'GetLexerFactory',\
GetLibraryPropertyNames,'GetLibraryPropertyNames',\
SetLibraryProperty, 'SetLibraryProperty',\
GetNameSpace, 'GetNameSpace',\
GetLexerCount, 'GetLexerCount',\
GetLexerName, 'GetLexerName',\
CreateLexer, 'CreateLexer'
include 'c:\fasmAPI\msvcrt.inc'
include 'c:\fasmAPI\kernel32.inc'
include 'c:\fasmAPI\gdi32.inc'
include 'c:\fasmAPI\user32.inc'
include 'c:\fasmAPI\comctl32.inc'
include 'C:\FasmAPI\winmm.inc'