I use several dialogs in my project that are hosted in a splitter pane. The dialogs are created with new and create. They show up normal. Then I like to put them in a list or assign it to a general member. Something like this:
In some class:
CWindow * m_pWindow = NULL;
In another class:
CLocProp *pdlgProp = new CLocProp;
// here pdlgProp is send with sendmessage as a LPARAM (pointer is casted)
// in the class with the messagehandler:
m_pWindow = (CWindow*) lParam;
delete m_pWindow; // Debug assetion that this pointer is not valid
In the good old MFC days this was not a problem. With all the template stuff it gets difficult to hold a grip of this Windows stuff. Is it save to cast it to a CWindow*? If not, how should this be done? What if I want to put dialogs of a different type in a list. Then I need a common base class (CWindow).
Also, if I don't send the dialog through the lParam parameter, An assign it to CWindow* directly after its creation and then delete it, I also get the assertion.
Do you get "Out Of Memory" when you open the project file? Maybe you are just running too many apps at the same time...?
Try to shut down VC and delete all auto-generated files in the project dir(after backing them up, of course;) ): dsw, clw, aps, ncb, opt, plg etc. Also delete all temporary files in the Release & Debug directories. Then open the dsp and recompile. This usually helps when VC starts acting strange...
"Aagh!! I'm a victim of a Random Act of Management!"
I'm a little confused, maybe someone can point me in the right direction. I have never done bitmaps in win32 apps before, and no I don't mean I've never put a bitmap in a dialog, or toolbar, I mean displaying on the actual app. I need help because I have a project due in a week or so, and need to display a certain bitmap in the app. Yes, I took training, but you tend to forget what you don't need over the years, and I need to know what header file to insert into the main program source file. I REALLY NEED HELP ON THIS ONE.
"The world doesn't care about your self esteem. The world expects you to get something done BEFORE you feel good about yourself." ~ Bill Gates
I want to learn how to create a toolbar which docks on the desktop, similar to the LiveTask bar used with Creative Soundblaster products. I want to be able to autohide, and add other menus / controls to it. The thing i have in mind is also similar to the office startup toolbar or even the windows start menu bar that pops up at the bottom of your screen.
Whats it called and where can i find some sample code / further reading ?
I have a regular DLL using MFC and within this DLL is a worker thread. While this thread is running, it is trying to update a dialog box (owned by the DLL) with some information on the thread's progress. Everything works OK except that the WPARAM and LPARAM values I pass to the dialog are not getting through, and are always zero. Is there some special reason for this?