> I'd like to create another tutorial in the Purebasic Inline Assembly
> tutorial that deals with opening a Window titled Hello World in Purebasic
> Inline assembly code.
> Does anyone know how to create a simple window in Purebasic Inline
> assembly using pure assembly?
So, you are basically telling us, that you want to write a tutorial, about
something you don't know how to do it, and you want us to explain it to
you?
Well, why don't we just write that tutorial ourselves then?
I don't get the point anyway, why do you want to create a window with
InlineASM? Why make things complicated, when there is such an easy
to use Window management in PB ?
The point of InlineASM in PB was never to do GUI programming with it,
but more to do some tricks & optimisations in the code.
Anyway, I was thinking about helping... Although I didn't know the answer
myself, I would have searched for it, but after reading your replies to
BalrogSoft and Fred, I don't really think it is worth it anymore.
> As it stands, it appears that not enough functionality exists in Purebasic > Inline Assembly to allow for the creation of a Window.
But hey, just to make the point... here you go:
Code: Select all
!extrn _CreateWindowExA@48
!extrn _DefWindowProcA@16
!extrn _RegisterClassA@4
; comment these 3 out if you use the debugger!!
!extrn _GetMessageA@16
!extrn _TranslateMessage@4
!extrn _DispatchMessageA@4
Procedure.l Callback(Window.l, Message.l, wParam.l, lParam.l)
MOV ebx, [esp+4]
CMP ebx, #WM_CLOSE
JE l_ProgramEnd
CALL _DefWindowProcA@16
SUB esp, 16
ProcedureReturn
EndProcedure
#styles = #WS_CAPTION|#WS_SYSMENU|#WS_VISIBLE
class.WNDCLASS
message.MSG
MOV dword [v_class+4], _Procedure0
MOV dword [v_class+16], PB_Instance
MOV dword [v_class+28], #COLOR_BTNFACE
ADD dword [v_class+28], 1
MOV dword [v_class+36], l_classname
PUSH v_class
CALL _RegisterClassA@4
PUSH dword 0
PUSH PB_Instance
PUSH dword 0
PUSH dword 0
PUSH dword 200
PUSH dword 400
PUSH dword 100
PUSH dword 100
PUSH #styles
PUSH l_title
PUSH l_classname
PUSH dword 0
CALL _CreateWindowExA@48
StartLoop:
PUSH dword 0
PUSH dword 0
PUSH dword 0
PUSH v_message
CALL _GetMessageA@16
PUSH v_message
CALL _TranslateMessage@4
PUSH v_message
CALL _DispatchMessageA@4
JMP l_StartLoop
ProgramEnd:
End
DataSection
classname: Data.s "PureBasic TestClass"
title: Data.s "Hello World"
EndDataSection
So tell me, what is it that PB is missing that makes it inpossible to do?
> I'm pulling my support from your Purebasic community.
Well, if what I read here in this post (and some others as well) is what
you call "my support from your Purebasic community", then !please!
pull that away.
Good bye then...
Timo