I'm having problems passing variables to an API function. I always receive a Type mismatch error. I reproduced the situation in Visual Basic and found that if I used type-declaration characters to declare the problem variables, they were compatible with the API function. So now, I have it working in Visual Basic, but not yet in Delphi. Are there type-declaration characters or something equivalent in Delphi? Here is a sample of my VB code:
'The following vars must be declared with a
'type-declaration character, 'else Type mismatch '(why?...I have
a hunch that using 'As String'
'assigns a NULL value, where 'var$' actually 'assigns an empty
Dim desc$, dt$, con$, fn$, own$, v6$ 'strings
Dim fo%, mt% 'integers
The problem doesn't lie in the API itself, but in Delphi's wrapper of the API call. What you need to do in addition to looking at the online help is to look at the Delphi source code for the call. Once you see how the call is prototyped, you can pass the appropriate types to it. It takes a lot of the guesswork out of calling API functions.