|
Thanks , works fine ! Thank you all !!!
|
|
|
|
|
In my SDI app, I want to display a dialog after the main window is showing (this is to verify the starting path of some file processing). I've set breakpoints in locations like CFrameWnd::OnCreate() , CFrameWnd::PreCreateWindow() , CListView::OnInitialUpdate() , but none of them are hit before the action starts in CDocument::OnNewDocument() .
I've seen a few examples of this with the dialog being displayed before the main window is showing, but that's not the look I am after.
Thanks for any help you might have.
- DC
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Have you tried CView::OnActivateFrame ?
Seems to be working on my sample test; you might have to use a bool to guard the code because OnActivateFrame is called often.
Watched code never compiles.
|
|
|
|
|
Maximilien wrote: Have you tried CView::OnActivateFrame ?
CDocument::OnNewDocument() is still hit first.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
The window shows where you have the m_pMainWnd->ShowWindow(SW_SHOW); call in CxxxSDIApp::InitInstance() or during if (!ProcessShellCommand(cmdInfo)) if the program was started with SW_SHOW option (which it is when run from the debugger and the Windows Explorer.
Depending on what you want the dialog to do, you may be able to just make a modeless dialog right there, otherwise you will need to m_pMainWnd->SendMessage() or m_pMainWnd->PostMessage() to tell the main window to open the modal dialog.
SendMessage() will do it right then, whereas PostMessage() will do it some time in the near future.
EDIT: HTML formatting error
|
|
|
|
|
Displaying the dialog at the tail end of CWinApp::InitInstance() did the trick. Thanks.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Hi Dave,
In your main window OnCreate() call PostMessage(WM_COMMAND, ID_SHOWDIALOG) - and handle the command .
The message will be queued and processed after full completion of the creation process.
cheers,
AR
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
The main frame is shown in CSingleDocTemplate::OpenDocumentFile but only after a call to CDocument::OnNewDocument has already been made. You might be able to override CSingleDocTemplate::OpenDocumentFile (a public virtual function) to do the processing you want.
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
Hello,
does anybody know about implementation of Chord DHT in ANSI C (NOT in C++!!!) language? I'm looking for something like this http://open-chord.sourceforge.net/ , libraries that allow to use DHT, but written in pure C. Eventually it might be some other DHT algorithm than Chord, but written in C. I've tried to google something but with no results...
I will be grateful for answers.
Regards,
Przemek.
|
|
|
|
|
przemnet wrote: I've tried to google something but with no results...
So you've a great opportunity: code yourself the algorithm, write an article about!
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi all,
i have an Static Control using with Notify proerty to perform some action on its click event.
i set font on this control.
i use a hand cursor on mouse move on this static control.
but the hand cursor also display on blank space at the end of this control caption.
i want the hand cursor only display over the text of this control.
please tell me how can i do this.
thanks in advance.
|
|
|
|
|
Easiest way is probably to resize the control depending on the size of the text. Check out CDC::GetTextExtent()[^] API.
Edit: Of course, if you have a multi-line control you will have problems with this approach.
|
|
|
|
|
i m using this but there is no benefit
CString text="";
GetDlgItemText(IDC_STATIC_1,text);
CSize csText = pDC->GetTextExtent(text) ;
CRect rect1;
GetDlgItem(IDC_STATIC_1)->GetClientRect(rect1);
GetDlgItem(IDC_STATIC_1)->SetWindowPos(this,rect1.left,rect1.top,csText.cx,csText.cy,SWP_SHOWWINDOW);
|
|
|
|
|
Try
CString text;
GetDlgItemText(IDC_STATIC_1, text);
CSize csText = pDC->GetTextExtent(text);
GetDlgItem(IDC_STATIC_1)->SetWindowPos(this, 0, 0, csText.cx, csText.cy, SWP_NOMOVE);
|
|
|
|
|
i using this on OnInitDialog but there is no change
|
|
|
|
|
Insert a breakpoint on the line GetDlgItem(IDC_STATIC_1)->SetWindowPos(this, 0, 0, csText.cx, csText.cy, SWP_NOMOVE) by clicking on the grey stripe to the left of the code and run the project.
When the breakpoint is hit hover over the variables text and csText to make sure their values are something that you would expect.
|
|
|
|
|
I just want the click event and cursor on mouse move is not set on blank space at the end of text in control,
variables text having the caption of control and csText (cx=92 and cy=16) and on the dialog the cordinates of control (x=10,y=233,width=100,height=10)
|
|
|
|
|
Sorry, I forgot to say that you need to select the font:
CWnd *pStatic = GetDlgItem(IDC_STATIC_1);
CDC *pDC = GetDC();
CString text;
pStatic->GetWindowText(text);
CFont *pOldFont = pDC->SelectObject(pStatic->GetFont());
CSize szText = pDC->GetTextExtent(text);
pDC->SelectObject(pOldFont);
ReleaseDC(pDC);
pStatic->SetWindowPos(this, 0, 0, csText.cx, csText.cy, SWP_NOMOVE);
There is another way of doing this rather than in the OnInitDialog, still using GetTextExtent.
You can check if the mouse is inside the text rect in the event (OnClick or OnMouseMove), but this requires more code
|
|
|
|
|
so now where i can use this
|
|
|
|
|
I would suggest sticking with OnInitDialog unless you want the static to keep the same dimensions for appearances sake (border, ...)
|
|
|
|
|
I have an MFC app, which uses an accelerator for DEL, ctrl+X and others. I also have an ATL dll which opens a modeless dialog with an edit control. Problem is, when I hit DEL or ctrl+X in this edit control, it's routed to the main app, which, need I say, leaves the user quite surprised. Any ideas on how to solve this?
EDIT: hmm, well what do you know... This site[^] is a great souce of knowledge...
home
modified on Monday, January 17, 2011 8:03 AM
|
|
|
|
|
I have installed Netbeans for C++ but i think it requires a separate installation of compiler also, kindly guide me from where can i download a free compiler of C++ for NetBeans IDE 6.9.1 (Build 201007282301)
|
|
|
|
|
Directly on the NetBeans web site they say it works with CygWin and MinGW.
Find them here CygWin[^] and here MinGW[^].
Hope that helps!
|
|
|
|
|
Since we're on a more Microsoft centric webbie, I could suggest downloading the Visual Studio Express Edition.
Maybe you can use the VS compiler in NetBean.
Watched code never compiles.
|
|
|
|
|
Why not check this[^] out on the NetBeans site?
I must get a clever new signature for 2011.
|
|
|
|