|
Which file do you want the users to open and how?
you can use use the CFileDialog class to be displayed and extract the path of the selected file and it's other details to open it. I hope I have understood you correctly else can you explain your problem in more detail.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
_AnShUmAn_ wrote: I hope I have understood you correctly
I bet you did since you gave the solution.
(his dialog is modal... )
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.
[my articles]
|
|
|
|
|
It's ok, I want to keep file opening code in one place.
|
|
|
|
|
followait wrote: ...but I can't call CWinApp::OnFileOpen directly.
Why do you deem it necessary? Can you not use CFileDialog , or GetOpenFileName() ?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
It's ok, I don't want to repeat the file opening code if there is any easy way.
|
|
|
|
|
Maybe
if (AfxGetApp()->m_pDocManager)
AfxGetApp()->m_pDocManager->OnFileOpen();
Also, your CWinApp-derived class can access the protected
CWinApp::OnFileOpen().
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
unlucky, in CSingleDocTemplate::OpenDocumentFile
pFrame = (CFrameWnd*)AfxGetMainWnd();
ASSERT(pFrame != NULL);
ASSERT_KINDOF(CFrameWnd, pFrame);
ASSERT_VALID(pFrame);
pFrame points to the object of the dialog
However, it will be easy to copy the code out.
|
|
|
|
|
Bummer!
followait wrote: However, it will be easy to copy the code out.
Yes....that was going to be my next suggestion
Cheers,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
my project is mp3 splitter it split mp3 files in small peices.
platform is Visual c++ 2005,any document is SDI.
how can i get this code from internet.
|
|
|
|
|
What about having a search?
|
|
|
|
|
|
There is a thing called "Audacity", which is open source. It does audio editing and recording. You can google for it and download the source code.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
|
vijaylaxmi wrote: how can i get this code from internet.
Rumor has it that vijaylaxmi has a VS2005 SDI project that will spilt MP3 files into small pieces. It sounds like just what you are looking for.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
//m_Path=input path
//m_Path2=output path
fstream rfile(m_Path,ios::in|ios::binary);//input file
fstream wfile(m_Path2,ios::out|ios::binary);//output file
//SeekPos is a starting location from where i start reading.
//SeekPos is a ending location till that i read.
char buffer[200000];
for(SeekPos;SeekPos<=SeekPos2;SeekPos++)
{
//rfile.get(ch);//if i read as character wise.
//wfile.put(ch);
rfile.read(buffer,sizeof(buffer));read from buffer
wfile.write(buffer,sizeof(buffer));
wfile.flush();
rfile.flush();
}
rfile.close();
wfile.close();
i m using this code,but itis not working properly.plz tell me right code.
|
|
|
|
|
You don't like the CopyFile [^] function?
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.
[my articles]
|
|
|
|
|
no,becoz i m not want to copy whole file i want copy selected part of file.
|
|
|
|
|
One of my very first C programs (before Windows 286) was a "file copier" where bytes were read/written in such a loop. I thought it was the coolest thing since sliced bread. I would spend hours benchmarking it against several files just to watch it go.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
DavidCrow wrote: One of my very first C programs (before Windows 286) was a "file copier" where bytes were read/written in such a loop. I thought it was the coolest thing since sliced bread. I would spend hours benchmarking it against several files just to watch it go.
and since it has been included in the OS , it is known as FileCopy function.
Anyway I guess the OP lacks such motivations.
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.
[my articles]
|
|
|
|
|
vijaylaxmi wrote: itis not working properly.
Tell us why and maybe we'll be able to offer suggestions. Unless you are bent on having a for loop to read X bytes at a time until you reach SeekPos2 , why not set up a buffer big enough to hold SeekPos2-SeekPos bytes and call Read() once?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
CString str;
unsigned long k=10000;
str.format("%?",str);
Thanks
|
|
|
|
|
SenToMessage wrote: str.format("%?",str);
Use %lu
But str.format("%lu",k); not str
|
|
|
|
|
|
what about checking the CString documentation first ?
how ?
open msdn.com first and make a search on CString class members.
reach Format(), and there you go.
the harder part is for now. read what's there, and understand it !
|
|
|
|
|
You're a rather rude guy!
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.
[my articles]
|
|
|
|