|

the software that grows
with you
| |
|
V32DllCall()
|
| Calls a Windows Dll function with or
without parameters. |
|
Syntax
|
| V32DllCall( <cDllName>,
<cFunction>, <nFlags>, <nRetVal>, <aParam>, <lWantInfo> ) |
|
Arguments
|
| cDllName |
Name of the Windows specific .Dll file. Name can
consists of drive and path information but it is optional. Even .Dll
can also be omitted. Simple 'WINMM' or 'c:\windows\system\winmm.dll'
will do. Note that the Dll being called must be available in a
direcory pointed to by PATH statement in the Autoexec.bat. |
| cFunction |
Character string representing the function to be
called from the <cDllName>. <cFunction> is case
sensitive, and this property is very important. Windows DLL files
adhere to the case sensitive calling convention, so please be
careful. 'sndPlaySoundA' is not the same as 'SndPlaySoundA'. The
function will fail if <cFunction> will not match the exact
characters of the function name in the <cDllName>. |
| nFlag |
Numeric to indicate what type of Dll call
is made. Default is DLL_CALL_STD. For the time being keep this
parameter nil. |
| nRetVal |
Numeric to indicate of what type the
return value of called function will be. At present it is not active
and is reserved for future usage, you always keep this parameter
nil. See below for possible return values. |
| aParam |
An array of parameters to be passed to the function.
The number of parameters are limited to 10 at present, sufficient
for practically any function. However, if you feel some functions
may require more parameters, let me know. Default is empty array.
<aParam> must arrange the parameters in type of
parameter and the parameter itself in ascending
order, e.g., { nType, uParam, nType1, uParam1, ..., nType10,
uParam10 }
nType can be one of the following values:
| CTYPE_CHAR |
BYTE |
1 |
| CTYPE_CHAR_POINTER |
LPTSTR, LPSTR,
LPCSTR, LPCTSTR |
10 |
| CTYPE_UNSIGNED_CHAR |
TCHAR, char, BCHAR,
UCHAR |
-1 |
| CTYPE_SHORT |
SHORT |
2 |
| CTYPE_UNSIGNED_SHORT |
USHORT, WCHAR, WORD |
-2 |
| CTYPE_INT |
INT |
3 |
| CTYPE_UNSIGNED_INT |
UINT |
-3 |
| CTYPE_LONG |
LONG |
4 |
| CTYPE_UNSIGNED_LONG |
ULONG, DWORD, HANDLE,
HICON, HBITMAP, HCURSOR, HBRUSH, COLORREF, HINSTANCE, HWND,
HGLOBAL, HKEY |
-4 |
| CTYPE_FLOAT |
FLOAT |
5 |
| CTYPE_DOUBLE |
DOUBLE |
6 |
| CTYPE_VOID |
VOID |
7 |
| CTYPE_BOOL |
BOOL |
8 |
The ordinal position of all the parameters must match exactly the
parameters defined in the function in <cDllName>. If some
parameter falls in between and its value is nil, you must pass
<aParam> with nil assigned to that element.
|
| lWantInfo |
Logical to instruct Vouch32 to return error code or
some other value from the Dll function called. Default is FALSE. If
set to TRUE, then application will wait until the execution of
function called is not over and some expected value is returned.
Then the return value of Dll function will be passed back to
application as a single dimentional array. Otherwise control will
return back to application immediately and the called function will
continue to run in the background. |
|
|
Returns
|
| xValue if <lWantInfo> is TRUE
otherwise NIL. |
|
Description
|
| V32CallDll() is a function to execuate
some function from the Windows Dll files. It overcomes the boundries of 16
bit applications and empowers the developers with seamless integration
with Windows. Though I could not test, and even this is not possible, more
that a couple of Dll calls, but hope that it will work in all
circumstances.
At present plain parameters of type above
discussed are supported. Parameters requiring structures are not supported
yet.
|
|
Usage
|
| Local aParam, cFunction, cDllName,
lWantInfo
cDllName := 'WINMM'
cFunction := 'sndPlaySoundA'
aParam := { 10, 'C:\Music\MyMusic.wav', -3, 0 }
lWantInfo := .f.
// { 10, cWaveFile, -3, 0 )
// 10 = CTYPE_CHAR_POINTER and -3 = CTYPE_UNSIGHNED_INTEGER
V32DllCall( cDllName, cFunction, /* nFlags */, /* nRetVal */, aParam, lWantInfo )
|
|
Tips
|
Can not say in what way it will be used.
If helpful to you, please forward me the function name, dll name, the
parameters, so that I could include those under this head and let it be
more useful to others as well.
|
|