It is currently Thu Oct 24, 2019 5:10 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: [Imports & Prototypes]Example codes assume Ascii compiles?
PostPosted: Wed Jan 16, 2019 7:36 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Dec 23, 2009 10:14 pm
Posts: 3089
Location: Boston, MA
FROM
Code:
Prototype.i ProtoMessageBox(Window.i, Body$, Title$, Flags.i = 0)
If OpenLibrary(0, "User32.dll")
  ; 'MsgBox' is a variable with a 'ProtoMessageBox' type
  ;
  MsgBox.ProtoMessageBox = GetFunction(0, "MessageBoxA")
  MsgBox(0, "Hello", "World") ; We don't specify the flags
EndIf
; We use the 'p-unicode' pseudotype for the string parameters, as
; MessageBoxW() is an unicode only function. The compiler will
; automatically converts the strings to unicode when needed.
;
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

TO
Code:
; We use the 'p-ascii' pseudotype for the string parameters, as
; MessageBoxA() is an ascii only function. The compiler will
; automatically convert the strings to ascii when needed.
;
Prototype.i ProtoMessageBoxA(Window.i, Body.p-ascii, Title.p-ascii, Flags.i = 0)
If OpenLibrary(0, "User32.dll")
  ; 'MsgBoxA' is a variable with a 'ProtoMessageBoxA' type
  ;
  MsgBoxA.ProtoMessageBoxA = GetFunction(0, "MessageBoxA")
  MsgBoxA(0, "Hello", "World_Ascii") ; We don't specify the flags
EndIf
Prototype.i ProtoMessageBoxW(Window.i, Body$, Title$, 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_Wide") ; We don't specify the flags
EndIf

_________________
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye