|
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;
pdlgProp->Create(m_hWnd);
// 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.
Please help!
|
|
|
|
|
What can I do to reconstruct the project ????
|
|
|
|
|
You don't need the dsw file to open a project. If you still have the dsp file (the actual project file), open that instead and a new dsw will automatically be generated.
--------------
"Aagh!! I'm a victim of a Random Act of Management!"
|
|
|
|
|
|
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!"
|
|
|
|
|
You rescued me !!!!!
|
|
|
|
|
I'm sure this question has been asked and aswered before, but I couldn't find it. How do I set the color of the text in a static text box?
Thanks!
|
|
|
|
|
Override WM_CTLCOLOR for the CStatic.
Christian
#include "std_disclaimer.h"
The careful application of terror is also a form of communication.
Eagles may soar, but weasels don't get sucked into jet engines.
|
|
|
|
|
When I set the m_strFilter on an SQL query as
m_pSet->m_strFilter="[MyStringField] ="+"'"+MySearchString+"'";
Everything work great unless there is an apostrophe in MySearchString. Then the Jet engine coughs and sputters to a halt.
Any ideas on how to handle CStrings with single qoutes in them?
Richard
|
|
|
|
|
CString str ="[MyStringField]\" + "MySearchString + "\"";
Cheers!!!!
Carlos Antollini.
|
|
|
|
|
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
|
|
|
|
|
|
Hi,
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 ?
Thanks
Jase
|
|
|
|
|
You want to read this article,
Shell application toolbars.
http://www.microsoft.com/msj/defaulttop.asp?page=/msj/archive/s274.htm
Cheers,
-Erik
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
My thoughts are my own and reflect on no other.
|
|
|
|
|
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?
|
|
|
|
|
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.
Can you post the code running in worker thread that updates the dialog?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
thanks, but I didcovered a much simpler way to do this, which works well.
|
|
|
|
|
Is is possible to disable the Cancel button, or to get rid of it?
I tried to GetDlgItem(IDCANCEL)->EnableWindow(FALSE), but the program asserted.
Thanks,
Jon Sagara
"Go Banana!" -- Ralph Wiggum
|
|
|
|
|
Are you calling it in your sheet's OnInitDialog? Or where?
And what code asserts? ASSERT(::IsWindow(m_hWnd)) ?
|
|
|
|
|
Paolo,
Thanks for the response. Your question triggered my brain, and I figured it out. Here is the correct (or working, anyway) code:
pSheet->GetDlgItem(IDCANCEL)->EnableWindow(FALSE);
Thanks again,
Jon Sagara
"Go Banana!" -- Ralph Wiggum
|
|
|
|
|
I need one I want need some text to blink on a dialog.... You know, like a dialog that pops up and the word DOWNLOADING blinks until the download is complete....
Any ideas?
- John
|
|
|
|
|
Set up a timer and call ShowWindow(SW_SHOW/SW_HIDE) on alternate calls. I'd override the static control and make it nice and internal. Then you can use it over and over.
Christian
#include "std_disclaimer.h"
The careful application of terror is also a form of communication.
Eagles may soar, but weasels don't get sucked into jet engines.
|
|
|
|
|
I'm not quite sure how I should do this. I need it to blink, while the the rest of the application keeps running...which means I need to have a seperate thread for the blinklabel?
|
|
|
|
|
Not at all. Have you not used WM_TIMER before ? There is a tutorla here on how it's done, but the essence of it is on startup:
SetTImer(42,1000,NULL);
in OnTimer
if (nIDEvent==42) // I may have the variable name wrong ;0)
{
m_bFlash = !m_bFlash; // You need to create this
m_MyStatic.ShowWindow(m_bFlash ? SW_SHOW : SW_HIDE);
}
Christian
#include "std_disclaimer.h"
The careful application of terror is also a form of communication.
Eagles may soar, but weasels don't get sucked into jet engines.
|
|
|
|
|
I am creating these four radio buttons dynamically.
The behavior is so random and confusing. At some point I got some text, and then I can't get it anymore. I have been told by friends at this forum that maybe the width is not enough, one time that fixed the problem but not anymore!!!!!!!
Here is the code:
if (OneGrpPosition != NULL)
{
pConfig->m_OneRadioBtn = (CRadioBtn *) (((CGrpBox*)pConfig->m_OneGrpBox)->m_GrpRadioBtn).GetNext(OneGrpPosition);
int len= ctrlRect.right - ctrlRect.left;
ctrlRect.right = ctrlRect.left +len+ 60;
if (ctrlRect.right >= 542)
::MessageBox(0, "Running out of screen width to display radio button", "Warning", MB_OK);
ctrlRect.bottom = ctrlRect.top + 25;
if (nDex == 0)
//
{
m_RadioButtonArray[nDex].Create((pConfig->m_OneRadioBtn)->m_RadioLabel,
WS_GROUP | WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON, ctrlRect,this, (pConfig->m_OneRadioBtn)->m_RadioGuiID );
m_RadioButtonArray[nDex].SetFont(&m_font, TRUE);
}
else
{
m_RadioButtonArray[nDex].Create((pConfig->m_OneRadioBtn)->m_RadioLabel,WS_CHILD| WS_VISIBLE | BS_AUTORADIOBUTTON, ctrlRect,this,(pConfig->m_OneRadioBtn)->m_RadioGuiID);
m_RadioButtonArray[nDex].SetFont(&m_font, TRUE);
}
nDex= nDex+1;
ctrlRect.left = ctrlRect.right +10;
//This radio button has already been added to the memory structure
}
}
//This ia a new radio button that needs to be added to the memory structure
}
I am in Paradise.
Voltaire
|
|
|
|