|
Good question. That's really strange. <insert twilight="" zone="" theme="" song="" here="">
|
|
|
|
|
And to both of you ...thanks
One more question..
How about inside operator== when it is declared a friend function?
Thanks again!
ed
|
|
|
|
|
I usually divide operator== into two cases:
1) bool operator==(const ClassType&)
2 a) bool operator==(const OtherType&, const ClassType&)
2 b) bool operator==(const ClassType&, const OtherType&)
If I only have 1), I keep it as a member of the class. But if I have either 2 a) and/or 2 b), which I always make friend functions since I want symmetry (only 2b can be a member), I also make 1) a friend function for full symmetry.
It really doesn't matter, unless you make them virtual and want to override the behaviour of the operators. But I don't see a good case where that would be appropriate - especially since you can never virtualize 2 a). A 67% fool proof design is not a good design IMO.
--
Try walking in my shoes. You stumble in my footsteps.
|
|
|
|
|
when a funtion is declared as friend into a class, it is used like a member function...
So, what i told you in my precedent post is applyable.
use your BOOL operator== (const CBaseClass&) like you would do with a member function (heard that it as been declared friend
TOXCCT
|
|
|
|
|
Jörgen Sigvardsson wrote:
Are posts delayed?
Not always. We have to stop yours at the border, though, in order to let Homeland Security search them for contraband. We regret the inconvenience...
Heard in Bullhead City - "You haven't lost your girl - you've just lost your turn..." [sigh] So true...
|
|
|
|
|
Ahm. What is homeland security doing in Canada? Wouldn't that be foreignland security, or almost-homeland security, or american-apart-from-the-frenchies-land security?
--
Try walking in my shoes. You stumble in my footsteps.
|
|
|
|
|
We have always had excellent cooperation from our northern neighbors in such matters. All we have to do is quietly hint that we might start cutting down our own forests for lumber once in a while...
Heard in Bullhead City - "You haven't lost your girl - you've just lost your turn..." [sigh] So true...
|
|
|
|
|
ATypeOfPerson& ATypeOfPerson::operator=(const ATypeOfPerson& other) {
if(this != &other) {
CPerson::operator=(other);
}
return *this;
}
--
<british-accent>Pass the jam, would you?
|
|
|
|
|
Hi!
I'm having quite annoying problems when dynamically loading libraries of the type "MFC Expansion Dll".
After I load an optional dll at runtime via AfxLoadLibrary(), my main window fails to locate its resources. Interestingly enough, dialogs are constructed OK, but fail when doing data exchange (when using GetDlgItem() I assume). This happens even when I unload the optional dll again (AfxFreeLibrary()) before creating any main window dlls. As far as I understand it, this should remove the loaded Dll from the resource chain, but it never seems to happen (The AfxTermExtensionModule() function is called though).
I tried to 'correct' the resource handle via AfxSetResourceHandle() but nothing changed at all.
Has anyone had similar problems and can give me a hint what's wrong?
Thanks,
Nick
|
|
|
|
|
MFC keeps a CDynLinkLibrary linked list of dynamic DLL it has loaded. Your extension DLL probably has not properly removed itself from this chain. It also seems it has some resources with the same identifiers as your main program. You will have to walk this chain and manually remove the offending DLL's entry, if it is not being removed when you call the AfxUnloadLibrary.
MFC walks a chain of laoded DLL and stops at the first resource it find, from one of the dynamically loaded DLL, so you need to break the links so that the resources in your DLL are not used isntead of your main program. Now, not sure why the SetReosurceHandle is not working, except maybe MFC is still giving priority to one of the DLL, or you set the resource handle from a different thread, since it is thread-specific.
|
|
|
|
|
Thanks for the reply. It shed light on some details I wasn#t aware of. Anyway, I discovered that, for some reason, the dll was not unloaded at all (the statement was never executed due to some weird conditions I still don't get). Restructuring the code lead to unloading of the dll and now all works smoothly.
It can be so simple sometimes...
Nevertheless I got some more insight in the works behind the scenes, so this experience wasn't completely useless
Nick
|
|
|
|
|
I have write a SERVICE that displays an icon in system tray.
Now, i m starting the SERVICE manually thru SERVICE template..........and then LOG-OFF from the system .........and then RE-LOGIN to the system and i found SERVICE template that SERVICE is running and by looking at TASK MANAGER i found out that EXE of SERVICE is also running...but the problem is that program does not displays icon in system tray.
I wish to display icon in SYSTEM TRAY whenever user RE-LOGIN or restart the COMPUTER.
|
|
|
|
|
I guess that's because the taskbar where your Icon was registered is closed when logging off and thus your Icon is 'forgotten'.
Right now, I don't know of any smart way to determine when a user logs on, so the simplest approach would be a timer that (re-)registers the TaskIcon with the task bar in a reasonable interval, but I'm sure there are more elegant ways to do this via notifications.
Nick
|
|
|
|
|
Hi Nick,
Thanks for the answer.
But, i m switching between 3-4 icons to be displayed in system tray depending on situation and use of times creates the problem of repaiting the screen and which results into total distoration of screen.
So id there is another effective solution then pls let me know or any other friend knows about it then also it will be very thankful.
|
|
|
|
|
Hi Nick,
Thanks for the answer.
But, i m switching between 3-4 icons to be displayed in system tray depending on situation and use of timer creates the problem of repaiting the screen and which results into total distoration of screen.
So id there is another effective solution then pls let me know or any other friend knows about it then also it will be very thankful.
|
|
|
|
|
I don't understand what you mean. Timers should have no impact on repainting of the screen. you only call Shell_NotifyIcon from the timer routine... I don't see how that should distort your screen...
|
|
|
|
|
Hi everybody,
I try to use the class library for the DirectMusic MIDI created by Carlos Jiménez de Parga found on 'the code project', but I'm not use to C++.
I will need a interface: what would be the best solution ? Win32, ATL, MFC, Framework.NET. I have too many options. Can someone tell me the steps to create a new project who's working. It will be a good starting point.
Thanks a lot.
|
|
|
|
|
Hi guys
I've got an app where I only do a CenterWindow() in InitInstance and in w2000 it opens correctly and in XP the scrollbars appears and not all my main window is visible. Have you experienced something similar? DO you know why?
Best Regards
Doc
|
|
|
|
|
Maybe you have different resolution in defferent windows so it looks like that in XP.
Mazy
No sig. available now.
|
|
|
|
|
Same resolution in both SO. It's an amazing bug.
Doc
|
|
|
|
|
In fact I need to adapt some piece of code whether the application is running on Win2k+ or Win9x.
Thanks for your help
-MyttO
|
|
|
|
|
GetVersionEx()
Mazy
No sig. available now.
|
|
|
|
|
|
I found this true!
//------------------------------------------------------------------------
CString GetWinVersion()
{
CString Ver;
OSVERSIONINFO osinfo;
osinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&osinfo);
Ver.Format("Windows Version %1d.%1d", osinfo.dwMajorVersion, osinfo.dwMinorVersion);
return Ver;
}
//------------------------------------------------------------------------
I'll TRY my best
|
|
|
|
|
Thank you all for fast answers!!
-MyttO
|
|
|
|