Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

windowless ActiveX control are not supported, What Can i do?

71 views
Skip to first unread message

netboy

unread,
Jun 27, 2008, 7:34:50 AM6/27/08
to
i write a Activex Control use MFC (VC6.0/VS2005). This Control is right,
when it run with VB6.0. on the other hand,it can run with Activex control
test container. But, when i use this control in vs2005(vb),Design time is
ok, Run time has error report: "An error occurred creating the form. See
Exception.InnerException for details. The error is: Unable to get the
window handle for the 'AxAutoVXCtrl' control. Windowless ActiveX controls
are not supported." Does anyone know a fix for this?

In my Control, i Load Single Doc/View structure.
Document template:
class CAutoVXDocTemplate : public CSingleDocTemplate
{
enum { IDR_NOTUSED = 0x7FFF };

CWnd* m_pParentWnd;
CFrameWnd* m_pFrameWnd;
CString m_docFile;

public:

CAutoVXDocTemplate(CRuntimeClass* pDocClass,CRuntimeClass* pFrameClass,
CRuntimeClass* pViewClass);

CFrameWnd* CreateDocViewFrame(CWnd* pParentWnd);
void SaveDocumentFile();

virtual CFrameWnd* CreateNewFrame(CDocument* pDoc,CFrameWnd* pOther);
virtual CDocument* OpenDocumentFile(LPCTSTR lpszPathName, BOOL
bVerifyExists = TRUE);
};

CAutoVXDocTemplate::CAutoVXDocTemplate(CRuntimeClass* pDocClass,
CRuntimeClass* pFrameClass, CRuntimeClass* pViewClass)
: CSingleDocTemplate(IDR_NOTUSED, pDocClass, pFrameClass,
pViewClass)
{
ASSERT(pFrameClass);

}

CFrameWnd* CAutoVXDocTemplate::CreateDocViewFrame(CWnd* pParentWnd)
{
CWaitCursor cursor;
TRY
{
ASSERT(pParentWnd && IsWindow(*pParentWnd));
ASSERT_KINDOF(CAutoVXCtrl, pParentWnd);
m_pParentWnd = pParentWnd;
m_pFrameWnd = NULL;

if (!OpenDocumentFile(NULL))
return NULL;

ASSERT(m_pFrameWnd);
ASSERT_KINDOF(CFrameWnd, m_pFrameWnd);

m_pFrameWnd->ShowWindow(SW_SHOWNORMAL);

return m_pFrameWnd;
}
CATCH_ALL(e)
{
AfxMessageBox(_T("CreateDocViewFrame error.please retry!"));
THROW_LAST();
}
END_CATCH_ALL
return NULL;
}

CFrameWnd* CAutoVXDocTemplate::CreateNewFrame(CDocument* pDoc,
CFrameWnd* pOther)
{
ASSERT(pOther == NULL);
ASSERT(m_pFrameClass != NULL);
if (pDoc != NULL)
ASSERT_VALID(pDoc);

CCreateContext context;
context.m_pCurrentFrame = pOther;
context.m_pCurrentDoc = pDoc;
context.m_pNewViewClass = m_pViewClass;
context.m_pNewDocTemplate = this;

m_pFrameWnd = (CFrameWnd*)m_pFrameClass->CreateObject();
if (m_pFrameWnd == NULL)
{
TRACE1("Warning: Dynamic create of frame %hs failed. ",
m_pFrameClass->m_lpszClassName);
return NULL;
}
ASSERT_KINDOF(CFrameWnd, m_pFrameWnd);

if (context.m_pNewViewClass == NULL)
TRACE0("Warning: creating frame with no default view. ");

ASSERT_KINDOF(CAutoVXCtrl, m_pParentWnd);

if (!m_pFrameWnd->Create(NULL, L"", WS_CHILD|WS_VISIBLE,
CFrameWnd::rectDefault, m_pParentWnd, NULL, 0, &context))
{
TRACE0("Warning: CDocTemplate couldn't create a frame. ");
return NULL;
}

return m_pFrameWnd;
}
CDocument* CAutoVXDocTemplate::OpenDocumentFile(
LPCTSTR lpszPathName, BOOL bVerifyExists)
{
CWaitCursor cursor;
//SaveDocumentFile();
m_docFile = lpszPathName;

if (bVerifyExists)
{
DWORD dwAttrib = GetFileAttributes(m_docFile);
if (dwAttrib == 0xFFFFFFFF ||
dwAttrib == FILE_ATTRIBUTE_DIRECTORY)
{
lpszPathName = NULL;
}
}

return CSingleDocTemplate::OpenDocumentFile( lpszPathName, TRUE);
}
In Class : CAutoVXCtrl
OnCreate(..)
{
...
if (!m_bDocInitialized)
{
CDocManager docManager;
docManager.AddDocTemplate(NULL);
CAutoVXDocTemplate* pDocTemplate = new CAutoVXDocTemplate(
RUNTIME_CLASS(CAutoVXDoc),RUNTIME_CLASS(CMainFrame),RUNTIME_CLASS(CAutoVXView)
);
AddDocTemplate(pDocTemplate);
m_bDocInitialized = TRUE;
}
ASSERT(m_pDocTemplate); // Set in call to AddDocTemplate
m_pFrameWnd = m_pDocTemplate->CreateDocViewFrame(this);
ASSERT_KINDOF(CFrameWnd, m_pFrameWnd);
theApp.m_pMainWnd= m_pFrameWnd;
SetBorderStyle(TRUE);
theApp.m_pMainWnd->UpdateWindow();
m_Timer = SetTimer(WM_IDLEUPDATECMDUI, 300, NULL);

}

noro...@gmail.com

unread,
Jul 11, 2008, 7:22:06 AM7/11/08
to
in vista? if so, maybe for DEP.

http://objectmix.com/dotnet/308769-windowless-activex-controls-not-supported-error-vista-using-vs2008-pro-rtm.html

> RUNTIME_CLASS(CAutoVXDoc),RUNTIME_CLASS(CMainFrame),RUNTIME_CLASS(CAutoVXVi-ew)

netboy

unread,
Jul 14, 2008, 9:07:00 AM7/14/08
to
Thank you!
but i use WINXPsp2 +VS2005SP1 + Core Duo2 T6550.

<noro...@gmail.com> ?入消息新?:1bd9af12-aefb-4aff...@l42g2000hsc.googlegroups.com...

0 new messages