Click here to Skip to main content
15,914,404 members
Home / Discussions / COM
   

COM

 
QuestionHow can I define packed structure in IDL? Pin
magicast30-Jul-02 22:21
magicast30-Jul-02 22:21 
AnswerRe: How can I define packed structure in IDL? Pin
Mark Janveaux4-Aug-02 20:34
Mark Janveaux4-Aug-02 20:34 
GeneralOLESCRIPT_E_SYNTAX Pin
Roman Nurik30-Jul-02 18:07
Roman Nurik30-Jul-02 18:07 
GeneralATL Problems ??? Ask for help ! Pin
Leesen30-Jul-02 16:06
Leesen30-Jul-02 16:06 
GeneralRe: ATL Problems ??? Ask for help ! Pin
Vi230-Jul-02 20:27
Vi230-Jul-02 20:27 
GeneralRe: ATL Problems ??? Ask for help ! Pin
Leesen31-Jul-02 1:45
Leesen31-Jul-02 1:45 
GeneralRe: ATL Problems ??? Ask for help ! Pin
Vi231-Jul-02 2:48
Vi231-Jul-02 2:48 
GeneralRe: ATL Problems ??? Ask for help ! Pin
Leesen3-Aug-02 22:51
Leesen3-Aug-02 22:51 
Hi, all

Some problems about ATL Com:

1.I have create two ATL Object: CStudent and CTeacher .
The simple source code listed as follow: (some code auto generated by ATL have been skiped)

class CStudent
{
private:
long m_age;
public:
CStudent():m_age(10)
{
}
//...other code auto generated by ATL
};

class CTeacher
{
private:
IStudent* m_aStudent;
public:
CTeacher()
{
//create an instance of the com
CoCreateInstance(CLSID_Student,NULL,CLSCTX_ALL,IID_IStudent, (void**)&m_aStudent);
}
//...other code auto generated by ATL
}

2.Then I add a "IStudent * OneStudent" property for ITeacher ,to access the m_aStudent.
The implemention of the property are listed as below:

STDMETHODIMP CTeacher::get_OneStudent(IStudent *pVal)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())

// TODO: Add your implementation code here
*pVal = * m_aStudent;
return S_OK;
}


STDMETHODIMP CTeacher::put_OneStudent(IStudent *newVal)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())

// TODO: Add your implementation code here
*m_aStudent = *newVal ;
return S_OK;
}

3.Now I type some VB code to test the com ,but some compiler errors occurrs.
VB Code:
Dim s As Student
Dim t As New Teacher
s = t.OneStudent
the last sentence "s = t.OneStudent" have compiler errors.
Errors:function or interface marked as restricted ,or the function use an Automation type not supported in Visual Basic

I guess the errors caused by the type dismatch between IStudnet and CStudent.But I did not know how to resolve it .
So who can tell me how to return the m_aStudent that can be supproted in vb??

thx.

Regards.
GeneralRe: ATL Problems ??? Ask for help ! Pin
Philippe Mori6-Aug-02 13:20
Philippe Mori6-Aug-02 13:20 
Generalcompilation problem with #import Pin
Lily1830-Jul-02 8:49
Lily1830-Jul-02 8:49 
GeneralRe: compilation problem with #import Pin
Gertjan Schuurmans4-Aug-02 3:12
Gertjan Schuurmans4-Aug-02 3:12 
QuestionHow to do this in MFC Pin
Anonymous29-Jul-02 21:03
Anonymous29-Jul-02 21:03 
QuestionHow to Call ComAddin's function from MACRO? Pin
Gheyret29-Jul-02 19:14
Gheyret29-Jul-02 19:14 
GeneralConverting TCHAR to BSTR with ATL Pin
alma29-Jul-02 2:40
alma29-Jul-02 2:40 
GeneralRe: Converting TCHAR to BSTR with ATL Pin
Vi229-Jul-02 2:47
Vi229-Jul-02 2:47 
GeneralRe: Converting TCHAR to BSTR with ATL Pin
alma29-Jul-02 2:59
alma29-Jul-02 2:59 
GeneralRe: Converting TCHAR to BSTR with ATL Pin
Michael Dunn29-Jul-02 21:08
sitebuilderMichael Dunn29-Jul-02 21:08 
GeneralRe: Converting TCHAR to BSTR with ATL Pin
Mark Janveaux4-Aug-02 20:37
Mark Janveaux4-Aug-02 20:37 
GeneralRe: Converting TCHAR to BSTR with ATL Pin
alma4-Aug-02 21:58
alma4-Aug-02 21:58 
GeneralPropertyPage Pin
Naveen_mah29-Jul-02 1:16
Naveen_mah29-Jul-02 1:16 
GeneralImplementing IDispatch::GetIDSOfNames Pin
Alex Cramer28-Jul-02 22:18
Alex Cramer28-Jul-02 22:18 
GeneralRe: Implementing IDispatch::GetIDSOfNames Pin
Vi229-Jul-02 2:53
Vi229-Jul-02 2:53 
GeneralRe: Implementing IDispatch::GetIDSOfNames Pin
Alex Cramer29-Jul-02 17:05
Alex Cramer29-Jul-02 17:05 
GeneralRe: Implementing IDispatch::GetIDSOfNames Pin
Vi229-Jul-02 18:19
Vi229-Jul-02 18:19 
GeneralRe: Implementing IDispatch::GetIDSOfNames Pin
Alex Cramer29-Jul-02 18:48
Alex Cramer29-Jul-02 18:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.