Click here to Skip to main content
15,029,944 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionMDI multiple view types - Window List Pin
bob169727-Sep-07 10:12
Memberbob169727-Sep-07 10:12 
AnswerRe: MDI multiple view types - Window List Pin
bob169727-Sep-07 14:15
Memberbob169727-Sep-07 14:15 
GeneralRe: MDI multiple view types - Window List Pin
bob169727-Sep-07 14:21
Memberbob169727-Sep-07 14:21 
AnswerRe: MDI multiple view types - Window List Pin
Nelek12-Sep-07 0:08
protectorNelek12-Sep-07 0:08 
QuestionHow to prevent library/software cracking Pin
Hirakawa7-Sep-07 9:53
MemberHirakawa7-Sep-07 9:53 
AnswerRe: How to prevent library/software cracking Pin
David Crow7-Sep-07 10:16
MemberDavid Crow7-Sep-07 10:16 
GeneralRe: How to prevent library/software cracking Pin
Hirakawa7-Sep-07 21:08
MemberHirakawa7-Sep-07 21:08 
QuestionUsing a resource from an ATL COM MFC Component Pin
cmacgowan7-Sep-07 9:45
Membercmacgowan7-Sep-07 9:45 
Hi ...

I am expanding on a ATL Addin Framework from thomas_tom99.
http://www.codeproject.com/com/AddinProjectFramework.asp

To summarize the Addin Framework includes ATL COM (with MFC) Addin Components. The host application will use the Addin Manager to look for registered COM components with the matching CATAGORY ID and then load them into the host application. The Addin Components work nice.

The Addin Components are ATL COM with MFC. I would like to add a CFormView based object to the Addin and then access and use the view by my SDI MFC host application.

// Forms below are in DLLs. We will need to get the handle for the
// resource in the DLL while the view is in use (selected)
hDLL = GetModuleHandle("Addin1.dll");
hEXE = AfxGetResourceHandle();
AfxSetResourceHandle((HINSTANCE) hDLL);
m_nAddin1View0 = m_wndHorSplitter.AddView(1, 0, RUNTIME_CLASS(CAddin1View0), pContext);
AfxSetResourceHandle(hEXE);

I get the following error:
MainFrm.obj : error LNK2001: unresolved external symbol "public: static struct CRuntimeClass const CAddin1View0::classCAddin1View0" (?classCAddin1View0@CAddin1View0@@2UCRuntimeClass@@B)


I have done this in the past with a standard MFC DLL. ??



---------------------
Here is the addin and host code:


