|
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.
|
|
|
|
|
CPallini wrote: Does not work unless the control has the WS_TABSTOP set (I know, usually a control HAS this style set).
"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
|
|
|
|
|
Hello everyone
I want to learn how can I do this :
write a recursive function member level() for class template BST that determines the level in the BST at which a specified item is located .The root of the BST is at level 0 , its children are at level 1 , and so on
and this is the code for //--- Definition of search()
Code:
template <typename DataType>
bool BST<DataType>::search(const DataType & item) const
{
BST<DataType>::BinNodePointer locptr = myRoot;
bool found = false;
for (;;)
{
if (found || locptr == 0) break;
if (item < locptr->data) // descend left
locptr = locptr->left;
else if (locptr->data < item) // descend right
locptr = locptr->right;
else // item found
found = true;
}
return found;
}
Rooro
|
|
|
|
|
Hi all,
I am using CToolTipCtrl as follows:
m_ToolTip.AddTool(this,sToolTip,rc,1);
m_ToolTip.SetMaxTipWidth(MAX_PATH);
m_ToolTip.Activate(TRUE);
m_ToolTip.SetWindowPos(&wndTopMost,0,0,0,0,SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOOWNERZORDER);
MSG msg;
msg.hwnd = m_hWnd;
msg.message = WM_MOUSEMOVE;
msg.wParam = 0;
msg.lParam = MAKELONG(point.x , point.y);
msg.time = 0;
msg.pt.x = point.x;
msg.pt.y = point.y;
m_ToolTip.RelayEvent(&msg);
the tool tip is shown 100% ok, but when i log on to this site:
http://news.sky.com/skynews/home[^]
the tool tip stops from working. i think there is a control on that site that does something to my tool tip.
what am i doing wrong?
thanks in advanced
Yaron
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|