|
Like many things in MFC, there are many answers here and it comes down to personal choice and your system design:
1) You could call the document's UpdateAllViews function and pass the desired message & data that way.
2) You could store the view pointers in a central place (such as the app object or the mainframe object) and then call a member functions to either send the data from that main object or to return the pointer so that you could then directly call the view's member functions
In situations like these there is no right or wrong way although I typically like to use the built in UpdateAllViews method.
Cheers,
Tom Archer
Author, Inside C#
Please note that the opinions expressed in this correspondence do not necessarily reflect the views of the author.
|
|
|
|
|
I tend to store pointers to each view in my CWinApp derived class. I'm not sure it is the best way, but it works well for me as I tend to have multiple views connected to just one document class.
Michael
Communication is the first step towards enlightenment.
|
|
|
|
|
Hello, the codegurus around the world.;)
Even though I don't know your code in detail, I guess that you will
change the location of your function in View2.
If the some funtions can share between View2 and View1, try to put
these functions to the other classes like Doc, Frame or WinApp.
This is mainly because if view2 doesn't get the current focus,
we don't need to send the message or call the function.
If the view2 gets the input focus, we should restore these data to update.
Or anyone has better idea?
Please, don't send me your email about your questions directly.
Have a nice day!
Sonork - 100.10571:vcdeveloper
-Masaaki Onishi-
|
|
|
|
|
Okay. I am using a split windows.
Here is the solution for a splitter design.
-----
CMyView2 *pView = reinterpret_cast<cmyview2 *="">(m_wndSplitter.GetPane(1, 0));
pView->SendMessage(WM_USER_TEST, 0, 0);
return 0;
-----
Thanks to LordShade of GameDev for for the pointer.
Kuphryn
|
|
|
|
|
You didn't mention that you're using a splitter. In that case, the views are created in the mainframe and can be accessed through the mainframe's splitter window member variable.
Cheers,
Tom Archer
Author, Inside C#
Please note that the opinions expressed in this correspondence do not necessarily reflect the views of the author.
|
|
|
|
|
Thanks.
I did not think that the splitter window would affect it.
Kuphryn
|
|
|
|
|
No problem. The effect it would have on anyone's answer is that with a splitter, you already have a "built-in" place to get the views (the CMainFrame::m_wndSplitter).
Anyway, no worries. I'm glad you got your code to work. Just remember to be a bit more detailed when asking for help as it aids others in getting you the response you need.
Cheers,
Tom Archer
Author, Inside C#
Please note that the opinions expressed in this correspondence do not necessarily reflect the views of the author.
|
|
|
|
|
I definitely will be more descriptive in the future.
Thanks,
Kuphryn
|
|
|
|
|
Is any way to accept messages from child window ==> parent windows for processing(translate message). And if message isnt WM_LBUTTONDOWN send message to child window. (child window never conceive WM_LBUTTONDOWN but user click on it - without WS_DISABLE)
Wiizi
|
|
|
|
|
Have a look at PreTranslateMessage, I think it will do what you are wanting.
Michael
Communication is the first step towards enlightenment.
|
|
|
|
|
You need to override the WindowProc function. Here's an example of doing that where I'm not allowing the OK button's normal processing to continue (by returning FALSE from the function).
if (message == WM_COMMAND && LOWORD(wParam) == IDOK)
{
TRACE("I got this click and I'm not allowing it to process!!");
return FALSE;
}
If I want the button to handle it's message, then I simply return the return value of the base class' WindowProc function:
return CDialog::WindowProc(message, wParam, lParam);
Also, you can use the hwnd of the control (I used the resource id) by referencing the lParam argument (instead of the low byte of the wParam).
Cheers,
Tom Archer
Author, Inside C#
Please note that the opinions expressed in this correspondence do not necessarily reflect the views of the author.
|
|
|
|
|
I worte a litte command line programm where i can access ReiserFS Partitions. Now i want add this capability to the explorer. So anyone knows if its possible to add for eg. a new drive in the explorer window...
Thanks
|
|
|
|
|
There are two approaches you can take. One is to write a device driver, which can be assigned a drive letter. The other is to write a namespace extension which can add a folder under My Computer (along side Control Panel). I have a tutorial on namespace extensions in the Shell section.
--Mike--
Buy me stuff!
Like the Google toolbar? Then check out UltraBar, with more features & customizable search engines!
My really out-of-date homepage
Big fan of Alyson Hannigan and Jamie Salé.
|
|
|
|
|
Thanks Michael. I made it now with namespace extensions, well its a good sollution but cause i have some time atm. (student i want try it with a device driver. Anyone have some ideas or links about device driver?
|
|
|
|
|
any one who can help me about dragndrop a bitmap in vc++
if anyone has any information regarding it, please mail me if u can, that would be a lot of help,
thanks in advance
Ashok Singh
<west end="" india="">
|
|
|
|
|
You need to be more specific about exactly what you're attempting to do.
Cheers,
Tom Archer
Author, Inside C#
Please note that the opinions expressed in this correspondence do not necessarily reflect the views of the author.
|
|
|
|
|
Hi
Do you know how can I get array or supported properties of control at runtime ?
Wiizi
|
|
|
|
|
Hey all.
I use CreateWindowEx to create a Rich Edit Control. I use WS_EX_RIGHT | WS_EX_RTLREADING to make it right-aligned on a Hebrew OS.
It works well on Windows 2000, but on a clean installation of Win98 Heb-enabled, the content of the Rich Edit Control is left-aligned. On a not-so-clean installation of Win98 (which has Visual Studio, Office, etc.) - it displays correctly.
The problem is not with comctl32.dll - copying that file from the "good" win98 to the "bad" win98 doesn't solve it.
Any ideas??
|
|
|
|
|
|
I can't thank you enough!
That's the cause... Everything works great with Rich Edit Control 3, but not-so-great with version 2.
Do you have any idea WHY version 2 doesn't right-align correctly?
Thanks!
|
|
|
|
|
Hey,
Anybody know if it's possible to have two different "panes" in a console app. As in frames in a website... where you can have one frame with ceratin output [probably static] and the other frame will have different output.
Now taking suggestionsfor a new sig. please email me all suggestions.
|
|
|
|
|
I believe there is no direct support for console based panes. You'd have to simulate the whole thing with code and it may not be worth the effort.
Nish
The rumours that I am an AI bot are absolutely false. These rumours have been propogated by *them* to focus all the attention on to me, while *their* bots take over the planet. Thank y%%%% Divide by zero. Cannot proceed. Abort(y/y)?
|
|
|
|
|
Your probably right. It mightn't be worth the effort.. but it would have been nice for the program I'm doing.
Now taking suggestionsfor a new sig. please email me all suggestions.
|
|
|
|
|
The Curses library allows multiple panels or "windows" in text terminal or console applications. There are commercial implementations of Curses for windows, and I suppose there's a port of the free ncurses library somewhere.
|
|
|
|
|
I would like to save the printer info in some variables so that the user can just press any button and volla. I want to code this myself into one of my controls. I also want to avoid doing a DoModal on CPrintDialog because this would stop my thread while the dialog is open. Also, I do not believe the dialog can do Modeless.
Can I save the HDC to the printer and its DevMode stuff to a member variable in my control without any problems? Will it interfere if there is another app and its uses the printer or another printer driver etc?
Appreciate any responses.
|
|
|
|