[Gambas-user] gb.api ApiStruct

gambas at ...1077... gambas at ...1077...
Thu Aug 11 18:16:28 CEST 2005


Hello everyone! 
 
I am new to Gambas and only have some experience in VB. I am trying to use 
the ApiStruct function from the gb.api Component. I am running version 1.9.13 
 
Following the instructions from the (old) manual. Here is the source code 
I am using: 
 
PUBLIC SUB Button1_Click() 
 
DIM stData AS ApiStruct 
DIM hPointer AS Pointer 
 
stData = NEW ApiStruct(["gen_id", "n_count", "str"], [Api.short, Api.int, 
Api.pointer]) 
 
hPointer = Alloc(stData.Size) 
 
 
stData.PutValue(hPointer, "gen_id", 23) 
stData.PutValue(hPointer, "n_count", 257) 
stData.PutValue(hPointer, "str", "my data") 
 
PRINT stData.GetValue(hPointer, "gen_id") 
 
END 
 
When I execute the event I get the following error message: 
 
                 Invalid field type 
 
in the  
stData = NEW ApiStruct(["gen_id", "n_count", "str"], [Api.short, Api.int, 
Api.pointer]) 
 
line. 
I tried all kinds of things but nothing seems to work. The same code worked in 
version 1.9.11 as long as I did not use the "str" Api.Pointer variable. 
Please help!! 
Also, does anybody know were I could find more documentation for this 
Component. 
 
Thanks!! 
 
Alex 
 
 




More information about the User mailing list