In Addin1.dll I have added the CFormView derived CAddin1View0 class.

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
class CAddin1View0 : public CFormView
{
protected:
CAddin1View0(); // protected constructor used by dynamic creation
DECLARE_DYNCREATE(CAddin1View0)

// Form Data
public:
//{{AFX_DATA(CAddin1View0)
enum { IDD = IDD_ADDIN1_VIEW0 };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA

// Attributes
public:

// Operations
public:

// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAddin1View0)
public:
virtual void OnInitialUpdate();
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL

// Implementation
protected:
virtual ~CAddin1View0();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif

// Generated message map functions
//{{AFX_MSG(CAddin1View0)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};


In the host application I have a window splitter and would like one of four views to show in the horizontal pane. I have created three test views in the host and am trying to gain access to the CFormView class using the method below. This is how I did it with the MFC DLLs. ???

I have removed some variable declaration and other non related code to make the test more readable.

I get the following error:
MainFrm.obj : error LNK2001: unresolved external symbol "public: static struct CRuntimeClass const CAddin1View0::classCAddin1View0" (?classCAddin1View0@CAddin1View0@@2UCRuntimeClass@@B)


\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{

if (!m_wndVerSplitter.CreateStatic(this,1,2)) // rows 1, columbs 2
{
TRACE0("Failed to create split bar ");
return FALSE; // failed to create
}

GetClientRect(&cr);

CSize paneSize(cr.Width(), nHorizonalSplitterLoc);
CSize paneSize1(cr.Width(), cr.Height() - nHorizonalSplitterLoc);

// CSize cVertpaneSize(cr.Width(), nVerticalSplitterLoc);
CSize cVertpaneSize(nVerticalSplitterLoc, cr.Height() - nHorizonalSplitterLoc);

// create a pContext pointer if it is NULL
if (pContext == NULL)
{
pContext = new CCreateContext;
}


// create the horizontal static splitter
// We are nesting the horizontal splitter into the right pane of the
// verital splitter. So we have to do some messin around here
// rows cols

m_wndHorSplitter.CreateStatic(&m_wndVerSplitter, 2, 1, WS_CHILD | WS_VISIBLE,
m_wndVerSplitter.IdFromRowCol(0, 1));

// create the top part of right pane of the splitter (row cols)
pContext->m_pNewViewClass=RUNTIME_CLASS(CMasConsoleTestListView);
pContext->m_pCurrentFrame = this;
m_wndHorSplitter.CreateView(0, 0, pContext->m_pNewViewClass, paneSize, pContext);

// We will set up the various forms that will be able to be set
// as the program is running. Note: The order of these view classes may
// be significant. We are doing some research. When you put the
// CTransactionFormView then we have some strange crashing!!

m_nView0 = m_wndHorSplitter.AddView(1, 0, RUNTIME_CLASS(CMasConsoleTestView), pContext);
m_nView1 = m_wndHorSplitter.AddView(1, 0, RUNTIME_CLASS(CMasConsoleTestView1), pContext);
m_nView2 = m_wndHorSplitter.AddView(1, 0, RUNTIME_CLASS(CMasConsoleTestView2), pContext);

// Forms below are in DLLs. We will need to get the handle for the
// resource in the DLL while the view is in use (selected)
hDLL = GetModuleHandle("Addin1.dll");
hEXE = AfxGetResourceHandle();
AfxSetResourceHandle((HINSTANCE) hDLL);
m_nAddin1View0 = m_wndHorSplitter.AddView(1, 0, RUNTIME_CLASS(CAddin1View0), pContext);
AfxSetResourceHandle(hEXE);

nCurrentHorizHeight = 123;
m_wndHorSplitter.SetRowInfo(0, nCurrentHorizHeight, nMinHorizHeight);

m_wndVerSplitter.RecalcLayout();

m_wndHorSplitter.RecalcLayout();
m_wndHorSplitter.SetActivePane(1,0);

return rc;
}



\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
void CMainFrame::SetActiveView(int nViewIndex)
{
switch (nViewIndex)
{
case 0:
m_wndHorSplitter.ShowView(m_nView0);
break;

case 1:
m_wndHorSplitter.ShowView(m_nView1);
break;

case 2:
m_wndHorSplitter.ShowView(m_nView2);
break;

case 3:
m_wndHorSplitter.ShowView(m_nAddin1View0);
break;

case 4:
m_wndHorSplitter.ShowView(m_nAddin2View0);
break;

}
}


Again, I get the following error.

MainFrm.obj : error LNK2001: unresolved external symbol "public: static struct CRuntimeClass const CAddin1View0::classCAddin1View0" (?classCAddin1View0@CAddin1View0@@2UCRuntimeClass@@B)

When I comment out referecnes to the CAddin1View0 class then I'm ok. Any comments or ideas.
Thanks!
Chris

macgowan@pobox.com


Chris
macgowan@pobox.com
AnswerRe: Using a resource from an ATL COM MFC Component Pin
cmacgowan7-Sep-07 11:45
Membercmacgowan7-Sep-07 11:45 
QuestionHow to find Certificate Trust List by "Identifier" Pin
Joseph.Lightfoot7-Sep-07 6:18
MemberJoseph.Lightfoot7-Sep-07 6:18 
AnswerRe: How to find Certificate Trust List by "Identifier" Pin
led mike7-Sep-07 7:34
Memberled mike7-Sep-07 7:34 
GeneralRe: How to find Certificate Trust List by "Identifier" Pin
Joseph.Lightfoot7-Sep-07 9:18
MemberJoseph.Lightfoot7-Sep-07 9:18 
GeneralRe: How to find Certificate Trust List by "Identifier" Pin
led mike7-Sep-07 11:42
Memberled mike7-Sep-07 11:42 
QuestionType conversion! from BYTE[] to Point[] [modified] Pin
Md. Ali Naser Khan7-Sep-07 4:34
MemberMd. Ali Naser Khan7-Sep-07 4:34 
AnswerRe: Type conversion! from BYTE[] to Point[] Pin
led mike7-Sep-07 5:07
Memberled mike7-Sep-07 5:07 
JokeRe: Type conversion! from BYTE[] to Point[] Pin
David Crow7-Sep-07 5:14
MemberDavid Crow7-Sep-07 5:14 
GeneralRe: Type conversion! from BYTE[] to Point[] Pin
jhwurmbach7-Sep-07 6:27
Memberjhwurmbach7-Sep-07 6:27 
GeneralRe: Type conversion! from BYTE[] to Point[] Pin
Md. Ali Naser Khan7-Sep-07 5:14
MemberMd. Ali Naser Khan7-Sep-07 5:14 
GeneralRe: Type conversion! from BYTE[] to Point[] Pin
Mark Salsbery7-Sep-07 5:30
MemberMark Salsbery7-Sep-07 5:30 
GeneralRe: Type conversion! from BYTE[] to Point[] Pin
led mike7-Sep-07 5:41
Memberled mike7-Sep-07 5:41 
AnswerRe: Type conversion! from BYTE[] to Point[] Pin
John R. Shaw7-Sep-07 23:11
MemberJohn R. Shaw7-Sep-07 23:11 
AnswerRe: Type conversion! from BYTE[] to Point[] Pin
Mark Salsbery8-Sep-07 7:12
MemberMark Salsbery8-Sep-07 7:12 
QuestionIHTMLDocument2Ptr not found Pin
Bhavesh Bagadiya7-Sep-07 4:23
MemberBhavesh Bagadiya7-Sep-07 4:23 
QuestionRe: IHTMLDocument2Ptr not found Pin
David Crow7-Sep-07 4:30
MemberDavid Crow7-Sep-07 4:30 
AnswerRe: IHTMLDocument2Ptr not found Pin
Bhavesh Bagadiya7-Sep-07 4:56
MemberBhavesh Bagadiya7-Sep-07 4:56 

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.