|
-
October 18th, 2002, 10:27 PM
#1
About ActiveX
I construct an ActiveX Control and try to get data from the control thru a function GetData(VARIANT FAR* feature, short FAR* size_of_feature).
Then I apply the control in an exe application program. But now i encounter a problem, that is I can't get data from the function and system error is "Access voilation".
My program section is:
VARIANT f;
short size_f;
my_ctrl.GetData(&f, &size_f);
Pls help me. Thank you.
-
October 19th, 2002, 03:32 AM
#2
First you should state explicitly your parameters as out-parameters in the IDL:
Code:
HRESULT GetData([out] VARIANT* feature, [out] short* sof);
Then you should initialize the variant before passing it to GetData:
Code:
VariantInit(&f);
my_ctrl.GetData(...);
If you still get the access violation there must be a bug inside the GetData-function. Show the code how/where you assign values to the parameters.
-
October 20th, 2002, 07:47 PM
#3
Actually, I wanna get a BYTE type array by the VARIANT variable. In the function GetData(...) I did not allocate for the variable pbVal of the struct VARIANT, so system error happened. Now I correct it.
Thank you very much.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|