Click here to Skip to main content
16,005,038 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Training Project for C++ Pin
Roman Nurik30-Jul-02 19:09
Roman Nurik30-Jul-02 19:09 
GeneralTraining Project for C++ Pin
onn30-Jul-02 16:14
onn30-Jul-02 16:14 
GeneralRe: Training Project for C++ Pin
Raskolnikov30-Jul-02 17:03
Raskolnikov30-Jul-02 17:03 
GeneralSome ATL Problems ?? Ask for help Pin
Leesen30-Jul-02 16:04
Leesen30-Jul-02 16:04 
GeneralRe: Some ATL Problems ?? Ask for help Pin
Dudi Avramov30-Jul-02 22:24
Dudi Avramov30-Jul-02 22:24 
GeneralRe: Some ATL Problems ?? Ask for help Pin
Leesen31-Jul-02 1:50
Leesen31-Jul-02 1:50 
GeneralRe: Some ATL Problems ?? Ask for help Pin
Dudi Avramov1-Aug-02 0:24
Dudi Avramov1-Aug-02 0:24 
GeneralRe: Some ATL Problems ?? Ask for help Pin
Leesen3-Aug-02 22:57
Leesen3-Aug-02 22:57 
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: Some ATL Problems ?? Ask for help Pin
Dudi Avramov4-Aug-02 2:48
Dudi Avramov4-Aug-02 2:48 
Generalvery basic questions about databases and MFC Pin
nss30-Jul-02 15:41
nss30-Jul-02 15:41 
GeneralRe: very basic questions about databases and MFC Pin
Michael P Butler31-Jul-02 0:11
Michael P Butler31-Jul-02 0:11 
GeneralRe: very basic questions about databases and MFC Pin
ns31-Jul-02 6:27
ns31-Jul-02 6:27 
GeneralUsing HTMLHelp from MFC Pin
Dov Sherman30-Jul-02 15:37
Dov Sherman30-Jul-02 15:37 
Questionhelp! isapi can op a session? Pin
redlittlebear30-Jul-02 15:34
redlittlebear30-Jul-02 15:34 
AnswerRe: help! isapi can op a session? Pin
jan larsen31-Jul-02 3:07
jan larsen31-Jul-02 3:07 
QuestionGuys, I must resolve this! plz: Get HWND from HINSTANCE, Is it possible? Pin
BlackSmith30-Jul-02 14:27
BlackSmith30-Jul-02 14:27 
AnswerRe: Guys, I must resolve this! plz: Get HWND from HINSTANCE, Is it possible? Pin
Nish Nishant30-Jul-02 15:12
sitebuilderNish Nishant30-Jul-02 15:12 
GeneralRe: Guys, I must resolve this! plz: Get HWND from HINSTANCE, Is it possible? Pin
BlackSmith30-Jul-02 23:54
BlackSmith30-Jul-02 23:54 
GeneralRe: Guys, I must resolve this! plz: Get HWND from HINSTANCE, Is it possible? Pin
Nish Nishant31-Jul-02 0:01
sitebuilderNish Nishant31-Jul-02 0:01 
GeneralNew to MFC and have a few questions. Pin
Raskolnikov30-Jul-02 13:08
Raskolnikov30-Jul-02 13:08 
GeneralRe: New to MFC and have a few questions. Pin
Jay Beckert30-Jul-02 14:19
Jay Beckert30-Jul-02 14:19 
GeneralRe: New to MFC and have a few questions. Pin
Raskolnikov30-Jul-02 15:37
Raskolnikov30-Jul-02 15:37 
GeneralRe: New to MFC and have a few questions. Pin
Shog930-Jul-02 14:21
sitebuilderShog930-Jul-02 14:21 
GeneralRe: New to MFC and have a few questions. Pin
Raskolnikov30-Jul-02 15:38
Raskolnikov30-Jul-02 15:38 
GeneralRe: New to MFC and have a few questions. Pin
Shog930-Jul-02 15:39
sitebuilderShog930-Jul-02 15:39 

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.