|
By the way, you could replace the entire function with a call to _istalpha (isalpha/iswalpha).
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
i had but it create a problem :P
|
|
|
|
|
it's so obvious that you forget to return after the loop.
You may think that it will definitely return inside the loop (it loops 26 times) but at compile time, the computer can't tell whether the loop will be perform or not. To the compiler, a for() loop is one kind of structure that can be ignored, that's why you have to put a return explicitly after the loop.
|
|
|
|
|
GameProfessor wrote: it loops 26 times
It loops once
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I have developed an application and I am wondering how I can prevent the main window from being displayed in the task bar even when it is visible; I am writing in plain C/C++ (no MFC)
Thanks for your help,
--PerspX
|
|
|
|
|
|
put this code in your OnInitDialog function
ModifyStyleEx( hWnd, WS_EX_APPWINDOW, WS_EX_TOOLWINDOW );
nave
|
|
|
|
|
Thanks!
I used the foll: call to hide the taskbar:
ModifyStyleEx(0, WS_EX_TOOLWINDOW,0 );
Helped loads,thanks again.
|
|
|
|
|
Perspx wrote: I am wondering how I can prevent the main window from being displayed in the task bar even when it is visible;
Have a hidden parent for the window.
|
|
|
|
|
this is the best option ModifyStyleEx( hWnd, WS_EX_APPWINDOW, WS_EX_TOOLWINDOW );
|
|
|
|
|
Thank you for all of your replies
--PerspX
|
|
|
|
|
hi guys,
from my application i want to read a html page just say rediff.com and i dont have to show the page but from the page i have to read some number and display those numbers in my application. so the basic task is read a html page from net and look for a number value which is in a table, and after reading display that value and label of table cell in the application, any idea or any help
|
|
|
|
|
Have you looked into the IHTMLDocument interface?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
thanks guys, but i am not sure but i think i have to dig more about IHTMLElement, anyway thanks a lot
|
|
|
|
|
Hi i have create a fuction to find how many words (str2) exist in line
int CInfoRecoverDlg::Compare( CString line , CString str2)
{
int nCount = 0;
int index=0;
for (int i = 0 ; i < line.GetLength() ; i++)
{
index=line.Find(str2,index);
if( index!= -1 )
{
if( !isalpha(line.GetAt(index-1)) && !isalpha(line.GetAt(index+ str2.GetLength())))
{
nCount++;
index++;
}
}
else
return nCount;
}
return nCount ;
}
When i compare 2 CString that i have initialize and give value throught my code everything work nice
like here
void CInfoRecoverDlg::OnButton1()
{
CString str1;
CString str = "yes";
CString line = "yes i said yes, yes yes ";
int nCount;
nCount = Compare( line , str);
str1.Format(_T("%d"), nCount);
AfxMessageBox(str1);
}
but when i compare 1 str (User give it throught application UI) with 1 line
(it get it from a file) things dont go well
<code> CArray<CString , CString> RArray;
CString FilePathName;
CString LineRead ;
CString str7;
int ntimes=0;
const int sz =100;
char buf[sz];
CString sl , slsl;
sl = "\\" ;
FilePathName = m_FolderName + FArray.GetAt(0);
m_List.AddString(FilePathName);
ifstream FileText(FilePathName);
while(FileText.get(buf,sz))
{
FileText.get();
LineRead = (LPCSTR) buf;
for ( int m = 0 ; m <WArray.GetSize() ; m++)
{
str7 = WArray.GetAt(m);
ntimes = ntimes + Compare(LineRead , str7);
}
}
FileText.close();
CString str13;
str13.Format(_T("%d"),ntimes);
AfxMessageBox(str13);</code>
|
|
|
|
|
Immunity18 wrote: ...things dont go well
Which means what? Have you stepped through Compare() to find out what is wrong?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
i mean i have the same phrase in the file and in CString so it had to be the same result ?
when i try to debug it says "one or more breakpoints cant ..." and it show me a Kernel thing
|
|
|
|
|
Immunity18 wrote: i mean i have the same phrase in the file and in CString so it had to be the same result ?
Just because you pass a particular value to a method does not mean that same value is being "seen" by the method correctly. Set a breakpoint within the method and examine the values.
Immunity18 wrote: when i try to debug it says "one or more breakpoints cant ..." and it show me a Kernel thing
I'd be more concerned with this at the moment than I would be with why my code does not work. If you can't debug effectively, it's going to be a long road...
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
DavidCrow wrote: I'd be more concerned with this at the moment than I would be with why my code does not work. If you can't debug effectively, it's going to be a long road...
Wrong :/ i was on Release mode
When i put breakpoint in the for {loop} so i get the compare value it give me a Debug error and while i press (ignore it) it doesnt
|
|
|
|
|
Immunity18 wrote: ...it give me a Debug error...
I assume you are referring to a debug assertion on the line containing isalpha() . If so, it should be apparent why this is happening. The first time through the loop, index is 0, and you are then passing -1 to the GetAt() method. Do you concur?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
in first i didnt have control it right and for index = 0 i passing -1 in getAt but now i think its right the code ? but still same debug assertion
int nCount = 0;
int index=0;
for (int i = 0 ; i < line.GetLength() ; i++)
{
index=line.Find(str2,index);
if( index!= -1 )
{
if ( index >1 )
{
if( 0 == isalpha(line.GetAt(index-1)) && 0 == isalpha(line.GetAt(index+ str2.GetLength())))
{
nCount++;
index++;
}
}
else
{
if(0 == isalpha(line.GetAt(index+ str2.GetLength())) )
{
nCount++;
index++;
}
}
}
else
return nCount;
}
return nCount ;
|
|
|
|
|
See here.
You indicate that the debug assertion is still happening, but you failed to indicate where, and what the call stack looked like at that point.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
Immunity18 wrote: althought the results are differect
And those results would be what? Are you stepping throuygh the Compare() method? I doubt it, or would would have quickly seen that the last time through the loop, index is 30, which results in 33 being sent to the GetAt() method. Since the line being examined is only 33 characters long, the valid indices are 0-32.
Again I ask, what are you trying to accomplish with the code following the call to Find() ?
Immunity18 wrote: http://195.251.111.53/~labdb219/upload/correctvalues.bmp[^]
Try using a JPG so that a 2.3MB image does not have to be used. What exactly is this supposed to be showing? "How" you are calling the Compare() method is not the problem. It's what you are doing within it that is.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|