|
Hi everyone,
in my MDI Project i don't use the Doc/View Architecture.
So i re-use always the ChildWnd & Doc for each View...
I read on the MSDN Site that a Doc/View Architecture is not obligatory.
So i could create a simple CMDIChildWnd and display it ( so i don't need to add Templates )
But in the ON_CREATE i must add all components by programmating.
Is there a solution to associate a Dialog with the ChildWnd ( add controls on the dialog is easiser )
Or is it not possible and i must continue, by creating the Templates with ChildWnd, View and Doc ?
Many Thanks
|
|
|
|
|
One way is to use a modeless dialog as the client window of the MDIChild frame.
In the following example I show handler functions for WM_CREATE and WM_SIZE.
pMyDialogClient is a CMyDialogClient pointer - add this member to your CMyMDIChildWnd class.
int CMyMDIChildWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1)
return -1;
pMyDialogClient = new CMyDialogClient();
pMyDialogClient->Create(IDD_MYDIALOG, this);
return 0;
}
void CMyMDIChildWnd::OnSize(UINT nType, int cx, int cy)
{
CMDIChildWnd::OnSize(nType, cx, cy);
if (pMyDialogClient && IsWindow(*pMyDialogClient))
pMyDialogClient->MoveWindow(0, 0, cx, cy);
}
|
|
|
|
|
Ok i see, it isn't a Frame within a Dialog, but 2 objects, ( the frame and a Dialog )
which are superposed and moves the same way, that the user sees all the time "one" window
Good idea ! Thanks
|
|
|
|
|
baerten wrote: Ok i see, it isn't a Frame within a Dialog, but 2 objects, ( the frame and a Dialog )
which are superposed and moves the same way, that the user sees all the time "one" window
Yes
In MFC they call them frame windows and client windows ("views") because they are in the client
area of the frame. There is code built in to the CFrameWnd class to automagically move/size the
"client window" for you so you could avoid having to do the MoveWindow() yourself, but for dialogs
it takes a little tweaking in the dialog class if I remember right.
Cheers,
Mark
|
|
|
|
|
Ok, it seems to work, big thanks
But there is still a problem, if i click on the Wordkspace, the modeless-Dialog disappears and
the Frame rests open.
Because Dialogs are another windows, which are displayed as a new element on the Windows TaskBar.
is it possible to change it?
If not i must use the Doc/View Architecture.
But there, i don't know a possibility to open a Frame ( with View ) with parameters
For example to set an initial height&width, because i open the frames with the Template :
CString Cur;
CDocTemplate *Selected;
POSITION pos = theApp.GetFirstDocTemplatePosition();
while(pos != NULL) {
Selected = (CDocTemplate*)theApp.GetNextDocTemplate(pos);
ASSERT(Selected != NULL);
ASSERT(Selected->IsKindOf(RUNTIME_CLASS(CDocTemplate)));
Selected->GetDocString(Cur,CDocTemplate::docName);
if(Name == Cur) {
Selected->OpenDocumentFile(NULL);
}
}
Or is my procedure completly wrong and i can open the View in the Frame like your example with the Frame and the dialog
So that i create myself a Frame and in the Create-Handler i associate myself the view to this frame
so that i don't need the templates ( Because if i have 50 windows i need to add 50 templates at the beginning of the application )
|
|
|
|
|
baerten wrote: if i click on the Wordkspace, the modeless-Dialog disappears and
the Frame rests open.
Because Dialogs are another windows, which are displayed as a new element on the Windows TaskBar.
is it possible to change it?
The only style flags you need are (WS_CHILD | WS_VISIBLE) for the imbedded modeless dialog.
That means on the dialog's property sheet (edit the dialog, hit F4 key) the "Style" setting
should be Child (not Popup or Overlapped) and the "Visible" setting should be set to true.
All other settings can probably be false. That should fix the "new element on the Windows
TaskBar" problem.
By the way, check out CFormView class for using controls based on a dialog template in a view.
To get access to the frame window at create time, check out the MFC source code for
CMultiDocTemplate::OpenDocumentFile(). You can do the same steps and have access to the frame
window pointer at create time.
|
|
|
|
|
By the way, check out CFormView class for using controls based on a dialog template in a view.
Yes, i made it already, but there i used the Templates.
In future i will change the view of the Frame a runtime, passe parametes to it etc
So i think that the utilisation of the templates isn't so usefull.
If i can create a CFrameWnd myself, i could also associate a CFormView by "own" programmation
then it's faster and not so complicated to pass parameters to my View
I will study the MFC Functions for understand how to open and associate a CFormView to a FrameWnd without Templates
If you have an example, it would be nice if you can show an piece of your code
Anyhow big thanks for spending time on my
(Because to jump into MFC without lessons or good books it's quite difficult ... )
-- modified at 5:13 Friday 3rd November, 2006
So far so good i open the CFormView in my Frame
Now i only need to change the View at Runtime and all is wonderfull
|
|
|
|
|
Hi together,
I'm trying to write a programm in order to track people walking past a webcam. What I actually need is their position infront of the camera.
I have tried several things until now. Using different software. MAX/MSP, Java, and OpenCV/C++ which seems to be the best thing. I'm also working on EyesWeb which also uses OpenCV. I need to transfer the data I get to Flash. EyesWeb does that via OSC.
I'm still not sure if C++ is the best language to use.
No I read about motion detection in C# so again im quite confused where to start or to continue.
http://www.codeproject.com/cs/media/Motion_Detection.asp
So my first question is: Is there a possibility to transfer data to flash (maybe via xml, osc. )?
In EyesWeb I tried to use Background Subtraction in order to get silhouettes of the people walking by. The problem is that the webcam has too much noise and the programm analyzes motion in parts where there is none.
Afterwards I wanted to use blob extraction to get the position of the people. The second problem was that sometimes a color has the same gray value as the background and then there's no differnce in that part
Then I heard about block matching which might be better, but I'm not sure. Is this the right algorithms for my project?
Does anyone have experience with this kind of tracking?
Hope you can help or have some hints
|
|
|
|
|
Why not just take an image on a timer loop and compare it to previous images? Comparing an image should be simple enough in your situation. Just select a few random pixels in the image and compare the colours. You could even go as far as applying an algorithm to compensate for light changes through the day.
|
|
|
|
|
thanks for your suggestion,
that's how I was going to do the analysis. I'm just concerned about the performannce and think C++ has the best performace since your able to use directX / direct show. I need a high frame rate.
Besides there are OpenCV libraries which take care of image processing.
Still I'm wondering if there's a better way or say a better language to use.
|
|
|
|
|
Performance doesn't really come into play when talking about motion dection. Infact, no drawing to the screen is required for it. All you do is capture an image every second or so and compare it to the last or if you want to do it properly the previous 10 or so. Comparing a handful of RGB values will take a split second. It's only after you detect motion that you launch into directX or whatever your using.
|
|
|
|
|
One more problem, Please show me how to get the position of a mouse and extract this data to a grid. In this case what type of Grid I should use?
|
|
|
|
|
...can't you ask for a more explicit subject ?
Subject: help1 is not what i'd call a clear subject.
|
|
|
|
|
|
Generic answer for a generic topic ?
|
|
|
|
|
not 100%
|
|
|
|
|
Kiethnt wrote: Please show me how to get the position of a mouse
GetCursorPos!
"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
|
|
|
|
|
Dear All,
I would like to add a menu in Frame and create a new dialog but now I don't know how to call this dialog when I push select this menu.
I have already create a new dialog and I would like to add this dialog to my project. Please shown me or send to me via email kiethnt@yahoo.com. Many thanks for your help
|
|
|
|
|
Please don't post your e-mail address on the forums or ask for people to direct their replies to your mail box. At the bottom of the page is a checkbox marked "Notify me by e-mail if someone answers this message". If you place a check in that little box next to the words, a magic thing will happen. You get an email with the reply. Cool isn't it.
Now, if you don't want your classmates to see the replies you get, then don't ask these questions on a PUBLIC forum. Go find an IRC group or something where you can chat in private.
|
|
|
|
|
waldermort wrote: if you don't want your classmates to see the replies you get, then don't ask these questions on a PUBLIC forum.
|
|
|
|
|
waldermort wrote: Now, if you don't want your classmates to see the replies you get, then don't ask these questions on a PUBLIC forum. Go find an IRC group or something where you can chat in private
He he eh
"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
|
|
|
|
|
What do you need exactly?
|
|
|
|
|
I want to splitan existing dialog to which i have added some controls into two parts based on my requirements.How can i do this?
Thanks.
|
|
|
|
|
In MFC use CSplitter class. You will have to set the controls parents to be that of the splitter pane and also take into account that controls may move when resizing the panes.
|
|
|
|
|