|
Hello
Thanks to everyone who replied. I have solved the problem, which was partially of my own making anyway. I am now registering a new message, and sending it from the deep child window. The difference, which is not well documented in the help, is that SendMessage only sends to its own message queue. By using AfxGetMainWnd()->SendMessage I can get a message back out to the upper level windows. I have added a custon ON_MESSAGE handler, and everything is working fine. Thanks for all suggestions, and I hope my problem and solution can help someone else perhaps.
Cheers!
solosnake
|
|
|
|
|
Hi! I'm trying to create a static box into a FormView derived class, i tryed like this:
void CUnits_Sold::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
//This lines had the propose of initialize the pointer, i could not find another way to do it!
CStatic estatico;
CStatic* estatico2;
estatico2=&estatico;
estatico2->Create("Olá", WS_CHILD|WS_VISIBLE|SS_NOPREFIX|SS_LEFTNOWORDWRAP, CRect(30, 30, 100, 100), this);
estatico2->ShowWindow(SW_SHOW);
}
Anyone have a clue why this isn't working?
Thank you
|
|
|
|
|
|
Hi,
I'm trying to port some unix code over to visual c++. Can anyone tell me if there is an equivalent to the unix types sema_t and key_t.
Cheers
Steevie
|
|
|
|
|
You just might want to be a little more specific. Otherwise I could answer like this;
Sure, just typedef int sema_t; and so on. Please explain what these types are used for, and how they are used, and I'm sure you'll get an intelligent answer.
Note however if you're targetting Visual C++ you might get answers referring to the worst "designed" class library of all times (MFC). Perhaps you should initially limit yourself to Win32? Just an idea.
|
|
|
|
|
sema_t is a UNIX POSIX semaphore structure defined as follows
typedef struct {
pthread_mutex_t lock;
pthread_cond_t cond;
int count;
} sema_t;
Then you can define for WIN32
typedef HANDLE pthread_mutex_t;
typedef struct pthread_cond_t {
int waiters_;
CRITICAL_SECTION waiters_lock_;
HANDLE sema_;
HANDLE waiters_done_;
size_t was_broadcast_;
} pthread_cond_t;
|
|
|
|
|
key_t is defined as follows
typedef int key_t
|
|
|
|
|
Hi,
I am trying to make my client area view based on CFOrmView fit exactly into the client area of the parent and resize along with it. ANy ideas would be appreciated. Thanks
|
|
|
|
|
Why not simply rewrite it to fit the client area???
|
|
|
|
|
I found Brian Harts sample code for centering an MDI Child in the MainFrame window and modified it so it works wonderfully now (that part anyways).
Thanks for the response. I'm quite new at this stuff so I wouldnt have known the slightest about how to rewrite it....
|
|
|
|
|
Hi ,
I spawned a modal dialog form from an SDI project and used SetWindowPos to position it and size it the same as the client area of the SDI.. Two odd things happened. First the GetWindowRect function returned funky results (wrong sizing as a result). More seriously, when I dismissed the modal dialog from the OK button or the system cross on the right hand side, I got a debug assert!
However, the same code works great if I use it for a modeless spawned dialog!
ANy ideas why and how to get past the error?
|
|
|
|
|
|
Great! thanks!
ANy clue why the onOk and exit gives me the debug assert?
Thank you so much for the hint.
|
|
|
|
|
|
Hello,
I am trying to access the size of my MainFrame window in an MDI MFC project from the OnSize function. I am trying to fit the child window into the frame when resizing happens and I realise this isnt quite the way since the child gets created only once, but I thought at least what should happen is that the child should fit the frame at startup. In the Childfrm.ppp I wrote:
BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
if( !CMDIChildWnd::PreCreateWindow(cs) )
return FALSE;
cs.x=0;
cs.y=0;
cs.cx=CMainFrame::m_FrameWidth;
cs.cy=CMainFrame::m_FrameHeight;
return TRUE;
}
I got the compile error that CMainFrame was not a class or namespace.
Please help!!!!!
|
|
|
|
|
Your using the CMainFrame class name as a namespace in this case. What you need to do is:
#include "mainfrm.h"
CWnd *pWnd = AfxGetApp()->m_pMainWnd ;
CMainFrame *pMF = static_cast < CMainFrame* > (pWnd) ;
cs.cx = pMF->m_FrameWidth ;
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
Heyyyyyyyy Friendssssssssss
What a surprise...hooo the Codeproject logo changed...
what happend???? nice really nice and funny...!!!haha
Enjoy with CodeProject.....
Love u Codeproject..
Renjith-The CPian.
|
|
|
|
|
Hi,
I want to clear contents of Output Window programmatically. I don’t want to use right click-clear option. Do U have any idea how to do?
Regards;
Uttam Kumar
|
|
|
|
|
Did you try to record a macro?
Best regards,
Alexandru Savescu
|
|
|
|
|
In fact I want to write a function so that using that fuction I can clear my debug window any time. I guess I need to get handle of the
|
|
|
|
|
Can any one please tell me about any open source project, a client application that connects to MSN or Yahoo servers and access these services.
If you know about any such open source project then please tell me, whether available from CodeProject, Codeguru or CVS(SourceForge.net),
Thanks
SattarSingh
|
|
|
|
|
try gaim or amsn (both linux) but open source.
|
|
|
|
|
: class Cat // begin declaration of the class
7: {
8: public: // begin public section
9: int GetAge(); // accessor function
10: void SetAge (int age); // accessor function
11: void Meow(); // general function
12: private: // begin private section
13: int itsAge; // member variable
14: };
//-------------
why we use itsage in private?why dont we use it in public:??whats the advanteges and disadvantages?
|
|
|
|
|
Its called encapsulation. With itsAge not visible outside of the class scope, people cannot change the itsAge variable like:
someCat.itsAge = 57 ;
If the itsAge is a variable upon which the internal state of the object depends, it could be possible for client code to put the object into an invalid state by bypassing the correct accessor functions.
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
Data and member functions kept in the private section of a class are only used internally by th objects of the class themselves. In your example, itsAge is kept private because the designer intnded the users of the class to manipulate this variable thru the member functions GetAge and SetAge . In other situations, you might want to kept a data private because the users do not have to be concerned about its existence.
I'd recommend you try some of the C++ tutorials on the net to get an overall understanding of this kind of issues.
Regards,
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|