|
Hi,
I'm unable to export a template class from an MFC based dll !
any ideas of how I can do it ?
Ciao
- Nilesh
|
|
|
|
|
Template classes are generated by their template arguments, they are in fact a little class factory. So I reckon you'll have trouble.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
You can export a template class as long as you force the compiler to create an instance of the class that you are trying to export. That is because a template is a compile time feature.
You can force the compiler to generate the code for a particular type of object by simply declaring a global variable of that particular type. But for each type you declare the size of your DLL will grow.
There is no way to export a template from a DLL, an retain the power that a template provides.
Would it simply be possible for you to distribute the header file with the template class in it instead?
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
I once did what you are trying to do (for export to a non-C++ project), but as Paul mentioned, the benefits of templates are lost. One way is to create a non-templatised wrapper class, and wrap every single method so that it calls the template version. Make sure you inline everything to avoid extra call overhead. If you forget to wrap any methods, the compiler will not generate them at all. Of course, you will have to declare one specific type to be used with the exported class, hence the class will no longer be generic. You can create separate wrapper classes for different types, though your DLL will get rather large.
Cheers
|
|
|
|
|
Hi,
How can I get the position and dimension of my client area inside of my CFrameWnd without including the area of docked tool bars or status bars?
Thanks
|
|
|
|
|
The docked toolbars sit inside a child window, if you could find that, you could get it's size and subtract it from GetClientRect.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Thank you Christian,
I tried that, but when the toolBar is docked, it seems that the dimensions obtained with GetClientRect don't match the docking area. Also if I have several toolBars I have to check each single toolBar's status (docked or floating) and then its dimensions. Also what happens if several toolBars dock together on more than one row?
|
|
|
|
|
The child window that holds the toolbars is called a CMiniDockFrameWnd. You need to find those, and grab their dimensions, I think. Or create a View, maximise it, and get IT'S dimensions.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Thanks again Christian,
I guess I'll be able to do it with that!
|
|
|
|
|
There is a CWnd member called RepositionBars. You can call it like this:
CRect a_oRealClientArea( 0, 0, 0, 0 );
pYourFrameWnd->RepositionBars( AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0, CWnd::reposQuery, &a_oRealClientArea, NULL, FALSE );
Chris Richardson
Programmers find all sorts of ingenious ways to screw ourselves over. - Tim Smith
|
|
|
|
|
That's just perfect Chris, thanks a lot
It is working very nicely now
|
|
|
|
|
No problem, I'm glad to hear it's working!
Chris Richardson
Programmers find all sorts of ingenious ways to screw ourselves over. - Tim Smith
|
|
|
|
|
hi..
Is there any function in vc++ for getting the harddisk serial number ?. Can anyone help me..pls it's urgent
|
|
|
|
|
Use the GetVolumeInformation API function!
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
Im developing a Application which looks like the Windows Explorer..Left Side view is a Treeview and righ side view is a Form view.
I have a implemented a Find Functionality to search the nodes in the tree wrt to node text in the tree view.The problem is that when i find the particular node I call
<br />
treectrl->SelectItem(hItem)<br />
Becos of this OnSelchange event is called and so the coressponding rightside view is displayed..My problem is that to use Find Next again my treeview should be active but that is not the case.So to enable Find next i have to click in treeview to make it active and so that the menu is also enabled...
Is there any way to overcome this problem....(ie)After onSelchange event i want again my tree view to be active for further tree operations.
cheers,
Super
------------------------------------------
Too much of good is bad,mix some evil in it
|
|
|
|
|
My initial thought is that it might be better to avoid activating the right-side at all after searching, rather than having it activate and then deactivate. If you could store a flag value somewhere, that indicates whether a node selection was caused by your find function, you could check it in your OnSelchange event, and avoid activating the right-side there. I would also think you might always want to keep the treeview active while the user works in it, just as you mentioned, since most applications work that way. Sounds like you might need to focus on the OnSelchange event.
Cheers
|
|
|
|
|
Well Ur sugession was Good and it solved the problem of doing Tree operation..
Now i just have a small hiccup...
When During Find if i find the correct node then i have to activate the right view...But the problem is Onselchange event is not firing if i call
<br />
treectrl->SelectItem(hItem)<br />
after reseting the flag.....Even if i PostMessage(TVN_SELCHANGE) also..No use..
So... any idea
cheers,
Super
------------------------------------------
Too much of good is bad,mix some evil in it
|
|
|
|
|
When you say you need to "activate" the right view, do you mean you have to fill it with information, or that you have to set the focus on it, or both? I do not know what kind of control(s) you have in the right view, but it should be possible to fill the controls with information, and yet avoid moving the focus to a control in the right view.
|
|
|
|
|
I want to Display the Right side view For the corresponding Node..So it means I have to Fill the Right side view with the data's....
My class will handle the filling if i can just display the Right side view.
Im handling the Filling of data in the InitialUpdate of that View class..
So I just have to fire that OnSelchanged() event in the tree..
cheers,
Super
------------------------------------------
Too much of good is bad,mix some evil in it
|
|
|
|
|
Hmmm... I assume you verifed that manually selecting a node with the mouse fires OnSelchanged(), so this is puzzling. Did you check if hItem is valid? Is it possible that OnSelchanged() is being called, but that it is not doing what you need? I also assume you sent the TVN_SELCHANGED message within a WM_NOTIFY message (with the NMTREEVIEW and NMHDR structures filled-in validly), and that it was sent to the window that owns the treeview.
Forgive me, but I usually find it is the tiniest mistakes that cause such problems, which are often missed the first time the code is checked. It is hard to guess without seeing the actual code...
|
|
|
|
|
(I'm sorry to post it again but I'm in a hurry. I'd like to know how I do that?)
I want to modify or set global printer setting.
1) Enter to Control_Panel -> Printer
2) right click on printer list and change setting
but I want to set from visual c++
How can I do that ?
Thank in advanced for your kindness
|
|
|
|
|
I've been to CodeGuru, I feel dirty. Google was how I found this link:
http://www.codeguru.com/printing/SetPrinter.shtml[^]
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
I want to change properties in global printer setting. I don't want to change default printer.
Please help me
Thanks in advanced
|
|
|
|
|
What does 'global printer setting' mean ?
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Hi again
I want to print from a command line program like this
C:\print_job.exe "My Printer" job_file
so the command line program will print that use global printer setting (system printer setting)
the meaning of global printer setting is something like this
1) Enter to Control_Panel -> Printer
2) right click on printer list and change setting
Please help me
Thank you so much for your kindness
|
|
|
|