|
if the content is static ( will be filled once with constant values ) then, you can add them directly in the resource editor ( no code needed for that ).
if the contenct is dynamic, you can use CListBox::AddString or CListBox::InsertString ( you need to code this ).
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Thanks for your reply.
Yes, the content is Static. Can you please give me some idea how to add this in resource editor.
Thanks Once Again
MFC
|
|
|
|
|
Preeti9 wrote: Yes, the content is Static. Can you please give me some idea how to add this in resource editor.
While it might be considered a neat idea, this solution has many drawbacks. In fact, it is only useful if the items in the control are language independent, and are insensitive to sorting.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Hmmm, Thanks I got it.
MFC
|
|
|
|
|
Like this
CListBox m_List;
m_List.AddString("123");
m_List.InsertString(1,"2323");
|
|
|
|
|
What is the best way to do it (VC++6.0 + MFC +Dialogapp) ?
~RaGE();
|
|
|
|
|
I use _access() , which is really just a wrapper around GetFileAttributes() .
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
You can use CFile::GetStats() to retirve the status of a file, if it exist.
|
|
|
|
|
Ajax95 wrote: You can use CFile::GetStats()...
From whence does this method exist? Perhaps you meant CFile::GetStatus() instead.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
i've been using ::PathFileExists() also
|
|
|
|
|
I used directshow Imediaseeking::getduration and windows media format sdk to extract mp3 song duration, but I got two different values. Result from IMediaSeeking is about 5 times longer than that from sdk. I am not familiar with structure of mp3. Thanks for any informations about this problem.
|
|
|
|
|
I'm not at all familiar with the programs/components you are referring to, but I'd be guessing that the mp3 is VBR (variable bit rate). I know in the past some programs have read times wrong because they have been code for a fixed rate.
When I die I'd like to go peacefully in my sleep like my father, not screaming in terror like his passengers!!!
|
|
|
|
|
Thank you. You are right. It is VBR. Do you have any ideas about how to fix this problem to extract the right duration? My situation is I am using directshow IMediaSeeking::setpositions to set the stop time(absolute), directshow IMediaSeeking::getduration extract the wrong duration (5 times longer). Is there any way to extract right duration from VBR mp3 using directshow? Thanks again.
|
|
|
|
|
Hi;
1|2|3
4|5|6
7|8|9
That is a tic tac, in c++.
I want to replace 5 by X and 3 by 0, but I have problem SET().
Can I do the following way move?
set X (int);
if( board [4]== 5)
return X;
-- modified at 9:34 Thursday 30th March, 2006
|
|
|
|
|
there's no need to repost the question exactly as previous time !!
if no one answered you, it's because we don't understand what you're talking about...
please elaborate more (with a better english if you can).
|
|
|
|
|
void CMyPsmDlg::OnButtonEncode() <br />
{<br />
char bu;<br />
FILE *InFile,*Binary;<br />
InFile=fopen(SourceFileName,"r");
Binary1=fopen("Binary1.txt","w");<br />
while(true)<br />
{<br />
bu=fgetc(InFile);<br />
if(feof(InFile))<br />
break;<br />
if ((bu=='%'))<br />
fprintf(Binary1,PERCENT);<br />
else if (bu==' ')<br />
fprintf(Binary1,SPACE);<br />
else if ((bu=='1'))<br />
fprintf(Binary1,N1);<br />
else if ((bu=='2'))<br />
fprintf(Binary1,N2);<br />
fclose(Infile);<br />
fclose(Binary);<br />
}<br />
<br />
FILE *Carrier, *Binary1,*LastOutput1;<br />
Carrier=fopen(CarrierFileName,"r");<br />
Binary1=fopen("Binary1.txt","r");<br />
LastOutput1=fopen("OutputFileName.txt","w");<br />
char BinaryBuffer,CarrierBuffer;<br />
while (true)<br />
{<br />
CarrierBuffer=fgetc(Carrier);<br />
if(feof(Carrier))<br />
break;<br />
else if (CarrierBuffer=='A')<br />
fprintf(LastOutput1,"A");<br />
else if (CarrierBuffer=='B')<br />
fprintf(LastOutput1,"B");<br />
else if (CarrierBuffer=='C')<br />
fprintf(LastOutput1,"C");<br />
else if (CarrierBuffer==' ')<br />
{<br />
BinaryBuffer=fgetc(Binary1);<br />
if(feof(Binary1))<br />
fprintf(LastOutput1," ");<br />
else if (BinaryBuffer=='1')<br />
fprintf(LastOutput1," ");
else if (BinaryBuffer=='0')<br />
fprintf(LastOutput1," ");<br />
}<br />
<br />
}<br />
<br />
}<br />
void CMyPsmDlg::OnButtonDecode()<br />
{<br />
char BinaryBuffer2[8],SpaceBinBuff;<br />
FILE *Binary2,*LastOutputDecode,*LastOutputEncode;<br />
Binary2=fopen("Binary2.txt","w");<br />
LastOutputEncode=fopen("OutputFileName.txt","r");<br />
while (true)<br />
{<br />
SpaceBinBuff=fgetc(LastOutputEncode);<br />
if (feof(LastOutputEncode))<br />
break;<br />
if (SpaceBinBuff==' ' && fgetc(LastOutputEncode) == ' ')<br />
{ <br />
fprintf(Binary2,"1");<br />
}<br />
else if (SpaceBinBuff==' ')<br />
{<br />
fprintf(Binary2,"0");<br />
}<br />
}<br />
fclose(Binary2);<br />
fclose(LastOutputEncode);<br />
FILE *Binary2;<br />
Binary2=fopen("Binary2.txt","r");<br />
LastOutputDecode=fopen( "AfterDecode.txt","w");<br />
while(true)<br />
{ <br />
fgets(BinaryBuffer2,8,Binary3);<br />
if(feof(Binary3))<br />
break;<br />
<br />
if (strcmp(BinaryBuffer2,A)==0)<br />
fprintf(LastOutputDecode,"A");<br />
<br />
else if (strcmp(BinaryBuffer2,B)==0)<br />
fprintf(LastOutputDecode,"B");<br />
<br />
else if (strcmp(BinaryBuffer2,C)==0)<br />
fprintf(LastOutputDecode,"C");<br />
fclose(LastOutputDecode);<br />
fclose(Binary3);<br />
<br />
} The problem is when i decode, there are a stream of AAAAAAAAA.. at the end of file decoded. How can i eliminate this?
HelpMe
-- modified at 11:42 Thursday 30th March, 2006
|
|
|
|
|
Please use the <pre> tags to surround code snippets. Is all of the code you've shown necessary to reproduce the problem. Unnecessary code should not be shown as it only adds to the confusion.
beardy janggut wrote: How can i eliminate this?
By stepping through the code.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Hi.
1.All program RegisterWindowMessage() a same string, the value is same? how to handle if RegisterWindowMessage() fail?
2.Why use GlobalAddAtom() get a ID to RegisterHotKey(), had some advantage? if GlobalAddAtom() fail use GlobalFindAddAtom()? Can you give a example about register system-wide hotkey.
Thanks.
|
|
|
|
|
I am using VC++ V6. When running a program I am writing multiple times, I get a stack overflow error message. That is the program runs and exits okay but after a variable number of runs the error appears. Sometimes after a couple of runs and sometimes after 14 0r 15 runs.
The following code is pointed to after the message:
void CSudokuDlg::fnCheckForZeros()
{
ipRandomArrayPointer=&iRandomNumberArray[0];
for (iCount0=0;iCount0<9;iCount0++) //cks for zeros in random array
{
if(*ipRandomArrayPointer==0)
{
ipRandomArrayPointer++;
}
else break;
}
}
It is called from a function that can call itself, but the max number of calls should only be less than a hundred or so. If I put the function above in the calling function as part of it's code the problem still exists. The calling function is then pointed to after the error.The array is dimensioned at 9 so it's not being over run.
The calling function is:
void CSudokuDlg::fnDuplicateCheck()
{
for(iCount1=0;iCount1<iColumnEnd;iCount1++)
{
if(*ipChkSolArrayForDupes==*ipRandomArrayPointer)
{
if(bRlastRow==true)//This means the solution is not possible
{ //with this random number set
bFlag=true;
return;
}
ipRandomArrayPointer++;
if(*ipRandomArrayPointer==0) fnCheckForZeros();
ipChkSolArrayForDupes-=(iCount1);
fnDuplicateCheck();
}
ipChkSolArrayForDupes++;
}
bRlastRow=false;
}
The problem has not occurred when stepping through the program - only when the program is restarted.
Can anybody help?
|
|
|
|
|
What does the stack frame look like when the stack overflow message is shown?
Clay L wrote: for(iCount1=0;iCount1<iColumnEnd;iCount1++)
What is the value of iColumnEnd ?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
The problem is solved !!
I had not looked at the call stack thinking it would give me some assembly language locations that wouldn't help. I was amazed to see the actual names of the functions called in the stack display.
When the stack overflow occurred, the function "fnDuplicateCheck()" appeared to be in an endless loop. I had protected against that - I thought - and it would have worked if I had checked the correct flag.
When I made the change the problem was fixed.
There are some nifty trouble shooting things in V++6 – if you have the experience to use them.
Thank you David!
|
|
|
|
|
i have a part of syntax below:
CEdit* pEdit=(CEdit*)GetDlgItem(IDC_EDIT1);<br />
CString strTeks;<br />
pEdit->GetWindowText(strTeks);<br />
<br />
int nLineCount = pEdit->GetLineCount();<br />
CString strLine;<br />
for (i=0;i < nLineCount;i++)<br />
{<br />
int len = pEdit->LineLength(pEdit->LineIndex(i));<br />
pEdit->GetLine(i, strTeks.GetBuffer(len), len);<br />
strTeks.ReleaseBuffer(len);<br />
strLine.Format(TEXT("line %d: '%s'\n"), i, strTeks);<br />
} then i want to print every character in the edit box in term of "1"
and "0" using fprintf at a .txt file. How can i do that???
HelpMe
-- modified at 11:11 Thursday 30th March, 2006
|
|
|
|
|
A funny method to try: supposing strTks is a number in a string, convert it to a real int:
unsigned int nb=aoti(strTks.operator LPCTSTR());
And convert it into a binary:
CString str="";
while (nb>0)
{
str=(nb&1 ? "1" : "0")+str;
nb>>=1;
}
Then you can fprintf the str.
~RaGE();
-- modified at 11:53 Thursday 30th March, 2006
|
|
|
|
|
Rage wrote: unsigned int nb=aoti(strTks.operator LPCTSTR());
Why the mess?
unsigned int nb = atoi(strTks);
Rage wrote: nb>>1;
You do realize that this does nothing, other than create an endless loop, don't you? Perhaps you meant to use this instead:
nb >>= 1;
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: Why the mess?
Because it does it anyway, so let's make it obvious.
DavidCrow wrote: You do realize that this does nothing, other than create an endless loop, don't you? Perhaps you meant to use this instead:
nb >>=1, correct.
~RaGE();
|
|
|
|