|
I am using IE browser in my app to display a bunch of data.
I have some HTML as a resource and I have a bunch of data laid out in a table. I have given IDs to the various <td> tags, each one unique.
I add an event handler in my MFC code that get an OnNavigateComplete call back. Here I can get the document from the browser object, and then search for the element by ID, and then replace the text value in it. Works great. EXCEPT:
When I put in a <SCRIPT> tag in the html! Then NO elements are found with ANY id's. Is this a known bug? Is there something else I am doing wrong? Is there a better place to post this than here?
<i>¡El diablo está en mis pantalones! ¡Mire, mire!</i>
<i>Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!</i>
<font size="1" color="black">SELECT * FROM <b>User</b> WHERE <b>Clue</b> > 0
<b>0 rows returned</b>
</font>
|
|
|
|
|
Never mind!
The problem is where you "post process" the HTML programatically. If you do it in the NavigateComplete event then things get funky. If you use the DocumentComplete event, then you're golden! Woot!
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
|
|
|
|
|
Can someone please explain to me why, when u exceed 20 characters input, it doesnt stop but just keeps on accepting input, and somehow ends up passing through the loop a few times instantaneously?
I mean.. just try typing in some 60 characters or so to see what i mean:
#include <stdio.h>
int IsPalindrome(const char*);
int main(void)
{
char str[21]={NULL};
int i=0;
char c=NULL;
do
{
if(str[0]!=NULL)
{
if(IsPalindrome(str))
printf("This is a palindrome!\n");
else
printf("This isn't a palindrome.\n");
}
i = 0;
while((c=getchar())!='\n' && i<21)
{
if((c>='a' && c<='z') || c=='$')
{
str[i] = c;
i++;
}
}
str[i] = NULL;
} while(str[0]!='$');
return 0;
}
int IsPalindrome(const char* str)
{
int len=0, i=0;
while(str[len++]!=NULL) {}
len--;
for(i=0;i<len;i++)
{
if(str[i]!=str[(len-1)-i])
return 0;
}
return 1;
}
Kuniva
--------------------------------------------
|
|
|
|
|
Change the while loop to:
while((c = getche()) != 0x0d && i<21)
For the IsPalindrome() function, why not just call strrev() followed by strcmp() ?
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Because we couldn't use string functions. And I don't see how u explain what happens here..
Kuniva
--------------------------------------------
|
|
|
|
|
Kuniva wrote:
Because we couldn't use string functions.
Fair enough.
Kuniva wrote:
And I don't see how u explain what happens here..
What's to explain? I trust you know that getchar() buffers input while getche() does not. That's why I suggested using it.
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Yea.. my bad, sorry.
Kuniva
--------------------------------------------
|
|
|
|
|
The problem here is that you've allocated a char array of size 21, i.e. with subscripts 0 to 20. Then, you're accepting input of length up to 20 characters, to fill the array you created. This is where the problem occurs, because in actual fact you should only be accepting 19 characters of input, since the twentieth needs to be the NULL string terminator. To clarify, note that str[21] is NOT inside the bounds of the array.
Hope this helps,
--
Andrew.
|
|
|
|
|
Thats not what I was asking, it doesn't have anything to do with my question. What does the size of the array have to do with the while loop not really running? If u don't believe me change it and see for urself.
What I was asking is why when u enter like 45 characters on the command line and press enter, it'll print three lines of output. It's supposed to simply stop at 20 chars (or 19 if u fix it whatever) and show the output, but it doesnt, it just keeps on accepting input even though i should become larger than 20, its like it doesnt execute the body of the loop at all..
Kuniva
--------------------------------------------
|
|
|
|
|
NVM, got it, the getchar() function just behaves differently from what I anticipated. It doesn't just wait for one key to be pressed and then return the result like i thought, instead u can enter as many chars as u want untill u hit return and they all end up in the input buffer, and it returns only the first char u enterred.. kinda weird but whatever.
Kuniva
--------------------------------------------
|
|
|
|
|
Does Any one has any idea how to create a font; that is create a font that support new characters symbols. think of it as creating a new font for a new language with unique characters and symbols.
|
|
|
|
|
How to get untransparent area (RECT) of icon?
|
|
|
|
|
BITMAPINFO &bmInfo = *(LPBITMAPINFO)hDIB Variable Declarations for bmInfo!!!
Hi, what does means the & ? what kind of datatype about bmInfo?? pointer???
Thanks
|
|
|
|
|
This is reference to an object. However defining reference not as parameter of function is bad programing style! Remember this.
|
|
|
|
|
Hi,
I want to get files list created,modified and last accessed on the basis of dates(i.e between 2 dates).How Can I do that.
Drushti
|
|
|
|
|
Use the CFileFind class to iterate through all the files in a specified folder (or subfolders, if you use recursion). From there you can get all the necessary file info for each file it iterates through.
while(true)
{
TryToLearn("C++,MFC");
}
My articles[^]
bdiamond
|
|
|
|
|
Hi ,
I want to get the different File types with there Icons in the Combo box . How can I get it?
Drushti
|
|
|
|
|
Please explain furthur. I do not understand what you are asking.
John
|
|
|
|
|
Ok John,
Here are more details...
What I want is when I click the combo box down arrow,different types of file format ,for example:- Header file, source file,mp3 file, adobe acrobat file,Microsoft word file and so on (i.e all supported and recognized file format by OS), should be displayed.
To have a clear idea ...if u r using Windows 2000 professional , then click Search -> for Files or Folders ->Search Options (hyperlink)->Type->Combobox.
Hope Now I nust have cleared my point.
Drushti
|
|
|
|
|
me think you need to check the registry ( under HREF_CLASSES_ROOT ).
check the "OpenWithList" entries.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
|
MSDN indicates that windows creates a message queue along with each thread that is created. If I create a thread with CreateThread(), how do I gain access to the message queue?
The reason I ask, is that I would like a worker thread to use Winsock2 Async functions. Therefore can I use the thread's message queue to receive message based socket notifications.
Can anyone point me in the right direction?
Many thanks.
|
|
|
|
|
When you make a worker thread, it does not initially have a message queue. The first time you call a message queue-related API, a queue is created. To create a queue, use this:
MSG msg;
PeekMessage( &msg, (HWND) INVALID_HANDLE_VALUE, WM_NULL, WM_NULL, PM_NOREMOVE );
--
I'm Michael Dunn and I approve this post.
Vote Trogdor in oh-four!
|
|
|
|
|
Michael,
Many thanks. It all helps!
Spencer
|
|
|
|
|
MSDN indicates that windows creates a message queue along with each thread that is created
That's not exactly true. Threads only have a message queue if they call one of the thread processing functions, such as GetMessage, PeekMessage, or create a window.
Therefore can I use the thread's message queue to receive message based socket notifications
Yes, absolutely. It is easy to use a background thread to handle socket communication. But, before I give a brief description of how to handle Async sockets, I should mention there is a better method. Use event based sockets (WSAEventSelect instead of WSAAsyncSelect). The performance for event based is tremendously better than for async sockets. Message processing uses a lot of overhead. If your data load is small, then it won't matter too much which way you go, but if you expect high data streams, async sockets simply won't keep up.
Note: MFC's CAsyncSocket does not support event based, but it is not as hard to do it by hand as it may seem).
Now for async sockets:
Create your background thread. Inside your thread, create a non-visible window as a child of your main window. Use this background window to receive all socket notifications. In other words, pass this window handle to the AsyncSelect function.
If you're using MFC, create a CWinThread derived class. Use this class for the AfxCreateThread function. Inside the InitInstance function for this thread class, create your window and set it as the m_pMainWnd for the thread (just like what happens with CWinApp and CMainFrame). The built-in "Run" function will properly handle the message processing. Now just add an appropriate ON_MESSAGE handler to your background window class (just derive from CWnd).
|
|
|
|