|
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.
|
|
|
|
|
Why, you can use loads of free C++ compilers!
There DJGPP (GNU suite) for Windows and Linux, Borland C++ for Windows. There is also an excellent compiler called TCC that can compile HUGE sources with lightning speed because it does not use intermediate assembly.
Search these names on any search engine and you will get the web-address!
|
|
|
|
|
hello guys... I am trying to connect to database using ADO in MFC dialog based app. Now I get error at the first step when I try to create new connection and recordset using COM but I getting 4 errors stating "unresolved external symbol"
- "error LNK2001: unresolved external symbol _CLSID_CADORecordset"
- "error LNK2001: unresolved external symbol _IID_IADORecordset"
- "error LNK2001: unresolved external symbol _CLSID_CADOConnection"
- "error LNK2001: unresolved external symbol _IID_IADOConnection"
#include <adoid.h>;
#include <adoint.h>;
#include <comdef.h>;
CComPtr<ADORecordset> m_pSet;
CComPtr<ADOConnection> m_pConn;
::CoCreateInstance(CLSID_CADOConnection, NULL, CLSCTX_INPROC_SERVER, IID_IADOConnection, (LPVOID*) &m_pConn);
::CoCreateInstance(CLSID_CADORecordset, NULL, CLSCTX_INPROC_SERVER, IID_IADORecordset,(LPVOID *) &m_pSet);
Thats is what I was trying to do. What can be the reason?? thnx
|
|
|
|
|
According to this[^], it should be fixed if you include initguid.h before adoid.h.
modified 13-Sep-18 21:01pm.
|
|
|
|
|
thanx...it worked for me.
|
|
|
|
|
I use these[^] classes in order to use ADO in my MFC apps. Sure beats the heck out of reinventing the wheel yet again.
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|