L scripting language invoke operating system API

Source: Internet
Author: User

The scripting language supports direct invocation of the C-language API functions provided by the operating system to ensure greater flexibility

Currently, only C-language functions with function calling conventions of __stdcall are supported

The C language variable and the L scripting language object is not a one by one corresponding relationship, so when you call a C function, you cannot directly pass the L script language object as a parameter, but you can make the appropriate conversion

The following is a call to Windows system Kernel32.dll in the OUTPUTDEBUGSTRINGW function and

An example of calling the MessageBoxW function in User32.dll

and encapsulates it as a global function of the L scripting language


#scplib
Definition: String, Kernel32,c:\windows\system32\kernel32.dll
Definition: C function, Myoutputdebugstringw,kernel32,outputdebugstringw, none, c wide character pointer

Definitions: Functions, output debugging information, debug messages
Start: function, output debugging information

definition: C wide character pointer, parameter 1, debug message

Call: C function, Myoutputdebugstringw, none, Parameter 1

End: function, output debug information

Register: function, output debug information


#scplib

Definition: String, User32,c:\windows\system32\user32.dll

Definition: c function, Mymessageboxw,user32,messageboxw,c Integer, handle, C wide character pointer, c wide character pointer, c unsigned integer
Definitions: Functions, pop-up windows, titles, content
Start: Functions, pop-up windows

Definition: Handle, parameter 1,0

Definition: C wide character pointer, parameter 2, content

Definition: C wide character pointer, parameter 3, caption

Definition: c unsigned integer, parameter 4,0

Definition: C integer, return value, 0

Call: C function, Mymessageboxw, return value, Parameter 1, parameter 2, parameter 3, parameter 4

End: function, pop-up window

Registration: Functions, pop-up windows


#scp
Import: library, H:\SCRIPTENGINE\SCRIPTS\KERNEL32LIB.SCP
Import: library, H:\SCRIPTENGINE\SCRIPTS\USER32LIB.SCP

Definition: String, debug information, "Hellodebugmessage"
Definition: String, dbgstring, "ABCD"

Output Debug Information: Debug information
Output Debug Information: dbgstring

Definition: string, string1, hello Programmer
Definition: String, string2, title

Pop-up window: string2,string1

L scripting language invoke operating system API

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.