"DefFunction" as Replacement/additional for Prototype
Posted: Tue Jan 03, 2017 1:43 pm
the most used form of prototype ist to create one prototype for one variable.
it would be useful to combine this in one step
for example:
would be
other example:
would be
Maybe a other Keyword would be better. DefType? But this is used in C in a complete diffrent way. Or VariableType? Or UserType?
Don't forget a DefFunctionC and the Global command.
it would be useful to combine this in one step
for example:
Code: Select all
Prototype.i ProtoMessageBoxW(Window.i, Body.p-unicode, Title.p-unicode, Flags.i = 0)
If OpenLibrary(0, "User32.dll")
; 'MsgBox' is a variable with a 'ProtoMessageBoxW' type
MsgBox.ProtoMessageBoxW = GetFunction(0, "MessageBoxW")
MsgBox(0, "Hello", "World") ; We don't specify the flags
EndIf
Code: Select all
If OpenLibrary(0, "User32.dll")
; 'MsgBox' is a variable with a 'ProtoMessageBoxW' type
DefFunction.i MsgBox(Window.i, Body.p-unicode, Title.p-unicode, Flags.i = 0) = GetFunction(0, "MessageBoxW")
MsgBox(0, "Hello", "World") ; We don't specify the flags
EndIf
Code: Select all
Prototype.i ProtoMessageBoxW(Window.i, Body.p-unicode, Title.p-unicode, Flags.i = 0)
Structure API
MsgBox.ProtoMessageBoxw
EndStructure
Code: Select all
Structure API
DefFunction.i MsgBox(Window.i, Body.p-unicode, Title.p-unicode, Flags.i = 0)
EndStructure
Don't forget a DefFunctionC and the Global command.