Click here to Skip to main content
15,920,053 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: simple question in Vc Pin
jmkhael4-Aug-02 10:16
jmkhael4-Aug-02 10:16 
Generalframeless documents and saving custom documents Pin
Chi Ling4-Aug-02 3:17
sussChi Ling4-Aug-02 3:17 
GeneralSending and receiving files trought CAsyncSocket derived class Pin
fdmanana4-Aug-02 2:28
fdmanana4-Aug-02 2:28 
GeneralRe: Sending and receiving files trought CAsyncSocket derived class Pin
Imran Farooqui4-Aug-02 3:04
Imran Farooqui4-Aug-02 3:04 
GeneralRe: Sending and receiving files trought CAsyncSocket derived class Pin
Masaaki Onishi4-Aug-02 7:18
Masaaki Onishi4-Aug-02 7:18 
QuestionCRDBMS??? Pin
alex.barylski4-Aug-02 2:18
alex.barylski4-Aug-02 2:18 
AnswerRe: CRDBMS??? Pin
Pavel Klocek4-Aug-02 6:54
Pavel Klocek4-Aug-02 6:54 
QuestionATL Problems ? Pin
Leesen3-Aug-02 22:56
Leesen3-Aug-02 22:56 
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.
AnswerRe: ATL Problems ? Pin
Christian Graus3-Aug-02 23:07
protectorChristian Graus3-Aug-02 23:07 
GeneralRe: ATL Problems ? Pin
Leesen3-Aug-02 23:39
Leesen3-Aug-02 23:39 
AnswerRe: ATL Problems ? Pin
Michael P Butler4-Aug-02 2:40
Michael P Butler4-Aug-02 2:40 
AnswerRe: ATL Problems ? Pin
Philippe Mori5-Aug-02 8:15
Philippe Mori5-Aug-02 8:15 
GeneralADO in console App Pin
Virtual Destructor3-Aug-02 22:02
Virtual Destructor3-Aug-02 22:02 
GeneralRe: ADO in console App Pin
Michael P Butler3-Aug-02 23:46
Michael P Butler3-Aug-02 23:46 
QuestionHow can i know if the desktop windows Z order has been changed Pin
adara3-Aug-02 20:34
adara3-Aug-02 20:34 
GeneralCommand Line arguments Pin
CaLvin Tan3-Aug-02 19:28
CaLvin Tan3-Aug-02 19:28 
GeneralRe: Command Line arguments Pin
Michael Dunn3-Aug-02 20:13
sitebuilderMichael Dunn3-Aug-02 20:13 
QuestionHow to draw shadow of sphere and line Pin
dark-gura3-Aug-02 18:52
dark-gura3-Aug-02 18:52 
Question(Cloning) How do I enable "Multiple Instance" in a C++ app? Pin
BaByBoI3-Aug-02 18:51
sussBaByBoI3-Aug-02 18:51 
AnswerRe: (Cloning) How do I enable "Multiple Instance" in a C++ app? Pin
Ravi Bhavnani3-Aug-02 20:56
professionalRavi Bhavnani3-Aug-02 20:56 
AnswerRe: (Cloning) How do I enable "Multiple Instance" in a C++ app? Pin
Daniel Lohmann5-Aug-02 7:20
Daniel Lohmann5-Aug-02 7:20 
Questionhow does script engine in IE work ? Pin
Anonymous3-Aug-02 18:39
Anonymous3-Aug-02 18:39 
GeneralHELP! My Visual C++ 6.0 could not find Iphlpapi.h Pin
Anonymous3-Aug-02 18:26
Anonymous3-Aug-02 18:26 
GeneralRe: HELP! My Visual C++ 6.0 could not find Iphlpapi.h Pin
adara3-Aug-02 19:02
adara3-Aug-02 19:02 
GeneralRe: Could not download Update Platform SDK Pin
ATC9-Aug-02 4:50
ATC9-Aug-02 4:50 

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.