Re: how to add pointer to struct as a parameter in the automation VC
From: Grace (anonymous_at_discussions.microsoft.com)
Date: 03/03/04
- Next message: David: "Re: Visual C++ .NET"
- Previous message: Michael Viking: "Re: Visual C++ .NET"
- In reply to: David: "Re: how to add pointer to struct as a parameter in the automation VC"
- Next in thread: Grace: "Re: how to add pointer to struct as a parameter in the automation VC"
- Reply: Grace: "Re: how to add pointer to struct as a parameter in the automation VC"
- Reply: David: "Re: how to add pointer to struct as a parameter in the automation VC"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 2 Mar 2004 20:21:10 -0800
Thanks David,
I'm a new user of VC and not quite familiar with the odl. I add typedef struct as follow:
[ uuid(891E5A48-D21F-48AB-8721-0821677ADB7B), version(1.0),
helpfile("ABC.hlp"),
helpstring("ABC ActiveX Control module"),
control ]
library ABCLib
{
importlib(STDOLE_TLB);
importlib(STDTYPE_TLB);
//added these 2 structures
typedef struct ABC_SENDDATA_T {
FILETIME ft;
WORD wType;
DWORD dwTransaction_id;
int iAmount;
} ABC_SENDDATA, *LPABC_SENDDATA;
typedef struct ABC_RECEIVE_T {
WORD wReturnType;
char cVersion[10];
WORD wType;
char cCardName[20];
int dBalPrepaid;
int dAmount;
DWORD dwTransaction_id;
} ABC_RECEIVE, *LPABC_RECEIVE;
// Primary dispatch interface for CIBonusCtrl
But it didn't compile and ask for id, however, how could I use the above structure as the parameter of a method of automation?
Actually, I want to create a method in ocx, like Method(ABC_SENDDATA *p, ABC_RECEIVE *r)
If as you said, create an interface to put the variables of the struct as the properties, say, dllexport a number of function and these functions are only store the values of the variables, Do I need to set the variables as Global so that it's value won't loss after the client call to set the value?
like ABC->ft = Now ; ABC->wType = 1; ABC->dwTransaction_id = 1; ABC->iAmount = 1; //ABC is a ocx component.
Where ft, wType, dwTransaction_id and iAmount are all global variables in the dll.
But I think once the client call, ABC->ft = Now, the dll is quit and finished, so the "Now" wouldn't be stored in the "ft" variables after this call.
Sorry, I know the above is a bit messy but I'm quite confused about the using of pointer to structure in the automation. It'll be great to see any sample coding or reference.
Best regards,
Grace
- Next message: David: "Re: Visual C++ .NET"
- Previous message: Michael Viking: "Re: Visual C++ .NET"
- In reply to: David: "Re: how to add pointer to struct as a parameter in the automation VC"
- Next in thread: Grace: "Re: how to add pointer to struct as a parameter in the automation VC"
- Reply: Grace: "Re: how to add pointer to struct as a parameter in the automation VC"
- Reply: David: "Re: how to add pointer to struct as a parameter in the automation VC"
- Messages sorted by: [ date ] [ thread ]