Click here to Skip to main content
15,888,527 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralRe: Is there anyway to authenticate the COM client? Pin
Stuart Dootson30-Mar-09 11:28
professionalStuart Dootson30-Mar-09 11:28 
GeneralRe: Is there anyway to authenticate the COM client? Pin
lucyh3h31-Mar-09 4:19
lucyh3h31-Mar-09 4:19 
GeneralRe: Is there anyway to authenticate the COM client? Pin
Stuart Dootson31-Mar-09 6:43
professionalStuart Dootson31-Mar-09 6:43 
QuestionIs forward declaration of ATL autogenerated _com_ptr_t possible? Pin
Stone Free26-Mar-09 4:17
Stone Free26-Mar-09 4:17 
AnswerRe: Is forward declaration of ATL autogenerated _com_ptr_t possible? Pin
Stuart Dootson26-Mar-09 4:37
professionalStuart Dootson26-Mar-09 4:37 
GeneralRe: Is forward declaration of ATL autogenerated _com_ptr_t possible? Pin
Stone Free26-Mar-09 5:34
Stone Free26-Mar-09 5:34 
GeneralRe: Is forward declaration of ATL autogenerated _com_ptr_t possible? Pin
Stuart Dootson26-Mar-09 5:49
professionalStuart Dootson26-Mar-09 5:49 
GeneralRe: Is forward declaration of ATL autogenerated _com_ptr_t possible? Pin
Stone Free26-Mar-09 6:57
Stone Free26-Mar-09 6:57 
It works up to a point, but the moment I introduce an accessor function to return a valid COM object the type ITest I get error C2027: use of undefined type 'ITest'

So:

HashImport.h
#pragma once

#include <comdef.h>

struct ITest;
extern const IID ITest_IID;
_COM_SMARTPTR_TYPEDEF(ITest, ITest_IID);

class CHashImport
{
public:
	CHashImport();
	~CHashImport();
	HRESULT GetImpl(ITestPtr &pImpl);
};
</comdef.h>


HashImport.cpp
#include "StdAfx.h"
#include "Hashimport.h"

#import "libid:00020813-0000-0000-C000-000000000046" version("1.6") auto_search no_dual_interfaces rename("DialogBox", "excelDialogBox") rename("RGB", "excelRGB") rename("DocumentProperties", "excelDocumentProperties") rename("SearchPath", "excelSearchPath") rename("CopyFile", "excelCopyFile") rename("ReplaceText", "excelReplaceText")

struct ITest : public Excel::_Application {};

using namespace Excel;

const IID ITest_IID = __uuidof(Excel::_Application);

CHashImport::CHashImport()
{
	ITestPtr ptr;
	GetImpl(ptr);
}

CHashImport::~CHashImport()
{
}


HRESULT CHashImport::GetImpl(ITestPtr &pImpl)
{
	pImpl = ITestPtr(__uuidof(Excel::Application));
	_bstr_t appname = pImpl->GetValue();
	return S_OK;
}


referenceheader.h
#pragma once
#include "hashimport.h"

class CReferenceHeader
{
public:
	CReferenceHeader();
	~CReferenceHeader();
};


referenceheader.cpp
#include "StdAfx.h"
#include "Referenceheader.h"

CReferenceHeader::CReferenceHeader()
{
}

CReferenceHeader::~CReferenceHeader()
{
}


main.cpp
#include "stdafx.h"
#include "hashimport.h"
#import "libid:00020813-0000-0000-C000-000000000046" version("1.6") auto_search no_dual_interfaces rename("DialogBox", "excelDialogBox") rename("RGB", "excelRGB") rename("DocumentProperties", "excelDocumentProperties") rename("SearchPath", "excelSearchPath") rename("CopyFile", "excelCopyFile") rename("ReplaceText", "excelReplaceText")




int _tmain(int argc, _TCHAR* argv[])
{
	::CoInitialize(NULL);
	CHashImport import;
	//ITestPtr pTest;       //error C2027: use of undefined type 'ITest'
	//import.GetImpl(pTest);
//c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\comip.h(822) : error C2227: left of '->Release' must point to class/struct/union


	::CoUninitialize();
	return 0;
}

GeneralRe: Is forward declaration of ATL autogenerated _com_ptr_t possible? Pin
Stuart Dootson26-Mar-09 8:06
professionalStuart Dootson26-Mar-09 8:06 
GeneralRe: Is forward declaration of ATL autogenerated _com_ptr_t possible? Pin
Stone Free8-Apr-09 6:18
Stone Free8-Apr-09 6:18 
GeneralRe: Is forward declaration of ATL autogenerated _com_ptr_t possible? Pin
Stuart Dootson8-Apr-09 8:13
professionalStuart Dootson8-Apr-09 8:13 
Questiona problem in coding modeless dialog with atl Pin
ernst2002053026-Mar-09 4:08
ernst2002053026-Mar-09 4:08 
AnswerRe: a problem in coding modeless dialog with atl Pin
Stuart Dootson26-Mar-09 4:24
professionalStuart Dootson26-Mar-09 4:24 
QuestionC++ client for ATL web service without Soap? Pin
ERLN25-Mar-09 19:07
ERLN25-Mar-09 19:07 
AnswerRe: C++ client for ATL web service without Soap? Pin
Stuart Dootson25-Mar-09 23:25
professionalStuart Dootson25-Mar-09 23:25 
QuestionSTL vector of pointers question Pin
mjackson1125-Mar-09 17:57
mjackson1125-Mar-09 17:57 
AnswerRe: STL vector of pointers question Pin
«_Superman_»25-Mar-09 21:27
professional«_Superman_»25-Mar-09 21:27 
AnswerRe: STL vector of pointers question Pin
Stuart Dootson25-Mar-09 23:34
professionalStuart Dootson25-Mar-09 23:34 
QuestionRe: STL vector of pointers question Pin
«_Superman_»26-Mar-09 2:20
professional«_Superman_»26-Mar-09 2:20 
AnswerRe: STL vector of pointers question Pin
Stuart Dootson26-Mar-09 3:00
professionalStuart Dootson26-Mar-09 3:00 
GeneralRe: STL vector of pointers question Pin
mjackson1126-Mar-09 7:40
mjackson1126-Mar-09 7:40 
GeneralRe: STL vector of pointers question Pin
Stuart Dootson26-Mar-09 8:01
professionalStuart Dootson26-Mar-09 8:01 
GeneralRe: STL vector of pointers question Pin
«_Superman_»26-Mar-09 18:27
professional«_Superman_»26-Mar-09 18:27 
GeneralRe: STL vector of pointers question Pin
Stuart Dootson26-Mar-09 21:20
professionalStuart Dootson26-Mar-09 21:20 
GeneralRe: STL vector of pointers question Pin
«_Superman_»28-Mar-09 18:25
professional«_Superman_»28-Mar-09 18:25 

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.