|
killer fria wrote: why do i get an error with this source code?
When you have an error, it would be nice to explain exactly what the problem is. I have an error is very vague and doesn't give any clue about what the problem could be. Compile error ? Linker error ? Run-time error ? And describe exactly the error.
And also, use the code tag (above the emoticons) whenever you need to post code otherwise your code is almost unreadable.
|
|
|
|
|
oh im sorry.it was just my first time to join forums like this. anyway the error that im referring to is an unexpected end of file while looking for pre compiled header directive.
i dont know what header i will use for this program.
here's the code..
<br />
<br />
<br />
BOOL SaveWAVFile(LPCTSTR lpszPathName, HPSTR pSound, LONG cbSound,WAVEFORMATEX pWfx, LONG cbWfx);<br />
{<br />
MMIOINFO mmioinfo;<br />
MMCKINFO ckRIFF;<br />
MMCKINFO ck;<br />
HMMIO hmmio;<br />
<br />
::ZeroMemory(&mmioinfo,sizeof(mmioinfo));<br />
{<br />
hmmio = mmioOpen((LPSTR) lpszPathName,&mmioinfo,MMIO_WRITE|MMIO_CREATE);<br />
<br />
if (hmmio == NULL) <br />
{<br />
TRACE("mmioOpen returns NULL\n");<br />
return FALSE;<br />
}<br />
<br />
ckRIFF.fccType = mmioFOURCC('W', 'A', 'V', 'E');<br />
ckRIFF.cksize = 0L;<br />
ckRIFF.dwFlags = MMIO_DIRTY;<br />
mmioCreateChunk(hmmio, &ckRIFF, MMIO_CREATERIFF);<br />
<br />
ck.ckid = mmioFOURCC('f', 'm', 't', ' ');<br />
ck.cksize = 0L;<br />
ck.dwFlags = MMIO_DIRTY;<br />
mmioCreateChunk(hmmio, &ck, 0);<br />
mmioWrite(hmmio, (HPSTR) pWfx, cbWfx);<br />
<br />
mmioAscend(hmmio, &ck, 0);<br />
<br />
ck.ckid = mmioFOURCC('d', 'a', 't', 'a');<br />
ck.cksize = 0L;<br />
ck.dwFlags = MMIO_DIRTY;<br />
mmioCreateChunk(hmmio, &ck, 0);<br />
mmioWrite(hmmio,(HPSTR) pSound,cbSound);<br />
<br />
mmioAscend(hmmio, &ck, 0);<br />
<br />
mmioAscend(hmmio, &ckRIFF, 0);<br />
mmioClose(hmmio,0);<br />
}<br />
|
|
|
|
|
git crunk wrote: anyway the error that im referring to is an unexpected end of file while looking for pre compiled header directive
Well, that would have been impossible to determine by the code snippet you posted . So, from now on remember to be extremely specific whenever you ask a question.
To correct the problem, simply add #include "stdafx.h" at the top of your .cpp file (and before all other include directive, otherwise it won't work).
Remember to do that in all the cpp files you create.
Another option is to disable the precompiled directive. You can go in your "project settings", "C/C++", "Precompiled headers" and there you should find an option to disable the precompiled header (I'm not totally sure of the way to access it but it should give a good idea of where to find the setting)
|
|
|
|
|
hi !
i have created a function below to check the whether the file is created on that particular drive.
but gives INVALID_HANDLE_VALUE .
<CODE>
void _FilePersistandata()
{
HANDLE hFile = INVALID_HANDLE_VALUE;
hFile=CreateFile ( L"c:\FileProperty.XML"
, GENERIC_READ | GENERIC_WRITE
, 0
, NULL
, OPEN_EXISTING
, FILE_FLAG_NO_BUFFERING
, NULL
);
if(hFile == INVALID_HANDLE_VALUE)
{
MessageBox(0,_T("File is not created"),_T("Create File"),0);
}
else
{
MessageBox(0,_T("file has been created"),_T("Creat File"),0);
}
}
</CODE>
|
|
|
|
|
amitmistry_petlad wrote: hFile=CreateFile ( L"c:\FileProperty.XML"
You missed a escape sequence here. i.e. L"c:\FileProperty.XML" should be L"c:\\FileProperty.XML" .
|
|
|
|
|
i have did it. but still it gives the error
HANDLE hFile = INVALID_HANDLE_VALUE;
hFile=CreateFile ( L"c:\\FileProperty.XML" <code>
, GENERIC_READ | GENERIC_WRITE
, FILE_SHARE_READ
, NULL
, CREATE_NEW|OPEN_EXISTING <code>
, FILE_ATTRIBUTE_NORMAL
, NULL
);
if(hFile == INVALID_HANDLE_VALUE)
{
MessageBox(0,_T("File is not created"),_T("Create File"),0);
}
else
{
MessageBox(0,_T("File is created"),_T("Create File"),0);
}
|
|
|
|
|
amitmistry_petlad wrote: OPEN_EXISTING
Function will fail, if specified file does not exists.
amitmistry_petlad wrote: CREATE_NEW
Function will fail of specified file does already exists.
So use flags correctly.
|
|
|
|
|
Thanks its working now.
but i did try like c,c++.
i have read it in the ebook after your comment.
so can we not use like in c and c++ if the file exit it overwite and if not present then create automatic.
amit
|
|
|
|
|
amitmistry_petlad wrote: if the file exit it overwite and if not present then create automatic.
Use CREATE_ALWAYS then.
|
|
|
|
|
|
i have did it. but still it gives the error
HANDLE hFile = INVALID_HANDLE_VALUE;
hFile=CreateFile ( L"c:\\FileProperty.XML" <code>
, GENERIC_READ | GENERIC_WRITE
, FILE_SHARE_READ
, NULL
, CREATE_NEW|OPEN_EXISTING <code>
, FILE_ATTRIBUTE_NORMAL
, NULL
);
if(hFile == INVALID_HANDLE_VALUE)
{
MessageBox(0,_T("File is not created"),_T("Create File"),0);
}
else
{
MessageBox(0,_T("File is created"),_T("Create File"),0);
}
|
|
|
|
|
WhiteSky wrote: You must use of // not /
It is \\ and not // or /
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
yeah I think I must change position of buttons on the keyboard;P
|
|
|
|
|
Hi,
I read somewhere that its a bad idea to pass CString between threads but I wondered if it was OK if the threads were only reading the CString and not changing it.
I have a global CString initialised by the main thread at start-up but many other threads need to be able to read it while the application is running and I wonderd if this was OK.
Any help would be appreciated.
Tony
|
|
|
|
|
softwaremonkey wrote: threads were only reading
Reading should be okay. Can you guarantee that the threads will be only reading from the variable and not writing to it. Is it a const variable.
|
|
|
|
|
Thanks for the reply. I am not sure that I can make it a const variable otherwise I dont see how I could set it initially (at run time). I guess I could use a const "Get" method to return the string. That should enforce read only access.
Thanks again
|
|
|
|
|
A CString object in any form is not thread-safe.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
The same rules apply to any object shared between threads.
Reading a CString is probably safe, and probably always will be, BUT...
CString is a class, and its implementation is hidden from you. You have no way of knowing
if the underlying implementation moves the string around in memory so theoretically even read
access should be synchronized between threads.
Again, if you look at the CStringT class it's safe. The underlying implementation could change
at any time though. Probably won't, but...just something to think about before assuming all
read operations are safe on objects.
Mark
|
|
|
|
|
Hi,
I need to add animation to my splash screen. I created a dialog based application and displayed the splash screen. But how to show the animation in that splash screen..?
Thank you in advance,
Sangeetha. J
With Regards,
Sangeetha.
|
|
|
|
|
See here[^] if its helpfuls
|
|
|
|
|
Hi,
I have seen that article and based on that only i displayed the splash screen. But they have displayed the text one after another at some time interval. But i need to display some animations instead of text.. what to do..?
Thank u for the previous reply,
Sangeetha. J
With Regards,
Sangeetha.
|
|
|
|
|
Sangeetha_J wrote: But i need to display some animations instead of text..
What is the animation you are talking about? Are we expected to guess that? Is that a GIF or a Flash movie or what exactly is it?
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
Hi,
I need to display a GIF file.
Sangeetha. J
With Regards,
Sangeetha.
|
|
|
|
|
The following two articles are relatively simple and would be helpful to add GIF animation to your project.
CPictureExWnd[^]
CPicture[^]
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
I need to display the GIF file or any of the animation files in the Splash Screen and not over the dialog box itself.. sorry..
With Regards,
Sangeetha.
|
|
|
|
|