Explaining it better... Lack of information is a big problem... Even more for someone who´s in doubt on (or wants to learn) something...
("dllname","functionFromDll","[parameters]","returntype")
"dllname" is a string and holds the name of the DLL you want to use. Note that the DLL must be inside your Game folder or Windows/System folder, or else you must declare a complete path to access it.
"functionfromdll" is a string and holds the name of the function from that DLL that you´ll call when you execute the Win32API object. Note that each Win32API object can handle only one function from one DLL.
[parameters] is an array and holds all the parameters needed to call that function. Note that you must respect all the function´s parameters and elements´ values types. This array contains ONLY strings, and each string holds only ONE letter. There´s no limits for the array´s size, this limit is given by the function. Ther´re sets of letters to be used, and each one represents one type of object that must be passed when calling the function. Some letters taht i remember now...
'n' = Numeric
'i' = Integer
'l' = String
'p' = Pointer (memory address, i don´t know exactly how to use it though ^^)
The letters sets are case-insensitive, so that way l = L, i = I, and so on...
Just this... Check the Ruby documentation to see more letters
For example, ['i', 'l'] defines that "functionfromdll" has two arguments that must be passed, being the first an integer and the second a string.
"returntype" is a string and defines the type of the return value by the function call. It uses exactly the same letters used in [parameters]. An empty string can suggest that the return value can be anything (or nothing).
For example, 'i' denotes the fact that the "functionfromdll" will return an integer when called.
Now, take the example given by Prexus...
Prexus":2y4n5psr said:
@proc = Win32API.new('kernel32', 'GetCurrentProcess', [], 'i').call
@pri = Win32API.new('kernel32', 'SetPriorityClass', ['p', 'i'], 'i')
@pri.call(@proc, 0x00000080)
The first line is a call to the function GetCurrentProcess from the kernel32.dll (that is inside the Windows/System folder). It has no arguments and returns an integer. The second line is the creation of a new Win32API object, that when called will execute the function SetPriorityClass from the kernel32.dll, requiring two arguments (a pointer and an integer), and will return an integer. In the third line the Win32API object is called (the function contained in @pri is executed). It passes the pointer (that will be the @proc´s returning value) and an integer (in an hexadecimal format).
If i´m wrong in anything please someone correct me. I´m somehow new to the Win32API, and i was in such a hurry, without any reference (all of that i took from my mind, and since it´s a little bit messy... xD)