|
You can create a user message. Use PostMessage from InitDialog() to call the function.
(WM_USER+1 and so on)
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Can you be more specific
whitesky
|
|
|
|
|
|
Thank you Anil and thank you every one.
Ayesha
|
|
|
|
|
Suppose I derive Add and Multiply from IUnknown and then
derive Calculator from Add and Multiply as shown below
IUnknown IUnknown
| |
ADD Multiply
\ /
\ /
Calculator
then how many copies of (QueryInterface,AddRef, Release ) will be there in Calculator,If one then explain how.
Prior to this question I had said that Multiple Inheritance has a disadvantage of name ambiguity.(hence above was the counter question by an interviewer)
|
|
|
|
|
This question is not clear. In COM interfaces can only be derived from one base class. IUnkown is an interface. Calculator clearly isn't a COM interface as it uses multiple inheritance. This suggests that this is an implementation hierarchy: Calculator is a C++ class that is using multiple inheritance to implement COM interfaces. It's still not clear what ADD and Multiply are. Their names suggest they are not interfaces. This question is too vague.
Steve
|
|
|
|
|
ADD and Multiply Are Interfaces
|
|
|
|
|
Then there is one implementation for each. This is how multiple inheritance works in C++.
Steve
|
|
|
|
|
Hi!
Perhaps it's a silly question, but at the moment I'm really stumped:
I need a window to receive messages from a different application for synchronisation purpose.
In order to have an easy way of showing which messages were received, I've created a dialog (CDialog derived) with a ListBox to trace the messages.
Because I want to use SendMessage(HWND_BROADCAST,...) (and not explicitely find out the hWnd of my dialog), I'd have to make the dialog a TopLevel window.
Unfortunately, I've completely failed to achieve this so far. I thought creating the dialog without giving a parent window would create a TopLevel window, but obviously I was wrong - my SendMessage wasn't received and Spy shows a parent window for my dialog...
Can anyone please give me a little push in the right direction?
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
mav.northwind wrote: Unfortunately, I've completely failed to achieve this so far. I thought creating the dialog without giving a parent window would create a TopLevel window, but obviously I was wrong - my SendMessage wasn't received and Spy shows a parent window for my dialog...
SetWindowPos(&wndTopMost, 0, 0, ....) creates a top most window. Is this what you want.
Nibu thomas
A Developer
Programming tips[^] My site[^]
|
|
|
|
|
Hi!
Thanks for your response, but this is not what I need.
I don't need the window to be top most (the dialog isn't visible at all in release mode), but TopLevel.
Only TopLevel windows receive messages sent with HWND_BROADCAST ...
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
mav.northwind wrote: but TopLevel.
All TopLevel windows have Desktop window as their parent. Use SetParent to set the parent to Desktop Window.
Nibu thomas
A Developer
Programming tips[^] My site[^]
|
|
|
|
|
Thanks, but that doesn't work either. I tried setting the parent to the desktop window but Spy++ still shows the main application's window as the parent.
I guess I'll opt for the own window class and FindWindow.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
It seems that an MFC application cannot have more than one top-level windows. Therefore, the messages sent by SendMessage(HWND_BROADCAST,...) always reach the main application window instead of your dialog. (Information about how to extend MFC to support multiple top-level windows con be found at http://www.codeproject.com/docview/multitop.asp[^]).
As a possible solution of your problem, since you surely will process broadcasted messages in your main application doing main synchronization tasks, you can simply call there a member function of your debug dialog. (For instance, you can keep a pointer to your debug dialog, which should be null when the dialog is not displayed).
Hope this will help.
|
|
|
|
|
Hi and thanks alot!
It seems as if I have to say goodbye to my initial idea . The dialog is part of a DLL that's being loaded by a third-party application I cannot influence.
Then I guess I'll try to give my dialog a special window class I can use in a FindWindow() from the external application and not use HWND_BROADCAST.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Unfortunately, my other idea (setting the class name of the dialog) doesn't work either, because PreCreateWindow (where the class name can be modified) doesn't get called for CDialog derived classes.
Is there anything else I can try?
Regards,
mav
--
Black holes are the places where god divided by 0...
-- modified at 5:21 Friday 2nd June, 2006
Although I don't really like the solution, I think I'll go for FindWindow with a special window title. That way I can at least find the dialog...
Thanks für the help.
|
|
|
|
|
If you just need a dialog box for simple passive spying of your broadcasted messages, I think you can try to create a separate dialog-based application. In this case the dialog window is expected to be the top-level one. You will be able to start this debugging dialog only when you need it, even if the main receiver application is stopped.
|
|
|
|
|
Thanks for the suggestion, but (as always) it's not as simple as that.
I have the dialog in my DLL because I need to raise events to the hosting application from within the same thread that loaded my DLL.
Some events I get come in via remoting from a different thread, so I have to "marshal" (big word for sending a message ) them to the other thread by sending a message to the dialog and have the dialog raise the event.
Now I not only have to send messages to the dialog from within the DLL (where I have access to the dialog's HWND), but from other applications as well. That's the whole reason for my problems...
Well, the constant window title at least works, so I think I'll have to use it for now until I find a better way.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Hai to all of you
i am new in VC++ and i have make a simple application But
one of the form of that application contain some error..........
Like Whenever i click any button of that form then MessageBox Generate a Message Could not add new member
Note: I have also write the code of button ,yet its not responding accordingly . i don't know where i am lacking
Plz Tell me.....
mailing me
Yogi
|
|
|
|
|
can you show error message and you get this error only in this application or all projects
whitesky
|
|
|
|
|
how to change the background color of a custom color dialog
|
|
|
|
|
of course its not a good way but maybe its some helpful to you
<br />
class CMyDialog: public CColorDialog<br />
{<br />
public: <br />
DECLARE_DYNCREATE(CMyDialog)<br />
CMyDialog();<br />
~CMyDialog();<br />
DECLARE_MESSAGE_MAP()<br />
<br />
afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);<br />
};<br />
<br />
<br />
<br />
<br />
IMPLEMENT_DYNCREATE(CMyDialog, CColorDialog)<br />
<br />
BEGIN_MESSAGE_MAP(CMyDialog, CColorDialog)<br />
ON_WM_CTLCOLOR()<br />
END_MESSAGE_MAP()<br />
<br />
CMyDialog::CMyDialog()<br />
{<br />
<br />
}<br />
<br />
CMyDialog::~CMyDialog()<br />
{<br />
}<br />
<br />
<br />
HBRUSH CMyDialog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)<br />
{<br />
HBRUSH hbr = CColorDialog::OnCtlColor(pDC, pWnd, nCtlColor);<br />
LOGBRUSH logBrush;<br />
logBrush.lbStyle = BS_HATCHED;<br />
logBrush.lbColor = RGB(100, 192, 192);<br />
logBrush.lbHatch = HS_CROSS;<br />
if(pWnd==this)<br />
SetWindowText("Test");<br />
return CreateBrushIndirect(&logBrush);<br />
}<br />
whitesky
|
|
|
|
|
is there any way to change the color of the buttons and the static texts??
|
|
|
|
|
See WM_CTLCOLORSTATIC
whitesky
|
|
|
|
|
Hello everyone,
I have a UI application and I need to display context menu according to whether user clicks inside a polygon or not. So, I think I need to use some algorithms which can check whether a point is inside a polygon.
Does anyone have any ideas or reference materials?
thanks in advance,
George
|
|
|
|