|
The problem is that you call delete only when Create fails.
You should call delete once you are done with PropertySheet.
Regards
|
|
|
|
|
special thanks
thaaaaaaaannnnnkkkk you very veryyyyyyyyyyyyyyyyyy much
|
|
|
|
|
where should I put the second delete because i need it dispalyed until programm is close
I tried to put it in MainFrm in WM_ONCLOSE but it doesn't work
|
|
|
|
|
Try putting it in your CFormView's destructor, but It necessary to destroy its window first.
Regards
|
|
|
|
|
ok it's running
thank's very much
|
|
|
|
|
Hi,
How can v use installshield to run our software burnt on cd. The s/w has been developed in VC++ 6.0, Plz tell me the whole process from installing install shield and running the exe saved in cd
|
|
|
|
|
You should be able to find information about installation process in IS documentation.
As for autorun:
For example:
in the root of your cd, create autorun.inf containing following section:
[AutoRun]
open=application.exe
That's all folks.
Regards
|
|
|
|
|
I follow the following steps to write a simple record program
waveInOpen
waveInPrepareHeader
waveInAddBuffer
waveInStart
waveInGetPosition
waveInReset
waveInUnprepareHeader
waveInClose
The program runs with no errors.
But I create a file to record the voice.
HANDLE FileHandle = CreateFile( L"myTest.wav", GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
The wav file was created.
But I play rhe wav file by windows media player.
It says there is an error.
Is there any problem with my code?
My part code is below.
<br />
HANDLE FileHandle = CreateFile( L"myTest.wav", GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); <br />
WriteFile(FileHandle, &dwNumber, 4, &NumToWrite, NULL); <br />
SetEndOfFile(FileHandle); <br />
CloseHandle( FileHandle ); <br />
FileHandle = INVALID_HANDLE_VALUE;<br />
Can somebody help me?
Thanks a lot.
minihotto
|
|
|
|
|
minihotto wrote: WriteFile(FileHandle, &dwNumber, 4, &NumToWrite, NULL);
You know that your file will only be 4 bytes ? I hardly believe this a valid file format for a wav file. Check the documentation of the WriteFile[^] function.
Also, you will need to follow the format reaquired for a wav file (I don't know it but if you search on google, you could find it).
minihotto wrote: SetEndOfFile(FileHandle);
What are you trying to do here ?
|
|
|
|
|
I see. thnaks.
this is the example I find from internet
<br />
HANDLE FileHandle = CreateFile( "Test.wav", GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); <br />
dwNumber = FCC("RIFF"); <br />
WriteFile(FileHandle, &dwNumber, 4, &NumToWrite, NULL); <br />
what is FCC?
I cant find it in the msdn.
can somebody help me ?
thanks a lot.
minihotto
|
|
|
|
|
It's probably a function that they developed themselves. But anyway, you first need to understand the file structure of the wav file in order to have something that can be played.
|
|
|
|
|
minihotto wrote: HANDLE FileHandle = CreateFile( L"myTest.wav", GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
WriteFile(FileHandle, &dwNumber, 4, &NumToWrite, NULL);
SetEndOfFile(FileHandle);
CloseHandle( FileHandle );
FileHandle = INVALID_HANDLE_VALUE;
This file doesn't even have a header, and your code wrote only 4 bytes of data to it, so how would you want it to be played?
Regards
|
|
|
|
|
In addition use of CREATE_ALWAYS overwrite your file if its exist
|
|
|
|
|
Microsoft's WAV file format is well documented.
A quick GOOGLEY search found this one
WaveFormat[^]
By the way, FCC() is just somebody's function for dealing with FOURCC codes - four characters
which need to be written in order in a big-endian/little-endian integer world.
Mark
|
|
|
|
|
I stored the string "wellcome to my life" in file.
Later, when i tried
fflush(stdin);input>>tmp;
cout<<"string: "<<tmp<<endl;cout.flush();
the string="" is="" displayed="" only="" "wellcome"
would="" you="" mind="" telling="" me="" how="" to="" solve="" the="" problem
thanks=""
<div="" class="ForumSig">hehe
|
|
|
|
|
would you post complete code ?
|
|
|
|
|
Here is how it goes, thanks
void ReadList()
{
int n,i;
char *tmp = new char[255];
ifstream input(filename,ios::in);
if (!input)
{
cout<<"Khong mo duoc file"<<endl;
exit(1);
="" }
="" input="">>n;
for (i=0;i<n;i++)
{
="" fflush(stdin);input="">>tmp;
cout<<"Ten sinh vien: "<<tmp<<endl;cout.flush();getch();
fflush(stdin);input="">>tmp;
cout<<" Ngay sinh: "<<tmp<<endl;cout.flush();getch();
fflush(stdin);input="">>tmp;
cout<<" Lop: "<<tmp<<endl;cout.flush();getch();
fflush(stdin);input="">>tmp;
cout<<" Diem TBC: "<<tmp<<endl;cout.flush();getch();
cout<<"\n";
="" }
="" input.close();
}=""
<div="" class="ForumSig">hehe
|
|
|
|
|
Is there any problem in reading line by line or character by character,
while (input.good())
{
input.getline(tmp ,255);
cout<<tmp <<end;
}
|
|
|
|
|
Hi,
In case of >> operator, string is extracted up to the first whitespace character, and that's why you can't read entire string.
Use getline instead.
working example:
const int slen = 256;
char tmp[slen] = "Sit on my face...";
ofstream ofile("c:\\test.txt", ios::out);
ofile << tmp << endl; ofile.flush();
ofile.close();
char tmp2[slen];
ifstream ifile("c:\\test.txt", ios::in);
ifile.getline(tmp2, 256);
cout << tmp2 << endl;
ifile.close();
Regards
|
|
|
|
|
hi all i want to make permission on the folders through vc++ code so that any user does not access those folders and delete their files,basically i m making the document Management System and want for that any help is welcomed.
Tasleem Arif
|
|
|
|
|
|
I was trying to change the font of some labels on a dialog, I used the following code:
HBRUSH CTabOne::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)<br />
{<br />
<br />
<br />
HBRUSH hbr = NULL;<br />
CFont LabelFont;<br />
if(nCtlColor == CTLCOLOR_DLG || nCtlColor == CTLCOLOR_STATIC)<br />
{<br />
if(pWnd->GetDlgCtrlID() == IDC_STATIC_COMMAND)<br />
{<br />
LabelFont.CreateFont (14,14,0,0,FW_BOLD, FALSE, FALSE, 0, DEFAULT_CHARSET,<br />
OUT_CHARACTER_PRECIS, CLIP_CHARACTER_PRECIS, DEFAULT_QUALITY,<br />
DEFAULT_PITCH, NULL);<br />
pWnd->SetFont (&LabelFont, TRUE);<br />
}<br />
}<br />
return hbr;<br />
}
And included
ON_WM_CTLCOLOR()
in the message map.
But looking at the processing that is being done ~ 50%, I have got something wrong! Also the labels 'flicker'.
As these are static labels, just need the Font set during dialog initialsation.
A bit confused as to how to set up the OnCtlColor parameters if thats the way to do it.
Any suggestions please.
Andy.
|
|
|
|
|
Why dont you use CWnd::SetFont() for this purpose? Instead of above code.
|
|
|
|
|
Hi,
instead: pWnd->SetFont (&LabelFont, TRUE);
use: pDC->SelectObject( LabelFont );
and don't forget about delete font object
LabelFont->DeleteObject();
Works pretty good
-----------
Mila
|
|
|
|
|
Mila025 wrote: use: pDC->SelectObject( LabelFont );
Why?
SetFont can be called from OnInitDialog . As it needs to be set once. Why you want to set it again and again.(it will be called each time window is painted).
|
|
|
|