Unable to instantiate dynamically the PDFXCview ActiveX

The PDF-XChange Viewer for End Users
+++ FREE +++

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Paul - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

ciroettorre
User
Posts: 25
Joined: Tue Dec 30, 2008 9:59 am

Unable to instantiate dynamically the PDFXCview ActiveX

Post by ciroettorre »

VC++ VS2005 sp1 / XP32

I am attempting to instantiate the PDFXCview ActiveX dynamically, in a generic window, but I get always the E_UNEXPECTED error from any call to the control.
The following is a snap-shot of the code I am currently developing. I create a control window for the ActiveX, then ( emulating the ATL/MFC GetDlgControl ) I assign the IID_IPDFXCview interface to the t_spView variable.
The assignment goes well ( the interface is properly read into the variable ) but as soon as I invoke any ActiveX method, I get the hRes == E_UNEXPECTED. Any tip ?
Thanks,
Ciro

#import "F:\Tracker Software\PDF-XChange Viewer SDK\Bin\PDFXCviewAx.dll" no_namespace, named_guids, raw_interfaces_only
typedef CComPtr<IPDFXCview> t_spView;
....
....
control == parent window where the ActiveX will be painted
R = parent window RECT
....
....

CWnd controlWrapperWnd = new CWnd();
controlWrapperWnd->Create(NULL,NULL,WS_VISIBLE|WS_CHILD,R,control,99991);

if( controlWrapper.CreateControl(
_T("{FE36F0F3-F082-41B7-9EED-772505A7C054}"),
_T(""),
WS_CHILD | WS_VISIBLE | WS_TABSTOP,
R,
controlWrapperWnd,
99992,
NULL,
FALSE,
NULL
) == FALSE
)
return FALSE;

t_spView spView = NULL;

HRESULT hRes = controlWrapper.GetControlUnknown()->QueryInterface( IID_IPDFXCview, (void **)&spView );
if (FAILED(hRes)) {
return inError;
}

// spView is acquired correctly - no problems with the QueryInterface, BUT ...

hRes = spView->SetDevInfo(CComBSTR("xxxxxxxxx"),CComBSTR("yyyyyyyyy")); // Note: my xxxx and yyyy codes work fine here - Simply I have obscured them here
// the SetDevInfo does not work, and returns an hRes == E_UNEXPECTED

if (FAILED(hRes)) {
// >>> here hRes is ALWAYS E_UNEXPECTED !!
return FALSE;
}
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: Unable to instantiate dynamically the PDFXCview ActiveX

Post by Corwin - Tracker Sup »

And what about this code:

Code: Select all

CWnd* m_controlWrapperWnd;
CComPtr<IPDFXCview> m_spView;

....

RECT rct = {0,0,480,280};
m_controlWrapperWnd = new CWnd;
BOOL bRet;
bRet = m_controlWrapperWnd->CreateControl( L"{FE36F0F3-F082-41B7-9EED-772505A7C054}", L"",WS_CHILD | WS_VISIBLE | WS_TABSTOP, rct,this,0,NULL,0,0);
if (bRet)
{
	m_spView = NULL;
	HRESULT hRes = m_controlWrapperWnd->GetControlUnknown()->QueryInterface(IID_IPDFXCview, (void **)&m_spView );
	if (SUCCEEDED(hRes))
	{
		hRes = m_spView->SetDevInfo(CComBSTR(L"xxxxxxxxx"),CComBSTR(L"yyyyyyyyy"));
	}
}
Please, look at the attached sample.
You do not have the required permissions to view the files attached to this post.
User avatar
John - Tracker Supp
Site Admin
Posts: 5225
Joined: Tue Jun 29, 2004 10:34 am

Re: Unable to instantiate dynamically the PDFXCview ActiveX

Post by John - Tracker Supp »

Also - please post in the correct forum :

https://forum.pdf-xchange.com/ ... m.php?f=36

Thanks :)
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com