|
dp_76 wrote: Q1--> Is the above strategy fine?
This is the same thing as manipulating GUI objects from a worker thread since a ::SendMessage is issued in both cases. When using ::SendMessage the call will wait for the message to be handled before returning. If the receiving thread does not handle the message you will have a deadlock situation.
Even if you are fortunate and able to avoid a deadlock situation, your worker thread is waiting for the main thread to handle the message and your worker thread is "paused" until the main thread has handled the message. Usually this is not desired.
The use of ::PostMessage is recommended instead which will prevent a deadlock situation and also makes the worker thread continue while the main thread is handling the messages you've posted to it.
Regarding the message box issue the same thing as above is applicable.
If you are using ::SendMessage, the worker thread would be waiting for the call to return and here you may have a deadlock situation if you like to wait for the worker thread to finish by waiting on the thread handle.
The thing is do have a worker thread execute asynchronously as long as it does not use data that is shared between thread. If either thread is using shared data you would need some kind of synchronization object to prevent data corruption, e.g. critical section.
Hope this helps
--
Roger
It's supposed to be hard, otherwise anybody could do it!
|
|
|
|
|
|
Sounds fine. It is fine to display a message box in the worker thread - Although it is better if the UI thread does this as the worker can keep processing until the user makes his choice. Roger has a point when he makes his case for replacing SendMessage with PostMessage .
Steve
|
|
|
|
|
I want to show the thumbnails of html files to the user. As the thml file is of 600*400 I need to show the thumbnails in a list. So how do I convert the HTMl files output(the one which we see when we open the file in browser) into a image like bmp ot JPG
Regards,
Hemant Kulkarni
|
|
|
|
|
I dont really understand your question but from what i understand i suggest you open the Html file then press Print screen on your keyboard. Then open any image editor like MS paint then click paste and save your html file in any format you wish.
Hope this helps
Kelvin Chikomo
|
|
|
|
|
Thanks for reply
But I want to do this convertion programatically. So I need the code or the method to achive this.
Once gain thanks for your reply
Regards,
Hemant kulkarni
|
|
|
|
|
I haven't personally tried any of this but here goes:
1. Use IViewObject::Draw to draw into a HDC that has bitmap selected into it.
2. Didn't Windows used to generate thumbnails of HTML pages? Win98 was it? I believe this functionality still exists.
Steve
|
|
|
|
|
Code project article on it here.
Steve
|
|
|
|
|
|
Another CodeProject article on it here. This was the option 2 I was talking about.
Steve
-- modified at 5:11 Tuesday 17th January, 2006
Link in article is wrong, try this instead.
|
|
|
|
|
Hi Steve,
Thanks a lot for reply. Your code and method seems to be very helpful to me.
Thanks again for rugent reply !.
Regards,
Hemant Kulkarni.
|
|
|
|
|
Sir ,
As i m having the VS c++ 6.0 version where there is not the prototype for the IHtmlElementRender interface in the Mshtml.h file so is there any other way out of this.
Regards
Shikha
|
|
|
|
|
With the SDK that comes with MSVC6 the declaration is not present. In the Feburary 2003 Platform SDK it's present. You need to download a newer Platform SDK from Microsoft. Download from here[^]. You can use this SDK with MSVC6.
Steve
|
|
|
|
|
A more easy task
copy the Web pages to a folder
the select from the view thumbnails
and then use print screen to store the image
this can make ur work fast
Vikas Amin
Embin Technology
Bombay
|
|
|
|
|
I'm trying to send mouse message to a application programmatically . I use win32 API SendMessage() to MS Paint (just 4 a test) to draw : SendMessage(hwnd_paint,WM_LBUTTONDOWN,0,position). There was no error but nothing happened. Is there something wrong ?
|
|
|
|
|
1. Manually do the mouse event and using spy++ try to find out the appropriate values of LPARAM and WPARAM
2. After a lbuttondown message, also post a lbutton up message.
Regards,
Rajesh R. Subramanian
You have an apple and me too. We exchange those and We have an apple each.
You have an idea and me too. We exchange those and We have two ideas each.
|
|
|
|
|
To fake input you should use the SendInput function. See here for details (talks about keyboard input but a lot of what is mentioned still applies).
Steve
|
|
|
|
|
|
I used Spy++ to get parameter, and try to SendMessage. But it dosent work. I cant understand what happened ????
|
|
|
|
|
|
Using SendMessage or PostMessage message may or may not work, it depends on the program. As I mentioned the SendInput API is specifically designed for faking input. Here are some reasons the SendMessage /PostMessage technique may not work:
- The program calls the GetMessagePos to get the coordinated of the mouse when a message was posted.
- The program calls the GetAsyncKeyState to check for mouse buttons.
In short, the SendMessage /PostMessage may work, but then again it may not: it depends on how the program performs its input.
Steve
|
|
|
|
|
In my Project, i'm having 2 applications. i need to send and receive messages between the two applications. The first application should wait until it gets an acknowledgement from the second after sending the message. If i use WaitForSingleObject function, how can i carry this out? Please help....
|
|
|
|
|
|
|