Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to create a data structure (having C/C++ compatibility) in VFP7?

Status
Not open for further replies.

wcglorioso

Programmer
Jul 23, 2003
30
PH
This is in relation to Thread184-746749 (How to create a class with only the properties & methods you specify?).

I would like to initialize the properties UserData and UserDataHeader so that its data type would not be considered undefined in VFP7. Below is their entry in the IDL of a COM server:

[propget, helpstring("property UserData")]
HRESULT _stdcall UserData(
[in] long index,
[out, retval] unsigned char* pVal);
[propput, helpstring("property UserData")]
HRESULT _stdcall UserData(
[in] long index,
[in] unsigned char pVal);
[propget, helpstring("property UserDataHeader")]
HRESULT _stdcall UserDataHeader(
[in] long index,
[out, retval] unsigned char* pVal);
[propput, helpstring("property UserDataHeader")]
HRESULT _stdcall UserDataHeader(
[in] long index,
[in] unsigned char pVal);

I need to declare a data structure with two elements (index and pVal) which would satisfy the above declaration in the IDL.

I will be assigning it to the said properties of the resulting COM object as in (please note the lines of code in between the numbered line [16] and [17]):

[01] * VISUAL FOXPRO TRANSLATION(WITH ERROR 1440)
[02] LOCAL objSMS As SMS3ASuiteLib.SMS_SuiteAdapter
[03] LOCAL objMess As SMS3ASuiteLib.ShortMessage
[04]
[05] LOCAL CellNum
[06] LOCAL TextMesg
[07]
[08] CellNum = '353863982273'
[09] TextMesg = 'TESTING NOKIA DATA SUITE'
[10]
[11] If Len(CellNum) # 0 And Len(TextMesg) # 0
[12] objSMS = CREATEOBJECTEX('SMSAdapter.SMSAdapter.1','','')
[13a] objMess = .NULL. && objMess is initially a boolean with value = .F.
[13b] objSMS.CreateShortMsg(@objMess)
[14]
[15] objMess.UserDataText = TextMesg
[16] objMess.OtherEndAddress = CellNum

local datastruc1,datastruc2
datastruc1=XXX
objMess.UserData=datastruc1
datastruc2=YYY
objMess.UserDataHeader=datastruc1
[17]
[18] objSMS.Send(objMess)
[19]
[20] objMess = .NULL.
[21] objSMS.Terminate
[22] objSMS = .NULL.
[23] Else
[24] If Len(CellNum) = 0 Then
[25]
[26] MessageBox("No Phone number has been entered, please enter in a phone number.", ;
[27] 48 + 0, ;
[28] "Error Management System"
[29]
[30] EndIf
[31]
[32] If Len(TextMesg) = 0
[33]
[34] MessageBox("No message exists, please enter in a message.", ;
[35] 48 + 0, ;
[36] "Error Management System"
[37]
[38] EndIf
[39]
[40] EndIf

I do not know how to create the datastruc1 and datastruc1 variables to assign to objMess.UserData and objMess.UserDataHeader to make its data type accepted by VFP7 as not being undefined.

In VB6, it seems it is not required because the properties UserData and UserDataHeader may have been properly evaluated by VB6.

I am striving to use VFP7 instead of VB6 in all my applications for consistency and familiarity.

Thanks for any help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top