|
you mean, the msdn cd?
if so.. then, i'm on it and thanks
|
|
|
|
|
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
|
|
|
|
|
Call CDocument's SetPathName() or SetTitle prior to showing the FileSave Dlg.
onwards and upwards...
|
|
|
|
|
If you take alook at the default MFC implementation of CDocument::DoSave():
BOOL CDocument::DoSave(LPCTSTR lpszPathName, BOOL bReplace)
{
CString newName = lpszPathName;
if (newName.IsEmpty())
{
CDocTemplate* pTemplate = GetDocTemplate();
ASSERT(pTemplate != NULL);
newName = m_strPathName;
if (bReplace && newName.IsEmpty())
{
newName = m_strTitle;
int iBad = newName.FindOneOf(_T(" #%;/\\"));
if (iBad != -1)
newName.ReleaseBuffer(iBad);
CString strExt;
if (pTemplate->GetDocString(strExt, CDocTemplate::filterExt) &&
!strExt.IsEmpty())
{
ASSERT(strExt[0] == '.');
newName += strExt;
}
}
if (!AfxGetApp()->DoPromptFileName(newName,
bReplace ? AFX_IDS_SAVEFILE : AFX_IDS_SAVEFILECOPY,
OFN_HIDEREADONLY | OFN_PATHMUSTEXIST, FALSE, pTemplate))
return FALSE;
}
CWaitCursor wait;
if (!OnSaveDocument(newName))
{
if (lpszPathName == NULL)
{
TRY
{
CFile::Remove(newName);
}
CATCH_ALL(e)
{
TRACE0("Warning: failed to delete file after failed SaveAs.\n");
DELETE_EXCEPTION(e);
}
END_CATCH_ALL
}
return FALSE;
}
if (bReplace)
SetPathName(newName);
return TRUE;
}
If you were to override this function in your MFC document copy/paste the above and replace the bold section with your own code to determine the default filename, it should do what you need.
Roger Allen - Sonork 100.10016
Roger Wright: Remember to buckle up, please, and encourage your friends to do the same. It's not just about saving your life, but saving the quality of life for those you may leave behind...
|
|
|
|
|
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
|
|
|
|
|
I need the code for opening a file in Microsoft Access from Visual C++. I want to create a button that when you click the button, the program will take you to a file in Microsoft Access.
|
|
|
|
|
You could put it into "Tools", just type in the full command line for Access.
My neighbours think I am crazy - but they don't know that I have a trampoline. All they see my head bobbing up and down over the fence every five seconds
|
|
|
|
|
maybe your neighbours are right
I think the poster meant from a program written using Visual C++, rather than the IDE.
Check out CDaoDatabase and related classes, although my preferred route would be OLE DB using the atldbcli.h templates.
Steve S
|
|
|
|
|
How about using ShellExecute(..., "open", "myfile.mdb", ...) ?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
For application that I'm making, I'm using VC+6/MFC and for help, I'm Using "Winhelp.exe"
To open help file from my application, I use command like following
:
:
::WinHelp(this->m_hWnd,"filename.hlp",HELP_CONTEXT,HELP_SEC_NOTATION);
:
:
My question is how to keep that help window remain on top (when I click other part of application)
What I want is keeping help window alaways visible until close help window.
I hope you suggest way for that
Thank you.
|
|
|
|
|
For dialog base applications all you have to do is to add this method to your dialog:
void CTopDlgDemoDlg::StayOnTop() const
{
CRect rect;
// get the current window size and position
GetWindowRect( rect );
// now change the size, position, and Z order
// of the window.
::SetWindowPos(m_hWnd , // handle to window
HWND_TOPMOST, // placement-order handle
rect.left, // horizontal position
rect.top, // vertical position
rect.Width(), // width
rect.Height(), // height
SWP_SHOWWINDOW // window-positioning options);
}
// add a control button and command handler for the button to your dialog.
// then invoke StayOnTop().
void CTopDlgDemoDlg::OnBtnClick()
{
// make this dialog always on top.
StayOnTop();
}
Hope this helps ya out
Win32newb
"Making windows programs worse than they already are"
|
|
|
|
|
I have a file that is trying to include the header file for MySQL. I have the file in the project folder and have added it to the project and I keep getting this error:
fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory
Can anyone help?
If it's broken, I probably did it
bdiamond
|
|
|
|
|
What happens when you right-click on the #include <mysql.h> statement and select Open Document ... from the context menu? Does mysql.h open successfully?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
and can i ask...
why dont u use the mysql odbc connector?
"there is no spoon" biz stuff about me
|
|
|
|
|
I have the problem solved now. After I added the .lib files and set the additional include paths right everything is working fine now. By the way, I'm using code that I found on this site that are MySQL wrapper classes and another set of Dbase wrapper classes that I also found on this site. I have two different projects that I used just to make sure I could make them both work separately. Now I'm going to put them both in the same project to use them to do an export from a MySQL query result set to a .dbf file. When that's done, (hopefully today), I'm going to put them into a function that accepts the parameters for the connection to the MySQL database and prompts you with a Save As dialog for the .dbf file and put it in a dll so that it can be called from other applications as well. I was thinking about putting this DLL and source up on the site as well (of course with proper acknowledgements to the writers of the other 2 packages I'm using as well). I'm not sure if this is really simple for some of you, but anyone expresses interest, I'll gladly post it on the site.
If it's broken, I probably did it
bdiamond
|
|
|
|
|
I have created an MFC CPP console process and redirected the stdin/stdout/stderr to a windows application. This is so the windows application can send console commands and process the output from the commands. The problem I am having is finding out the status of each command that I send (ie ERRORLEVEL or command result codes).
My implementation at this point creates a new console process, redirects the I/O and then commands can be issued with a printf to the new stdin pipe and reads from the new stdout pipe the results. However, there is no feedback to know when "CMD.EXE" has fininshed the last command so I can send the next one. I would like to keep the console process open and pipes in place, and simply send console commands and accumulate the output from stdout until the command is complete. Then send the next command ASAP.
I wind up having to use hard delays to wait for the last command to finish before I send the next one. I have searched high and low for the proper way to handle this functionality but I am finding no solutions. I assume a make utility does exactly what I am needing to do since it must shell and get the ERRORLEVELS/Result codes. Can anyone point me in the right direction?
|
|
|
|
|
Just create a new console process for each task, and wait for it to exit, then start the next one. It's simpler, and you get a proper exit code on each one.
|
|
|
|
|
Hello,
I need a outlook 2000 add-in so I can read HTTP mail (like hotmail). I've spend my 8 hour working day looking for an add-in or information how to build such an add in. All that I found proved not usefull.
Is there an outlook add-in that allows me to read HTTP mail (als referred to as WebMail).
If there's not can someone guide me to some articles and related material on ow to build an outlook add-in and how to read an HTTP mail server?
Thanks in advance.
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
Hi. As far as i remember there are few articles about this topic. Try to use this code
http://www.wischik.com/lu/programmer/mapi_utils.html
this page contains very usefull info about outlook mapi. I don't know what you want to do with the message if just read you will have html code while using the code from the link.
Pain is a weakness living the body
|
|
|
|
|
Well, I want to get emails from an HTTP server like Yahoo and Hotmail. Unfortunatly MS outlook 2000 doesn't support this (Outlook express does ) I figured that enough companies and people at home use outlook, and such support would have been buildt already. I havent found it
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
|
I want to make a MS Outlook Add-in so I acces and view mail accounts that exist on a HTTP server.
The add-in part (which is my subject in the fist place!) is for a a windows program and therfore not suitable for the web dev forum.
The protocol I should use for talking to an HTTP server can be found somewhere in the big pile of knowledge they call RFC's. So you don't need to give me an technical explanation about it...
thanks for your time.
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
Hi all,
Does anyone know the correct, or at least best, way to access a solutions' document object instance from a modal dialog? I thought creating an instance of the new dialog, then having an member function of that instance set a pointer within the instance to the document instance (from the view object instance using the GetDocument() function), but I wondered if there was a way to directly access a pointer from the dialog?
Any help would be much appreciated.
Thanks.
|
|
|
|
|
Modify the dialog's constructor to include a CDocument* parameter. Then construct the dialog like:
CMyDialog dlg(this);
dlg.DoModal(); This assumes the dialog is created in some document method. If the dialog is created in the view, you can use:
CMyDialog dlg(GetDocument());
dlg.DoModal();
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
How do you display a dialog box once the main window of a program has already loaded up. I put created a dialog box at the end of CMainFrame::OnCreate but the dialog box appeared before the window loaded.
Any help would be greatly appreciated.
Thanks
|
|
|
|