|
Hi,
i made this "File save as.." dialog window but after this i don'really know how to insert or to connect the given name to my saving function which is in another dialog window?
CString szlstfile = fileDlg.GetPathName(); //MainFrm.cpp
SaveStream(szlstfile); //ContrDlg.cpp
Thanks, Mark
|
|
|
|
|
either open the File SAve as from ur dialog or make a member variable, and set it from the outside using a reference or a pointer to ur dialog
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Hmm, sounds tricky..
I make a member variable(m_filename). Do u have a code snip for that?
Thanks, Mark
|
|
|
|
|
in ur class:
class urClass
{
private:
CString m_fileName; /*(or array of char)*/
public:
void SetFileName ( CString fileName ) ;
};
and from another part of the world where this compile:
urClass object;
...
object.SetFileName ( "whateverPathToSet" ) ;
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
What you have looks fine. Presumably SaveStream() will do something with the filename passed to it. What seems to be the problem?
|
|
|
|
|
Hi,
the problem is to pass the filename from MainFrm.cpp to ControlDlg.cpp
Thanks, Mark
|
|
|
|
|
Passing variables from one file to another is undefined. I assume you have a class defined in ControlDlg.cpp (e.g., CControlDlg) with at least one public method (e.g., SaveStream). In your CMainFrame class, you'll need an instance of the CControlDlg class, unless the method is static. Now it's just a matter of calling the CControlDlg's method, passing it the filename obtained from CFileDialog.
|
|
|
|
|
Yes, thats right. I like to give the filename before data arrived.(it comes from the usb-port). The SaveStream() func is called during runtime when data arrives.
How i can do that? I think the filename(variable is stored in RAM)..
Thanks, Mark
|
|
|
|
|
Now you've really got me confused. In your OP, the filename was originally coming from CFileDialog::GetPathName(). You then wanted to pass that to the SaveStream() function.
Perhaps you could explain in detail what you are after rather than just offer bits and pieces that just get construed along the way.
|
|
|
|
|
I am sorry but thanks for your time.
----------------------------------------------------------------------------
//MainFrm.cpp
void CMainFrame::OnDataSaveAs()
{
CFileDialog dlg(FALSE);
CControlDlg cd;
dlg.m_ofn.lpstrInitialDir = "F:";
dlg.DoModal();
if ( dlg.DoModal() == IDOK)
{
CString filename = dlg.GetPathName();
cd.SaveStream(filename); //doesn't work because no data at start
}
}
-----------------------------------------------------------------------
//ControlDlg.cpp includes the main code for scanner
void CControlDlg::OndataReady(LPUNKNOWN pDobj)
{
STGMEDIUM s;
long hint = 0L;
BOOL r = FALSE;
COleDataObject foo;
foo.Attach((LPDATAOBJECT)pDobj);
r = ReadStream(pDobj, s, foo);
if(r){
SaveStream(filename); //saving
}
}
I like the user to choose a filename when my app starts, because this is a control programm for a 3d scanner over USB. When my app starts the scanner takes some scans every few seconds. So if the user select a filename at the start there is no data for the file at the begining.
When the scanner sends the datafiles i like to save them incremently.
For example:
filename choosen is "File", then saved as:
File_1
File_2
File_3
....
..for this the prog has to know the last filename. This all i have to handle.
|
|
|
|
|
I assume that OnDataSaveAs() is called when the "Save As" button is clicked, or when the "Save As" menu option is selected. Since this is a user-defined action, it may not have happened by the time your program needs the name of an output file (i.e., when calling SaveStream() from within CControlDlg::OndataReady().
It sounds like you need to check for the existance of an output filename before saving the data. Something like:
CControlDlg::OndataReady()
{
...
if (filename.IsEmpty() == TRUE)
{
CFileDialog dlg(FALSE);
dlg.DoModal();
filename = dlg.GetPathName();
}
...
SaveStream(filename);
}
You may need to remove like code from the CMainFrame::OnDataSaveAs() function.
|
|
|
|
|
Thanks for all. I will try it out.
|
|
|
|
|
I have a MFC SDI Application.
How can I set the file extension of the "Open File..." dialog?
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
http://www.mindcracker.com/mindcracker/c_cafe/mfc/filedlg.asp
|
|
|
|
|
Thanks for the link, but the SDI framework does automaticly open the "Open file..." dialog! And I am only want to change the file extension of this (automaticly called) dialog!
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
Edit the resource string table entry to set the file extension(s) that your app recognizes. It is probably an entry with the ID of IDR_MAINFRAME. An example is below:
ServerMon\n\nServer\nMonitor Server List (*.msl)\n.msl\nServerMon.Document\nServer Document
|
|
|
|
|
Thanks!
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
I create dial up entry programmaticly using visual C++ ver 6.0
To do so I need to fill RASENTRY structure and pass it to the RasSetEntryProperties function. everything works fine but there are some extra options under windows 2000 which I want to use.
For instance I want RASENTRY.dwOptions = RASEO_SecureLocalFiles to be set and my complier doesn't know what is RASEO_SecureLocalFiles is. Does it mean that using Visual C++ 6.0 I am not able to use win 2000 parameters? or maybe I should use newer version of RasApi. If so do I have to use .Net? I am confused.
Please help
|
|
|
|
|
You can download the latest Plaform SDK. This will update your headers and libs, and it also works with VC++6.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hello Friends,
I need to convert the ordinary dll(which can not be registered with regsvr32) to COM dll.Is there any tools for that
yakkalas
|
|
|
|
|
I don't think thare are any tool that can do it automatically.
It's the hard way in VC...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
I have to create an application whose user interface
looks like an X-MOTIF UI.
Is it possible to do that in VC++ ?
Does some utility classes already exists ?
Thanks a lot !!!
|
|
|
|
|
Hi ...
I Think there is a windows version of the QT library for windows.
There is also a Windows Fltk version you could try.
Dont forget to look at GTK+ windows version...
|
|
|
|
|
Hi!
I`m having problems with handling messages on my automation server which is written in Visual C++.
I use a DLL that generates messages which my automation server should handle, but it doesn`t seem to respond to the messages. The automation server compiles to a DLL. I`m gonna use it from Visual Basic by using the CreateObject() function.
Do anyone know how to handle messages on an automation server? I know how to handle messages on an executable program with an user interface. I`m using MFC and message handlers.
|
|
|
|
|
how to make setup of project in a visual c++ 6.0. i am using application wizard of visual c++ 6.0 but not succeding in making a setup. give me the step by step guideline.
thanx
Reply me soon
|
|
|
|