cvsuser 03/11/24 02:25:34
Modified: . MANIFEST
Added: examples/pni win32api.imc
Log:
win32api
example courtesy of Jonathan Worthington
Revision Changes Path
1.509 +1 -0 parrot/MANIFEST
Index: MANIFEST
===================================================================
RCS file: /cvs/public/parrot/MANIFEST,v
retrieving revision 1.508
retrieving revision 1.509
diff -u -w -r1.508 -r1.509
--- MANIFEST 24 Nov 2003 06:53:33 -0000 1.508
+++ MANIFEST 24 Nov 2003 10:25:32 -0000 1.509
@@ -327,6 +327,7 @@
examples/mops/mops.scheme [main]doc
examples/pni/PQt.C [main]doc
examples/pni/QtHelloWorld.pasm [main]doc
+examples/pni/win32api.imc [main]doc
examples/subs/sub1.imc [main]doc
examples/subs/sub2.imc [main]doc
examples/subs/sub3.imc [main]doc
1.1 parrot/examples/pni/win32api.imc
Index: win32api.imc
===================================================================
# This example calls the MessageBoxA Win32 API using the Parrot Native
# Call Interface. The function is defined as:-
#
# int MessageBox(
# HWND hWnd,
# LPCTSTR lpText,
# LPCTSTR lpCaption,
# UINT uType
# );
# This is the entry point.
.sub _MAIN
# Load user32.dll library and the MessageBoxA API.
.sym var libuser32
.sym var MessageBoxA
loadlib libuser32, "user32"
dlfunc MessageBoxA, libuser32, "MessageBoxA", "llttl"
# Set up parameters for the message box.
.sym int phWnd
.sym string message
.sym string caption
.sym int style
phWnd = 0 # Parent window handle - we have none.
message = "This is a message from Parrot!"
caption = "Hey, you!"
style = 64 # This gives us a nice i in a speech bubble icon.
# Invoke MessageBoxA.
.sym int retVal
.pcc_begin prototyped
.arg phWnd
.arg message
.arg caption
.arg style
.nci_call MessageBoxA
.result retVal
.pcc_end
# That's all, folks.
end
.end