Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Passing array by reference to Win32API
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00092129
Message ID:
00092158
Vues:
35
>Hello George,
>
>>> bombs out with an error "Type mismatch". Array should be filled with integer
>>> values.
>>What's the API call? Passing a string doesn't work?
>
>UINT GetKeyboardLayoutList(
> int nBuff, // size of buffer in array element
> HKL FAR *lpList // buffer for keyboard layout handles
>
>I defined it as
>
> Declare integer GetKeyboardLayoutList in Win32Api;
>         integer,
>         string @
>
> lcbuffer = space(200)
> lnBuflen = len(lcbuffer)
> lnLayoutCount = GetKeyboardLayoutList(lnBuflen, @lcbuffer)
>
>
>Last statement bombs with an infamous "Performed illegal operation" error. I
>think that I'm doing something wrong < g

Vlad, my friend, you're going to hit yourself over the head and go, "Duh!" with this one. Handles are all DWORDS, right? so:

lnBuflen = LEN(lcbuffer) / 4

I did the same thing with GetTimeZoneInformation(), not realizing that a WHCAR was a UNICODE character (16 bits, not 8). Got exactly the same message. I'd guess that anytime that you (or I) get that infamous message, we'd better loo9k and make sure that all the data types are right.

Kindest Regards,
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform