|
|
How can I updat the dialog title with the employee name when a new employee is selectd from a list control? This list control is in a tab control property sheet.
Elizabeth
|
|
|
|
|
SetWindowText(hDlg, ...);
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
The list control's parent window is the dialog representing the tab.
The parent of the 'tab' is the property sheet.
Get the parent of the parent of the control and set its window text.
Seting the window text of a dialog changes the dialog's title.
The memories of a man in his old age are the deeds of a man in his prime.
|
|
|
|
|
Through Create I get the CWnd* pointer to the parent and save it in m_pParentWnd (cant cast it to parent due to problems with circular includes). However to use a certain function I need the m_hWnd of the parent. Is this the same thing as the m_pParentWnd? The docs dont make it clear and my suspicion is that they arent the same and I am hoping I can get m_hWnd easily if m_pParentWnd is all I have to go by........BTW the m_pParentWnd is a generic CWnd*, and I am unable to cast it to my specific parent class due to unshakeable circular include issues which dont let me #include "parent.h" to do the casting.
Help!
Thanks,
ns
|
|
|
|
|
Hi ns, long time
However to use a certain function I need the m_hWnd of the parent. Is this the same thing as the m_pParentWnd
AFAIK, GetSafeHwnd(m_pParentWnd) is the HWND you're after. Anyway, experiment a little, your question surely can be answered with a trivial test.
BTW the m_pParentWnd is a generic CWnd*, and I am unable to cast it to my specific parent class due to unshakeable circular include issues which dont let me #include "parent.h" to do the casting.
Ummm... I'd need to know the header structure of your classes, but this kind of circularity can be solved most of the time using forward declarations. Consider
#include "B.h"
class A
{
B* b;
};
#include "A.h"
class B
{
A* a;
};
#include "A.h"
...
#include "B.h"
... This does not compile due to circular references. The way out consists in cutting the knot somewhere with a forward declaration (or with two of these, for simmetry reasons, if this is applicable):
class B;
class A
{
B* b;
};
class A;
class B
{
A* a;
};
#include "A.h"
#include "B.h"
...
#include "B.h"
#include "A.h"
... Get the idea? Hope it helps, regards,
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi,
So sorry about the late response. For some reason i wasnt able to find the thread when I posted it, but I am going to try out your suggestion now. Because my code is full of bulky custom SendMessages since I hadnt been able to get the parentWnd.
Appreciate your responses!
|
|
|
|
|
Hi,
By calling GetSafeHwnd() you can obtain the m_hWnd from m_pParentWnd,
ie:
<br />
HWND hParentHandle = m_pParentWnd->GetSafeHwnd();<br />
GetSafeHwnd will get the handle to the parent window event if m_pParentWnd is NULL (if m_pParentWnd is NULL then hParentHandle will be NULL also).
quick tip, to get around of circular include references you could try the following code:
in the header file:
<br />
class CMyParentClass;<br />
<br />
class CMyChildClass <br />
{<br />
CMyParentClass* m_pParentWnd;<br />
};<br />
so instead of #include "MyParentClass.h" you can declare the class header, and then #include "MyParentClass.h" in the cpp source.
Hope this helps ,
Andy V
andyvinc at hotmail dot com
|
|
|
|
|
Wonder if anyone can help. I have desinged a GUI which will need to use an exe to take one input value from an edit box and return 2 outputs which will be displayed in an edit box within a pop up dialog.
Anyone done anything of the sort? I have no input or output parameter values, just know that the exe will take one input and return 2 outputs.
Need help on this asap. Anyone know anything please please reply asap!
Thanks
|
|
|
|
|
With the little control you've got over the external app, you'll have to resort to simulating the user interaction on it from your main program. Once you launched the external app, FindWindow can give you the HWND of its window. From here you can send messages to this window (or its child controls) to feed the editbox (WM_SETTEXT ), trigger the calculation (BN_CLICKED ) and retrieve the results (WM_GETTEXT .) The process is neither simple nor excessively robust, but I guess it's the only option available.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I need a small snippet of code that will allow me to take a snapshot of any window I specify and store it in an CBitmap ?
I once found a small snippet but cannot find it again for the life of me
Anyone know where I can find something? Or maybe even have the code for me
Thanks
I'm drinking triples, seeing double and acting single
|
|
|
|
|
See if either of these articles help:
http://www.flounder.com/printbitmap.htm
http://www.flounder.com/screencapture.htm
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Coolness, thank you i'll check it out
I'm drinking triples, seeing double and acting single
|
|
|
|
|
If I have an SDI app with thats CFormView based.
How can I change the title from "Untitled" to whatever I want?
|
|
|
|
|
From your CFormView class
GetDocument()->SetTitle("My title here");
Michael
|
|
|
|
|
I want the following questions to be answered
1. From my SDI, it seems like the wizard had done a lot of things for me, including creating the serialize function. From the example, the class is derived from CObject. I believe any class derived from CObject (or CObject is the parent class of any other class)can be serialized. From my code, the wizard derived the class from CDocument. Since CDocument is derived from CObject, I believe there is no problem. Am I correct?
From my program also, instead of using DECLARE_SERIAL(CLassName) macro, the wizard uses DECLARE_DYNCREATE instead. I believe DECLARE_DYNCREATE can do the same as DECLARE_SERIAL. I would be happy is someone can point me the difference.
2. I do have a lot of dialogs in my document. As you know, each dialog has its own class. Each class has its own member function for that dialog. For instance, I have a class COption, in that class, I have member function like
m_iNumber, m_strName, m_strData etc. I want to know if I can get access to these member variabel from my document class for the serialization, which I don't think so? Do I have to create another class or create some global variables or member variable in my application class to store the values in order to access them from the document class for the serialization by using AfxGetApp()->member_variable?
3. Since AfxGetApp() only get access to the application class, if I put the member variables in the document class, is there any function like AfxGettApp() that I can use to get access to these variables in the dialog classes?
|
|
|
|
|
(CFrameWnd*)(AfxGetApp()->m_pMainWnd)->GetActiveDocument() should give you a pointer to your CDocument (which you probably will want to downcast later to the actual CDocument -derived class you're using.) You can use the document to store all data that must be serialized.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
How can a child window to send message to another child window without using main frame window [MDI]?
using Registered message, is good idea?
|
|
|
|
|
GetDlgItem(IDC_MYCONTROL)->SendMessage()
I'm drinking triples, seeing double and acting single
|
|
|
|
|
Hi all,
i have a modal dialog. i've created a button in run-time using new operator to CButton class, and then Create;
my question is i want the dialog to catch the pressing of the button or other buttons created at run-time for that matter.....
how to do that???
i know i need to use reflection or something like that.. i would like to see some sample code ....
Thanks in advanced
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
It's to my understanding that message reflection is MFC compile time only.
If your creating windows dynamically I don't think there is a way to map handlers using macros So I would suggest probably using OnCommand() and using an if statement:
MyDialog::OnCommand( WPARAM wParam, LPARAM lParam )
{
if(LOWORD(wParam) <= IDC_DNYCTRL_FIRST && LOWORD(wParam) >= IDC_DNYCTRL_LAST)
}
HTH
Cheers
I'm drinking triples, seeing double and acting single
|
|
|
|
|
Hockey wrote:
if(LOWORD(wParam) <= IDC_DNYCTRL_FIRST && LOWORD(wParam) >= IDC_DNYCTRL_LAST)
Shouldn't this be:
if(LOWORD(wParam) <= IDC_DNYCTRL_LAST && LOWORD(wParam) >= IDC_DNYCTRL_FIRST)
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Something like that
I must have typed it with my eyes closed
I'm drinking triples, seeing double and acting single
|
|
|
|
|
Add a button on the dialog use dialog editor, and appoint the same ID as you call CButton::Create.Than you can add message handler for that button.After a the message handler has been added, you can delete that button on the dialog, and create it at run-time.
Note:using the same ID is crucial.
This is very tricky techniques.
|
|
|
|
|
Hi Yaron,
wouldn't help you to create your button within the dialog editor and hide/show it with
ShowWindow(TRUE/FALSE)?
Bunburry
|
|
|
|