|
can u please explain the problem, rather than just sending the code.
Величие не Бога может быть недооценена.
|
|
|
|
|
Hi, Im having MDI application.
In that all childframe have system menu.When i minimized it minimized to down.When maximized its get maximized to full screen.
But what i want is, if i press maximize the window should maximizd to limited width and height.
How can i do that?
I saw OnGetMinMaxinfo(),but i dont know wat parameter should use only for maximizing to certain height and width.
Pls help me.
Anu
|
|
|
|
|
I think you forget to check MINMAXINFO parameter of the OnGetMinMaxInfo(),
change the value of lpMMI->ptMaxTrackSize, then you can limit the width and height.
Величие не Бога может быть недооценена.
|
|
|
|
|
yes, i can set width and height of window.
But i want to set X and Y position of window.
How can i do that?
Anu
|
|
|
|
|
I'd like to create an application that is capable of hooking all input, ie mouse movement and keystrokes that the system recieves. No, I'm not writing a keylogger. If possible, I'd then like to stop those messages in their tracks, add them to a container, and then resend them later on after a specified time period in order to simulate an input delay.
My concern is with the hooking/blocking messages part. Is it possible to do this globally for the entire system?
|
|
|
|
|
Yes it is. Take a look at the function SetWindowsHookEx especially the values WH_KEYBOARD_LL and WH_MOUSE_LL
for the idHook parameter.
With this hooks you can capture every mouse and key input and you also will be able to stop forwarding these messages to the next "hooking" applications and the focused window.
Edit: Except the keystroke "ctrl-alt-delete". You will be able to capture this keystroke, but you will not be able to stop forwarding this keystroke!
Greetings
Covean
|
|
|
|
|
|
Hi, folks
I am thinking of writing a program which opens two files in one window. and these two files needs to be scrolled simulateneously.
(I have to put the scrollbar here as I have multiple views).
I plan to use such a structure
CMDIChildWnd, which has a scrollbar, and CSplitterWnd, its role is to change answer scroll related message such as OnSize, OnScroll.
CView, handles OnDraw, displays file.
CDocument, which has files info.
(I need to take advantage of OnOpenDocument)
the question is, when I load a file (which is handled by CDocument) either by OnOpenDocument() or some user defined open file function, how could I update CMDIChildWnd?
thanks in advance!
baum
|
|
|
|
|
You can call UpdateAllViews with a hind to update a particular view
Please refer for more details
[^]
Величие не Бога может быть недооценена.
|
|
|
|
|
thanks for the reply.
but updateview doesn't solve my problem, as scrollbar doesn't belong to a specific view (it belongs to CMDIChildWnd), and I need to update it too.
any idea?
thanks!
|
|
|
|
|
I think you dont need to update the CMDIChildWnd.
Величие не Бога может быть недооценена.
modified on Tuesday, January 19, 2010 12:19 AM
|
|
|
|
|
it is not, it is a CFrameWnd, container of CDocument and CView.
|
|
|
|
|
I think what you want to achieve is update two scroll views from the document?
i.e on update the two views simultanously?
Величие не Бога может быть недооценена.
|
|
|
|
|
exactly.
but I don't want to use two scrollbars, is it achievable?
|
|
|
|
|
I hope you want two Views, both derived from CScrollView? and using a single class.
If so then UpdateAllView is what you need.
Величие не Бога может быть недооценена.
|
|
|
|
|
i planed to use two views, and attached a scrollbar to CMDIChildWnd (i can't attach scrollbar to CDocument, as it is not a CWnd).
UpdateAllView only affect views, but not their container CMDIChildWnd.
If using scrollviews, I need to synchronize two scrollbars.....
|
|
|
|
|
I think you can get 2 CScrollViews and manage who is scrolling (the View is active) when you do the click in one of the scrolls, then from the document you get the new scroll position, give it to the other window using SetScrollPosition with pDoc->ActualPos_2 (assuming you made the click on View1) for the other one and call UpdateAllViews. Or just setting the scroll for both views where you need and call UpdateAllViews when opening a document.
Is that more or less what you wanted?
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Nelek wrote: Or just setting the scroll for both views where you need
could you give a little bit more info?
are both views scrollviews or there is a scrollbar on top of them?
if both are scrollviews, how can I set scroll for both views? which class should handle scroll message?
thanks!
|
|
|
|
|
It would be using GetScrollPosition in the view that is getting scrolled with the OnScroll and sending it to the other view where you use it with SetScrollPosition before updating all views.
Yes, both views should be derived from CScrollView and each one would have its own scrollbar, but you synchronize one when moving the other
Here[^] is spoken about SetScrollPos and Here[^] about ScrollToPosition
If you manage the actual position of each View in the document, for instance m_pScrollPos_1 and m_pSCrollPos_2, you can call them in your OnDraw and move the actual position of the scroll for this view to the saved point. When you click on a scroll bar just save the new position in the document and call pDoc->UpdateAllViews.
It may have a bit delayment between the one and the other whilst synchronising. But it is a possibility
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
nelek
thanks for the detailed info.
|
|
|
|
|
You are welcome. I hope it works as you whish.
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
I'm not sure if this exactly fits your requirement, but it is possible to place two views derived from CScrollView into different panes of a splitter window and scroll them together.
You need to specify WS_VSCROLL when you create the splitter, otherwise you get a scrollbar for each pane instead of one that works them both.
I used WS_HSCROLL and WS_VSCROLL in a recent application to scroll around a matrix and get the row and column headings to scroll along with the body of the matrix. Like this (CMatrixSplitterFrame derived from CMDIChildWnd):
BOOL CMatrixSplitterFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
if (!m_SplitterWnd.CreateStatic(this, 2, 2, WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL))
{
TRACE0("Failed to CreateStaticSplitter\n");
return FALSE;
}
if (!m_SplitterWnd.CreateView(0, 1, RUNTIME_CLASS(CKernelMatrixColHeadView), CSize(2000, CELL_YSIZE + CELL_INTER_GAP + CELL_INTER_GAP), pContext))
{
TRACE0("Failed to create second pane\n");
return FALSE;
}
Best Regards
Cliff Hatch
|
|
|
|
|
Cliff,
thanks for the clue, it is very useful.
BOOL CChildFrame::OnCreateClient(LPCREATESTRUCT, CCreateContext* pContext)
{
if (!m_SplitterController.CreateStatic(this, 1, 2, WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL))
{
return FALSE;
}
CRect lRect;
GetClientRect(lRect);
if (!m_SplitterController.CreateView(0, 0, pContext->m_pNewViewClass,
CSize(lRect.Width() >> 1, lRect.Height()), pContext))
{
return FALSE;
}
if (!m_SplitterController.CreateView(0, 1, pContext->m_pNewViewClass,
CSize((lRect.Width() + 1) >> 1, lRect.Height()), pContext))
{
return FALSE;
}
SetActiveView((CView*)m_SplitterController.GetPane(0, 1));
m_IsInitialized = TRUE;
return TRUE;
however, it only partly works at here --- there is only one vertical scroll bar, but there are two horizontal scroll bars, did I miss anything?
and, how do you answer scroll message?
I added it to CChildFrame, which is a subclass of CMDIChildWnd, but it was never called.
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
...
BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
ON_WM_HSCROLL()
ON_WM_VSCROLL()
ON_WM_MOUSEWHEEL()
ON_WM_SIZE()
END_MESSAGE_MAP()
...
void CChildFrame::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
CMDIChildWnd::OnHScroll(nSBCode, nPos, pScrollBar);
}
any idea?
many thanks!
|
|
|
|
|
baumchen
It looks as though the scrollbars are associated with the panes in a manner that happened to be right for my application, but is perhaps not right for yours.
When you specify WS_HSCROLL and WS_VSCROLL you get a horizontal scrollbar on all the panes along the bottom of the window, and a vertical scrollbar on all those on the right hand side. So in my 2x2 display I have 4 scrollbars in total. (Without WS_HSCROLL and WS_VSCROLL there would be 8, 2 for each pane).
Sorry, the description in my earlier post was a little misleading. I had forgotten the existence of 2 of my scrollbars because the top row is sized such that it never needs vertical scrolling, and the left column never needs horizontal scrolling - so their bars are always grayed out.
It appears that the horizontal scrollbars are shared by all the panes stacked above them, and the vertical ones by all the panes on the row to their left. I haven't been able to test this completely because my top-left pane is a dummy - but this is certainly how the other 3 behave.
This would be consistent with your result. In a 1 row x 2 column display, you only get one shared scrollbar - the vertical one.
I haven't managed to find any documentation to confirm this, but Technical Note 29 (.Net 2002) has a very short section on shared scroll bars which hints at this arrangment.
I didn't write any special handlers. The base classes, CSplitterWnd and CScrollView, managed all the scrolling messages for me.
Best Wishes
Cliff
|
|
|
|
|
Cliff
thanks!
looks it is easier to live with two sets of scrollbars.
|
|
|
|
|