|
Is it possible to add multiple views to one document? I would like to display both views at the same time. In the CDocument class there is a function call AddView but that only seems to give me an ASSERT error when I try.
Is there something simple I am missing or is this even possible?
thanks,
Mike
|
|
|
|
|
CDocument::AddView() attaches another view to the document but the view needs to be created first.
How are you adding a view?
|
|
|
|
|
I have made a class that is a derivative of CView. I get the next view position and create the view, just the same way it is done for the initial view. I then call AddView with the pointer to the view I have just created. My one thought is that maybe I need to point the new view to the document that is creating it.
|
|
|
|
|
I had to look up how I do it since I've been moving away from doc/view for quite a few years but
I still have windows that open as views. The framework does it using the CDocTemplate class to
associate the document, view, and frame window class - useless for creating a child view
Anyway, I found a better generic example of what has to be done (from MFC docs)...
CView* pActiveView = ((CFrameWnd*) m_pMainWnd)->GetActiveView();
m_pOldView = pActiveView;
m_pNewView = (CView*) new CNewView;
CDocument* pCurrentDoc = ((CFrameWnd*)m_pMainWnd)->GetActiveDocument();
CCreateContext newContext;
newContext.m_pNewViewClass = NULL;
newContext.m_pNewDocTemplate = NULL;
newContext.m_pLastView = NULL;
newContext.m_pCurrentFrame = NULL;
newContext.m_pCurrentDoc = pCurrentDoc;
UINT viewID = AFX_IDW_PANE_FIRST + 1;
CRect rect(0, 0, 0, 0);
m_pNewView->Create(NULL, "AnyWindowName", WS_CHILD, rect, m_pMainWnd, viewID, &newContext);
m_pNewView->SendMessage(WM_INITIALUPDATE, 0, 0);
...
The key is the CCreateContext stuff. You may not need some of the code - for example you
probably already have a document pointer so you don't need to obtain it. AddView will be called
in CView::OnCreate() automagically.
I Hope this helps!
Mark
*EDIT* Here's a link Adding Multiple Views to a Single Document[^]
|
|
|
|
|
I was wondering if anybody would help be with a piece of code to open a binary and display the content in .txt format or comma separated. I am dealing with images that were processed and saved in binary format. I want to know what was saved in these files and use them.
Thanks
|
|
|
|
|
What about an hex editor?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
I have no idea how I can use hex editor. I've never used it before
|
|
|
|
|
I mean you can use an editor able to load binary files and to show the content as hexadecimal data (for instance, Visual Studio 6 can do that: choose Open->File menu item and then, on the file open dialog, select the option "open as Binary").
hope that helps.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Thanks!!
I will try this
|
|
|
|
|
I'm a bit new to this type of programming but I was wondering if anyone could point me to some information or provide some coding ideas on how to display a message to the user on the screen within a Direct3D game from an external process. I don't have any internal access to any of the game code. It would behave similarly to how FRAPS displays the frames per second inside all Direct3D games.
Thanks for any advice.
|
|
|
|
|
How do i get the control's handle in a dialog?
is thr ny way of enumeration for this? plz provide me some sort of example.
|
|
|
|
|
Please don't post twice (or more) the same question.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
If you have the control's ID:
HWND hwndCtrl = ::GetDlgItem(hwndDlg, ID_CONTROL);
Mark
|
|
|
|
|
Actually i have to move all the controls at run time in more than 100 dialogs and in each dialog there are many controls. so instead of passing each control id i want to enumerate all the controls to get the respective handles and with this handle i m moving the controls appropriately.
so plz give me solution to get the handle of all controls in a dialog.
|
|
|
|
|
Like CPallini said:
EnumChildWindows(hwndDlg, EnumChildProc, 0);
...
BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM lParam)
{
...do something with hwnd, a handle to a child window of hwndDlg...
return TRUE;
}
*EDIT* Return a value from EnumChildProc()
|
|
|
|
|
Raj Gopal wrote: so plz give me solution to get the handle of all controls in a dialog
Mark Salsbery already did. Anyway have a look also there [^] where a similar request has been posted.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Raj Gopal wrote: s thr ny way of enumeration for this? plz provide me some sort of example.
try this simple api GetNextDlgTabItem
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and you
|
|
|
|
|
if you want to get handle of all controls on a forum you can use of
CWnd *pwnd2;pWnd2 = GetTopWindow(); and on a loop use of pWnd2 =pWnd2 ->GetNextWindow();
|
|
|
|
|
hello all:
i want to run a avi files by a vc project.
there was problem, i want to rotate the radio by 180 degree,like a video in the water.
how can i do?
i need a good idea or some samples.
sorry for my poor english.
thanks in advance!
henry
-- modified at 2:11 Monday 4th December, 2006
|
|
|
|
|
|
can somebody tell me how to get object or resource id of all the controls by passing dilaog handle progrmatically.
|
|
|
|
|
You can use EnumChildWindows , calling, inside your callback function, GetDlgCtrlID .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
thank you.
actually i need an handle of all the controls in a dialog.
can you please send me an example illustrating EnumChildWindows();
i m sorry for posting the message twice.
|
|
|
|
|
CPallini wrote: EnumChildWindows, calling, inside your callback function, GetDlgCtrlID.
What about simple call to GetNextDlgTabItem!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and you
|
|
|
|
|
ThatsAlok wrote: What about simple call to GetNextDlgTabItem!
Does not work unless the control has the WS_TABSTOP set (I know, usually a control HAS this style set).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|