Thanks for your answer, But I did what basementman suggested: I'm using SetTitle() and it's working fine. Here's where I put the function, in my CLaserPlusBeta1Doc.cpp: BOOL CLaserPlusBeta1Doc::OnNewDocument() { if (!CDocument::OnNewDocument()) return FALSE; // TODO: add reinitialization code here // (SDI documents will reuse this document) CDocument::SetTitle("MyTitle"); return TRUE; } I don't need to specify a path name, so it's easier this way. Dave
Davex_
Posts
-
MFC: How to change the default filename in the Save As dialog at runtime? -
MFC: How to change the default filename in the Save As dialog at runtime?Hi, Here's what I'm trying to do in my MFC application. Like MS WORD do when you save a document for the first time, you click Save and Word takes the first line of your text and wants to save your document to "My first line of text.doc". Me, I want to create my default file name with the current date, example: today is March 15, then when I click Save (or save as) I would like to see "March15.las". The default save name is found in the string table under the IDR_MAINFRAME (ID 128). My IDR_MAINFRAME STRING : LaserPlusBeta1\ndefaultsavename\nLaserPlusBeta1\nLaserPlusBeta1 Files (*.las)\n.las\nLaserPlusBeta1.Document\nLaserPlusBeta1.Document Is it possible to modify the caption of IDR_MAINFRAME at runtime? If not, how can I generate my own string every time I save and associate an ID to it? Because the CSingleDocTemplate takes a UINT as first parameter for the IDR_MAINFRAME string. CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS(CLaserPlusBeta1Doc), RUNTIME_CLASS(CMainFrame), // main SDI frame window RUNTIME_CLASS(CLaserPlusBeta1View)); Thank you Dave
-
MFC: Problem using CWnd::SendMessageThank You Ravi, I knew it was simple, but...! hehe It worked with GetParent();
-
MFC: Problem using CWnd::SendMessageHello all, I'm presently learning how to use my own message handlers in my MFC application. I read this article: Windows Message Handling - Part 2 here: http://www.codeproject.com/dialog/messagehandling2.asp. I have a problem with one line of code; when I need to get the CWnd* to send the message. In my case, I want to send the message to my main view based on CFormView when I'm in another dialog or class. Here's how I was trying to do it: pMyMainView = CWnd::FindWindow(_T("CMyMainView"),NULL); pMyMainView->SendMessage(WM_MYMESSAGE,0,0); But FindWindow don't find my CMyMainView, so I can't send the message. I tried "this->SendMessage(WM_MYMESSAGE,0,0);" in my CMyMainView.cpp to verify my message handler and it's working. It must be so simple! But I started coding in C++ and MFC only 1 month ago. :-) Thanks, Dave
-
MFC: Easier way to know which Edit Control has the focus?Thanks a lot, that's exactly what I was looking for! I'm a beginner, so I'm learning... :-) Dave
-
MFC: Easier way to know which Edit Control has the focus?Hi, In my program, I have 56 Edit Controls where I can type the names of 56 players. Presently, I'm using ON_EN_SETFOCUS for every Edit Control to set an INT variable that tells me which Edit Control has the focus. When I want to print, delete or view the result of the player in focus, I check the variable and than print or delete the good player. Is there an easier way to know the ID of the Edit Control in focus? Like when I want to print a player's results, just get the Edit Control ID in focus at this moment, compare the ID and identify the player. Here's a sample of my code: .... ON_EN_SETFOCUS(IDC_NAME13, OnEnSetfocusName13) ON_EN_SETFOCUS(IDC_NAME14, OnEnSetfocusName14) END_MESSAGE_MAP() void CMainView::OnEnSetfocusName14() { PlayerInFocus = 14; } What I would like to do: void CMainView::OnPrintPlayer() { Get the control ID in focus if(Control ID == 14) Print Player 14 else if(Control ID == 15) Print Player 15 else if ... } Thanks Dave
-
MFC: Can't insert controls after inserting an ActiveX Control!!Thanks, that's exactly my problem! I did a fast count of 249 controls! I'll redesign my dialog.
-
MFC: Can't insert controls after inserting an ActiveX Control!!Ok, I found out that the ActiveX control seems to be a coincidence. It's more like a have reach a limit on the quantity of controls I can have in my dialog!!! Is it possible? I can insert one more control, and after that, no more control can be inserted!!! I don't know why it's doing this! Dave
-
MFC: Can't insert controls after inserting an ActiveX Control!!Hi, It's the first time I'm using ActiveX Control. I'm working with VS .NET 2003 and I must say that I'm a beginner to C++ and MFC. My problem is after I have inserted an ActiveX Control (any ActiveX control), I can't insert any other controls, like a Button, Edit Control, etc. I select the control I want and when I click to insert it where I want, nothing happen! This problem is only in my main dialog: the CFormView dialog. I need help here, I tried a few things, but without success! Thanks, Dave
-
MFC: How to move between Edit Controls with the arrow keys?Thanks, I didn't know the Shift+Tab! But I want to use the arrow keys too, I think it will be easier to navigate between the edit controls and more instinctive. And also, the persons who will use my little program are already used to a similar program that navigates with the arrow keys. My Edit controls are all single line, so I'll do what you suggest Steve, Thanks. By the way, this web site is really nice, it's helping me a lot to learn about MFC and C++. Dave
-
MFC: How to move between Edit Controls with the arrow keys?Hi, I'm doing a little project in MFC. I want to be able to move up and down between my 12 Edit Controls with the arrow keys. The TAB key only goes down, I want to go up too. I'm a beginner and I did not find informations on internet about this. Can someone indicate me to a article or an example on the subject. It must be simple, but my knowledge of MFC is limited. Thanks Dave
-
How to put a CString variable in the IDR_MAINFRAME string?Hi, First, I'm a beginner and I'm doing a little project in MFC and i'm using VS .NET 2003. I want to put the current month concatenated with an other word as default save name when I save my document. So I want to be able to pass a CString variable to the IDR_MAINFRAME string. Example: JanuaryDave.sav I searched on the internet and found nothing on the subject. Can someone indicate me an article or an example of what I want to do. Thanks. David