|
Your explanation of the problem is wrong.
Friendship grant access to every section of the
class, regardless of where the "friend" line is
laid down.
You better recheck your code to see if you've made
any other change than that
|
|
|
|
|
I've compiled your code (with some syntactic
errors cleared out) and it works fine.
Are you sure the piece of code you're trying to put
to work resembles what you've posted?
|
|
|
|
|
aparently it doesn't, because the example works with you...
here's a stripped out version of the REAL class that wanted te have a friend..
class Class_Profile : public Class_Object
{
// PUTTING THE FRIEND DECLARATION HERE IT DIDN'T WORK
public:
Class_Profile(Class_Main * pMain);
~Class_Profile();
/* interface */
public:
// lots of functions here
/* end of interface */
/* methods */
protected:
// lots of methods
private:
// more methods
/* attributes */
protected:
// a couple of members
// PUTTING THE FRIEND DECLARATION HERE IT WORKED
private:
// lots of members, one of which the one I wanted to acces:
Class_Aggregation<class_display> m_Display;
};
Structured programming vs. chaotic mind boggling
|
|
|
|
|
well ,it definitely beats me. I see no reason why
the code will work locating the friend declaration
in a different line.
It'd help if you could post two real (ie, compilable)
projects showing both behaviors.
good luck joaquín
|
|
|
|
|
Hmmm, I tried to make a sample project which didn't work (in the way I described), but I couldn't do it, because it just works...
Ridiculously enough I then tried to restore my own code in the original project, so that it would produce the error again, but now it just works! I'm absolutely sure I'm doing everything in the same way I did it before, but I just can't get it to not-work anymore...
I must have seem a weird anomaly here, but thankt for the remarks! I was making wrong assumptions there, which was wrong. I'm glad it works now the way it should!
Structured programming vs. chaotic mind boggling
|
|
|
|
|
irreproducible error --> no error!
cheers
|
|
|
|
|
Hi
I have created a CListCtrl with the additional options as Hot
Track Selection & OneClick activate.
I have set the Hover time to 1 Second.
Now, When I try to point to any item ( Hover around 1
second ) then, I create a CRichEditCtrl on the fly on some
condition with some data on to it.
Now, whenever I change to focus to any other item and the
required condition is not satisfied , it waits 1 second to
destroy the earlier editbox .
I would like to remove the display of this editbox as soon as i
move the mouse to some other item.
Which Event should I call implement to do this??
Also, when i move to anyother item it immediately changes
to blue color. Pl. let me know which event gets fired here ?
Thanx in advance
regards
Sankar
|
|
|
|
|
You could subclass CRichEditCtrl, an make it destroy its self when it the mouse moves way from it. Better yet you could create a single CMyOwnRichEditCtrl and have it hidden to begin with, then just show it at the proper time... it could then just hide its self when its no longer needed.
-Ben
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|
|
I have developed an MFC application under Win 98 which handles the WM_CTLCOLOR message quite a lot to alter the color of the text etc.. This works fine on Windows 98 but when I ran it on Windows 2000 the WM_CTLCOLOR message wasn't being handled (or maybe it wasn't being sent?) and so all the colour has disappeared from my application!
Please could anybody tell me why this is happening.
David Osborn
|
|
|
|
|
What kind of control are you altering color of?
I've never seen this problem on W2K...
A code snippet could help people helping you...
Paolo.
|
|
|
|
|
Hello,
Let's say that I have A BHO that is working on the post data when the BeforeNavigate is fired.
i want to assure that i'm thy only BHO that i reading the postdata and there are no other BHO that can get into my PostData, how can i get the list of the BHO and when i need, block them from getting events.
Thanks,
|
|
|
|
|
You can get the list in the same place you registered your BHO.
And you can’t block other BHO from getting events.
Good luck,
Dror
|
|
|
|
|
|
HI! I have this window application and all i had to do was write c code in a function.
But now through this function, i have to create a window, in order to display the results
that were calculated in my function. Please help!!!
|
|
|
|
|
Are you using MFC ? If so, just create a dialog template in the resource editor, and hook it up to show your variables. Plenty of tutorials here on how to do that, but ask if you're stuck.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
I have a problem in which the function GetPrinterDeviceDefaults, (a member function of CWinApp) is failing in debug mode but its working well in release mode.. some one please help me i couldnt figure out whats the problem and i am at my wits end ..
|
|
|
|
|
I seem to remember there was a trick to this too. Could you tell us where you are crashing - in your code, or MFC ? What's the error ? What's the line of code ?
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
I have a problem in which the function GetPrinterDeviceDefaults, (a member function of CWinApp) is failing in debug mode but its working well in release mode.. some one please help me i couldnt figure out whats the problem and i am at my wits end ..
|
|
|
|
|
I created a MCI window in my application:
m_hMCIWnd=MCIWndCreate(this->GetSafeHwnd(), NULL, NULL, "c:\\test.avi");
This creates MCI window with the PlayBar.
All the commands invoked from the PlayBar (or right-click on the playback window), like: View, Speed, Close, Volume etc... are working. But when I choose Open it doesn't do anything!!!
Then I tried to invoke Open dialog programmatically:
LONG xx=MCIWndOpenDialog(m_hMCIWnd)
But this return allways -1 and nothing is displayed ???????
If anyone could help me, I'd appreciate it very much.
Thanks in advance.
Jerzy
|
|
|
|
|
Hi there,
I am sort of new to the world of MFC and I was building a ListView and I need to add column name to the listview at runtime.
As it stands, it appears that pszText of the listview doesn't take CString values. So, tried assigning the CString to a TCHAR array. The only way I could find was by going to through every CString letter and then adding it to the TCHAR array ... i.e.
TCHAR tcArray[500];
ZeroMemory(tcArray);
for(int i =0; szString.GetSize(); i++)
{
tcArray[i] = szString.GetAt(i);
}
I was wondering if there is a more elegant way of setting a TCHAR array to a CString or this is it! i.e. a certain copy function or an overloaded operator, etc...
thanks a lot!
However, this leaves me with all those extra
|
|
|
|
|
strcpy(tcArray, szString)
|
|
|
|
|
There is only a CString to const THCAR* conversion defined. If you need a modifiable buffer from a CString you should take a look at the GetBuffer and ReleaseBuffer member functions.
If you need a TCHAR* and are sure that the string is not modified you can use something like this:
TCHAR* ptchar = (TCHAR*) (const TCHAR*) cstring;
But be carefull.
Oliver
|
|
|
|
|
It's a long time I was last on codeproject.com, therefore i'm not up-to-date
I'd like to know whether someone already programmed
menus that look like the one's in Office XP. I didn't find any resources on this side.
Thanks in advance
|
|
|
|
|
Its not free, but the BCGControlBar library does a good job of them.
-Ben
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|
|
Its not free
It depends on the type of project you'll be working on. If it will be freeware then the license is free, otherwise it will cost you.
|
|
|
|