|
How can we build a Dll with template-based-class export capability?
Can we export classes like this:
#ifdef INSIDE_DLL_PROJECT
#define DLL_OBJ __declspec(dllexport)
#else
#define DLL_OBJ __declspec(dllimport)
#endif
template<class T>
class DLL_OBJ SimpleTemplateClass
{
//declarations and class interface
};
I want to hide my implementation template classes and build a Dll (as we do for non-template export Dll) instead of distributing all class codes in an .h unit.
Does the same problem prevent MS to build WTL Dlls?
I use MS Visual C++ 6.
|
|
|
|
|
Since your < and > signs disappeared I can't really say. But you can _not_ ship anything where you are not exporting the explicit instantiations of a template class without shipping the code itself.
It's three steps:
1 - Class template (the code).
2 - Template class (the code instantiation of that template class).
3 - Exporting 2.
|
|
|
|
|
Hi,
(FYI : Moving my project from VC6 to VC7, I have an horrible amount of problems.)
The last one is I can not read my old files. The same code compiled with VC6 is OK. Now if I compile with VC7, I have a CArchiveException::badClass.
The output window of the debugger write :
"Warning: Cannot load DCStoreContents from archive. Class not defined.
CArchive exception: badClass."
Any idea ?
|
|
|
|
|
The answer was found on Microsoft forum : this is a bug of VC7 (modification of the IMPLEMENT_SERIAL macro) and we just have to wait for the service release.
|
|
|
|
|
I have just got this same error under visual studio 2003 when trying to serialize a CMapStringToOb class from disk back into the hash table from inside a MFC DLL. The strange thing is im also serializing about another 6 CArray objects which work with no problem what so ever.
From what i can gather this bug was found in 2002 .NET and has still not been fixed??
Did you ever get your code working?
Thanks
zebbedi
|
|
|
|
|
Wow, this was one year ago !
As I wrote, there was a bug in the IMPLEMENT_SERIAL macro in the VS.NET 2002, which was signaled in Microsoft Forum.
In June this year, I tried again to move our VC6 project to the (then) new VS.net 2003 and this time I think it worked correctly from the beginning (I do not remember having any of this problem - but I did have others).
So I don't think I have had the problem with VS 2003, and I can not see how to help, sorry.
Best regards,
Olivier
|
|
|
|
|
Thanks for the reply,
Just out of interest were you using a collection class of some type (CArray, CMap etc). If so please could you tell me which.
My DLL currently has another 6 CArray collections in it which serialize no problem. Its only this CMapStringToOb that is giving me grief.
Soon as i take the exact same code outside the DLL it works perfectly.
|
|
|
|
|
I have a probelm that one of my cpp files is converted into the Hex code automatically . The exe is working fine but i am not able to trace the code back.
Can you suggest some Solution
Samir Sood
|
|
|
|
|
|
Hi, I would like to get hold of the co-ordinates of an Edit control on a dialog.
I've tried creating a control var for that Edit box and using of it's functions but am having no joy.
I would appreciate any help you could give me.
Jacques Victor
|
|
|
|
|
CEdit* pEdit = (CEdit*)GetDlgItem(IDC_MYEDIT);
CRect EditRect;
pEdit->GetWindowRect(EditRect); // puts coordinates into CRect
ScreenToClient(EditRect); // converts from screen coordinates to relative to the dialog its in
EditRect.top -= 50; // subtract 50 from the top pos
// set the position to the new position
pEdit->SetWindowPos(&wndTop, EditRect.left, EditRect.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
// hope that helps
-dz
|
|
|
|
|
I'm looking for a decent DialogBar HOWTO.
Need a kind of tool window like those neat panels from macromedia.
I know it can be done with a CDialogBar and with dockable disabled.
It aint so hard to for a single dialog, but i want to use tabs. I cant get it done, so ...
Anybody got an idea how to get the job done, where to find a decent HOWTO ?
ps. i'm quite new to MFC thus... keep answers not too technical
thx all
I used to have a life ... now I have a computer
|
|
|
|
|
|
sure i can. I aint that dumb.
But i got problems creating child windows.
And catching their messages.
I used to have a life ... now I have a computer
|
|
|
|
|
I don't know about child windows, but catching there messages might involve overrriding the following function: CControlBar::WindowProc()
Check the source code for it and you will see something like this:
<br />
LRESULT CControlBar::WindowProc(UINT nMsg, WPARAM wParam, LPARAM lParam)<br />
{<br />
ASSERT_VALID(this);<br />
<br />
switch (nMsg)<br />
{<br />
case WM_COMMAND:<br />
case WM_DRAWITEM:<br />
case WM_MEASUREITEM:<br />
case WM_DELETEITEM:<br />
case WM_COMPAREITEM:<br />
case WM_VKEYTOITEM:<br />
case WM_CHARTOITEM:<br />
return ::SendMessage(::GetParent(m_hWnd), nMsg, wParam, lParam);<br />
}<br />
return CWnd::WindowProc(nMsg, wParam, lParam);<br />
}<br />
Add the desired messages you wish to capture after
case WM_CHARTOITEM:
For more info, search for the following article in the MSDN:
Using CDialogBar in 32-Bit MDI Applications
Nigel Thompson
Microsoft Developer Network Technology Group
Created: September 27, 1994
James
Drinking In The Sun
Forgot Password?
|
|
|
|
|
How do you remove (without resulting to error) or hide the Menu in an MDI window (CMDIFrameWnd)?
|
|
|
|
|
|
No I haven't tried that, but will try.
Got a solution though: I am currently trying to set the Menu of the Main Frame Window menu to NULL:
////
BOOL CMainFrame::OnEraseBkgnd(CDC* pDC)
{
// TODO: Add your message handler code here and/or call default
if (GetMenu ())
SetMenu (NULL);
return CMDIFrameWnd::OnEraseBkgnd(pDC);
}
////
It works.. except sometimes there are some minor flicker when adding or closing child windows.
Other ideas are much appreciated
Thanks.
|
|
|
|
|
I have a property sheet, which I added a button.
The button brings up a modeless dialog, using the Visual C++'s sample modeless code. The dialog is never visually created, but successfully returns from the Create call (i.e., 1).
m_pCrowsFeet_modeless = NULL;
if (m_pCrowsFeet_modeless == NULL){
m_pCrowsFeet_modeless = new CrowsFeet_Dlg(this);
BOOL dana1 = m_pCrowsFeet_modeless->Create();
if (dana1 == TRUE)
GetDlgItem(IDOK)->EnableWindow(FALSE);
}
else
m_pCrowsFeet_modeless->SetActiveWindow();
The value of dana1 from the Create is 1. But the error occurs when
EnableWindow(FALSE) is invoked. That is the ASSERT(::IsWindow(m_hWnd) is violated and aborts.
CWnd* CWnd::GetDlgItem(int nID) const
{
ASSERT(::IsWindow(m_hWnd));
if (m_pCtrlCont == NULL)
return CWnd::FromHandle(::GetDlgItem(m_hWnd, nID));
else
return m_pCtrlCont->GetDlgItem(nID);
}
The dialog works when called from an application, but not from a property sheet.
Is not a property derived from Cwnd and therefore an IsWindow?
The this from the dialog code does not appear to have a m_hWnd.
Is this true of a propertysheet?
Although the same parent is used to create a window
BOOL ret = Create(NULL, windowName, WS_OVERLAPPEDWINDOW | WS_VSCROLL,
CRect(10,10,300,400), parent, 0);
Thanks, dana
|
|
|
|
|
try removing the 'this' in the line
m_pCrowsFeet_modeless = new CrowsFeet_Dlg(this);
and then see.
|
|
|
|
|
I click Build/Start Debug/Attach to process. Normally i must get the processes list as i can choose something from it. But the list is empty.
Do you know how could i bring the PIDs into the list?
rechi
|
|
|
|
|
This was related to the one below.
The problem will not appear if you don't have any service blocked.
rechi
|
|
|
|
|
I've created an ATL service. I've started it and it was ok, but the stop action blocked and now the service is in stopping state.
How should i stop the service without reboot?
rechi
|
|
|
|
|
You have a problem. I stop mine by killing the process all the time ( as well as in the proscribed manner ) and on the odd case it's done that, I've needed to change and rebuild it.
I don't recall what was wrong.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
Remember that amateurs built the ark. Professionals built the Titanic.
|
|
|
|
|
Unfortunately, killing the process is impossible because the access is denied.
I don't know how do you kill your process all the time but anyway i can't do it because i have to unload some resources on processing stop signal.
I will reboot.
rechi
|
|
|
|