|
Might I suggest this is a hugely BAD idea ? I'm not sure if it can be done, but if you do it, you'll create code incompatible with MFC42.dll ( you'll need to statically link ) AND incompatible with every other development machine on the planet. Why not derive from the MFC class you want to change and make the change in your derived class ? That's what it is for.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
When I use unicode in my CRichEditView based class I can input Unicode characters only from keyboard, and when I try input its by function SetWindowText every character, which takes code after FF, printing as two different character, how I can correct this.
|
|
|
|
|
Hi,
I'm exporting a template class from my MFC extension DLL, but as soon as I start using the template class outside the DLL, I get linker errors.
The template class in the DLL looks like this (myClass_Object is also defined inside the DLL):
template <class afx_ext_class="" caggregate="">
class AFX_EXT_CLASS myClass_Aggregate : public myClass_Object
{
public:
myClass_Aggregate()
{
....
}
...
}
I use the aggregate with a class from inside the DLL as the template class and the linker error looks like this (myClass_TreeFileNode is a subclass of myClass_Object):
DumpDB.obj : error LNK2001: unresolved external symbol "public: int __thiscall myClass_Aggregate<class myclass_treefilenode="">::IsEmpty(void)const " (?IsEmpty@?$myClass_Aggregate@VmyClass_TreeFileNode@@@@QBEHXZ)
Am I not exporting the class correctly??
Dave
Structured programming vs. chaotic mind boggling
|
|
|
|
|
Have you tried to implement a method
int IsEmpty(void)
{
...
return n;
}
???
Seems like the linker can't find the body of this function...
Is it a virtual class you are inheriting from?
Or is int IsEmpty(void) defined as:
in IsEmtpy(void) = 0; ??
|
|
|
|
|
I've implemented all the functions inside the class and it all worked when it was still outside the MFC Extension DLL...
There is one thing though, but I don't think it could cause this error: the implementation is done in the .h-file.
I would like to try to move the implementation to the .cpp-file, but I never got that working on a template class...
Structured programming vs. chaotic mind boggling
|
|
|
|
|
It shouldn't make any difference if the implementation is
in the header or in the cpp. The linker doesn't care.
It's just a matter of making readable code.
Doing all your implementation in the header, just makes the code
harder to maintain than necessary.
The key point is that the linker can't find the implementation
of that method.
|
|
|
|
|
the implementation is done in the .h-file.
So there's no need to mark the template as exported. What happens when you remove AFX_EXT_CLASS?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I tried it this way as well:
template <class caggregate="">
class AFX_EXT_CLASS myClass_Aggregate : public myClass_Object
{
public:
myClass_Aggregate()
{
...
}
...
}
but it doesn't make a difference. It just keeps on saying that it can't link to the specific templated instance... For example, when I do this:
myClass_Aggregate<myclass_object> bla;
it says it can't find the implementation of
myClass_Aggregate<class myclass_object="">::~myClass_Aggregate<class myclass_object="">(void)
The weird thing is that it apparantly CAN find the implementation of the CONSTRUCTOR...
I've been looking around a little, but am quite pessimistic about a good outcome for this problem.... Please help me before I get depressed
Structured programming vs. chaotic mind boggling
|
|
|
|
|
The code posted in last msg still contains AFX_EXT_CLASS. Are you sure you've actually removed AFX_EXT_CLASS?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Wait, I'm a little off here, I guess....
I would like to use the template class outside the DLL (i.e. export the template class). But when I remove the AFX_EXT_CLASS from the class definition of myClass_Aggregate, the class won't be exported at all, right? So then I won't be able to use it outside the DLL, right???
Or perhaps I don't understand this very well...
Structured programming vs. chaotic mind boggling
|
|
|
|
|
1) When you post code, replace > and < with > and <. The template arguments are lost without that - I had to view the HTML source to find out that you're using AFX_EXT_CLASS in template argument declaration. This isn't necessary.
2) Template itself doesn't produce any code, so there's no need to export it. All information is in .h file, as you have already mentioned.
3) Your template derives from non-template myClass_object. This class must be exported.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
>1) When you post code, replace > and < with > and <. The template arguments are
>lost without that - I had to view the HTML source to find out that you're using
>AFX_EXT_CLASS in template argument declaration. This isn't necessary.
Whoops. Sorry. Never thought of that. Pretty stupid of me.
>2) Template itself doesn't produce any code, so there's no need to export it. All
>information is in .h file, as you have already mentioned.
Right.
>3) Your template derives from non-template myClass_object. This class must be exported.
It was already exported, but it didn't seem to help. My theory about the whole messy situation is that template-classes can't be exported. I read somewhere else over at CodeGuru.com that the template construction is a compile-time trick and since the extension dll has already been compiled, it probably can't use any template classes.
I've solved the problem by repeating the code of the template class inside the .h-file that I distribute together with the .lib en .dll file. That way it is compiled both in the extension DLL and in the application that uses the dll. Not an ideal solution, but it works for now.
If anyone has valuable input about this situation, I'd love to hear it!
Thanks for all your help so far.
Dave
Structured programming vs. chaotic mind boggling
|
|
|
|
|
What exactly do you want to achieve? Do you want users of your DLL to pass types unknown inside the DLL as template arguments?
myClass_aggregate<classFromSomeOtherExeOrDll> x;
In this case, you need to distribute .h file. Template construction occurs at compile time - this is no surprise, because template itself is not a complete type. Compiler needs to know what are the template arguments.
Or -- maybe you just want to export a few specializations of your template, like this:
myClass_aggregate<classFromThisExtenstionDll> y;
myClass_aggregate<anotherClassFromThisExtenstionDll> z;
In this scenario you have one more option - you can explicitly instantiate the type. See "Explicit Instantiation" in C++ Language Reference included in VC++ help and KB article Q168958 for more details.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Actually I wanted what you first described... But reflecting on it, I only want to use the aggregate for subtypes of the myClass_Object class, so that may bring me to your second case...
Is it so, that when I explicitly instatiate a supertype, that it will also work for all subtypes of that supertype??
In that case I am probably able to solve it the elegant way, anyway!
Thanx a lot!
Structured programming vs. chaotic mind boggling
|
|
|
|
|
HELP!!
I been trying for a while to get this right with various methods but to no avail..
the closest I got had little effect. Any help will be appreciated J
// In header file
//{{AFX_DATA(COutgoingMessage)
enum { IDD = IDD_MESSAGE_OUT };
CButton m_btnOK;
CButton m_btnCancel;
CStatic m_ctlToLabel;
CStatic m_ctlTo;
CEdit m_ctlBody;
CString m_Body;
CString m_To;
//}}AFX_DATA
// in the source file
void COutgoingMessage::OnSetFont()
{
// TODO: Add your specialized code here and/or call the base class
CFont font, *pFont;
BOOL bCreated = font.CreateFontIndirect(&m_lf);
ASSERT(bCreated);
// Done with the font. Delete the font object.
pFont = &font;
CDialog::OnSetFont(pFont);
m_ctlBody.SetFont(pFont);
font.DeleteObject();
//UpdateData( FALSE );
}
// NOTE !! I have tried many different methods this is the only method that shows a difference. However the is no visual chance in the font face!
can anyone give me any suggestions??
I have used the CLabel class elsewhere and found it useful, I tried to create my own CMyEdit Class using this as an example but to no avail..
what am I doing wrong??
|
|
|
|
|
font.DeleteObject();
You're deleting the font. Don't do that.
Move the CFont object to a member variable of COutgoingMessage .
--Mike--
http://home.inreach.com/mdunn/
Ford: How would you react if I said that I'm not from Guildford after all, but from a small planet somewhere in the vicinity of Betelguese?
Arthur: I don't know. Why, do you think it's the sort of thing you're likely to say?
|
|
|
|
|
Thanx for the info,
I made the changes yoy sudjested but now I cant see the text.. the font appears 'transparent', I can type and the cursor appears to move??
I do have a OnCtlColor that changes the color of the edit box .. but even if I diable this I get the same result???
any ideas??
|
|
|
|
|
Where I can find a DirectShow-campatible MPEG-2
Decoder that software based???
Please help me, thanks.
|
|
|
|
|
We are working on a Graphic designing application, which uses more system resources. So when app. starts, it works in a normal speed. But as other applications are started, our application slows down.
|
|
|
|
|
Because they too are taking up CPU cycles and yours is very resource hungry, from the sound of it.
You can set the priority of your program to help alleviate this, but don't go too high or you'll bring down your system, or make other programs behave unreasonably sluggishly. The idea lsolution is to increase your priority when you have the focus, and decrease when you do not, and let the user decide the level to which this occurs.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
So add more memory. You're running into swap issues most likely.
|
|
|
|
|
i'm trying to write a small win32 console program that will output security for each directory on a hard drive.
i can iterate through each ACE in a DACL easy enough, but i'm stumped as to how to figure out what access is allowed by the ACE->Mask 32-bit DWORD value. Any help interpreting this is greatly appreciated... Thanks!!!!
"A friend will help you move. A real friend will help you move a dead body."
|
|
|
|
|
i figured this out...
if anyone's interested, the process is to create access masks for each type of access you want to check, and run the function
BOOL bAccess = AreAllAccessesGranted(Mask, DesiredMask);
and check the return BOOL value.
|
|
|
|
|
How to set gatekeeper when i use netmeeting sdk?;P
hi
|
|
|
|
|
Question #1.
Anyone know how to make a tooltip show all the time? I have created my own thumbnail control derived from CWnd for displaying thumbnails... duh. And I want the tooltip to stay on and follow the cursor like i've seen on some webpages.
Question #2.
I'm having a difficult time with the tooltips when I scroll. It seems to get the tooltips all confused so they forget to popup. I think it has something to do with the tooltip rect and when I scroll that rect has moved and is no longer valid.
Anyone have any ideas on these 2 items?
|
|
|
|