|
Hi all:
As we all know messages must involve with specific window's handle, but I come across a requirement that there's no window handle available, but still I want a sub thread to send a WM_QUIT(PostQuitMessage(...)) message to main thread, in order to stop the main thread's
while (GetMessage(&msg, NULL, 0, 0))<br />
{<br />
TranslateMessage(&msg);<br />
DispatchMessage(&msg);<br />
}<br />
Send a PostQuitMessage from sub thread doesn't seem to work.
|
|
|
|
|
cant you use PostThreadMessage()?
nave
|
|
|
|
|
Thanks, But how can I get the main thread's ID.
|
|
|
|
|
simple
AfxGetApp()->PostThreadMessage( WM_QUIT, 0, 0 );
nave
|
|
|
|
|
LiYS wrote: requirement that there's no window handle available, but still I want a sub thread to send a WM_QUIT(PostQuitMessage(...)) message to main thread,
To send message you should have a window handle, to send message to that specific window. or you can broadcast the message but in your case its WM_QUIT, so you can not boardcast it. Better you can pass the window handle to the thread at the time its creation and use the handle to send the message
Do your Duty and Don't expect the Result Rate this Post, if I helped You
|
|
|
|
|
This is all happened before CreateWindow
|
|
|
|
|
LiYS wrote: PostQuitMessage from sub thread doesn't seem to work
This would post WM_QUIT message to that threads(sub) message queue, if there is any.
So in this case you should follow suggestion by Naveen .
|
|
|
|
|
what about direct api call of PostQuitMessgae
|
|
|
|
|
Anyone out there have any good references on how to improve TCP/SSL performance on high latency connections.
We see bandwidth dropping radically as latency increases... would like to get rid of this issue.
I don't see much of anything in the socket options.
I also cannot switch away from TCP, am required to use SSL.
Oh, and I really cannot mess with the registry...
And am using OpenSSL for my SSL overhead.
Any thoughts to share?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc.</A>
|
|
|
|
|
Where/when is the latency, how are you measuring it, and where is it coming from?
Depending on when the latency occurs, it could definitely impact throughput.
Mark
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
It's not a measured thing unfortunately.
We have this client/server thingy. I am in California and the server is in California. I don't have much trouble with throughput.
But I have this user in Denmark who is trying to connect to the serer in California. He's got a soooper high speed connection to the internet... but can only get limited bandwidth between his client and our server.
I am very confident in his connection...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc.</A>
|
|
|
|
|
Try increasing the TCP window size, on both client and server, for both send and receive buffers.
See SO_SNDBUF and SO_RCVBUF, in the Winsock docs.
The buffers should be sized to approximately RTT (round trip time) times the bandwidth of the smallest pipe. So, you really need to get a good estimate of RTT (try ping), and it really doesn't matter if your Danish user has a huge pipe if you are shipping it up to him through a 1500/300 ADSL link.
If you don't have access to code, there are some registry tweaks available as described (e.g.,) at "Windows 2000 TCP Performance Tuning Tips" at http://rdweb.cns.vt.edu/public/notes/win2k-tcpip.htm[^]. There are lots of sites like that one (search on "SO_RCVBUF SO_SNDBUF RTT bandwidth"). The Win2k registry entries are the same in WinXP.
Mike
|
|
|
|
|
Hey Mike
Great reply. From a programmer with minimal IT skills - Thanks for the info!
Mark
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
Hi all.
In my application I am trying to read some registry values which are stored during installation.
Registry reading/writing operation works fine on all other OS but it fails on Vista.
When I disable the UAC from Vista, it supports registry reading and writing.
Here is the way I am disabling UAC
Start->Control panel->User Accounts->Change Security Settings->Uncheck "Use User Account Control (UAC) to help protect your Computer”.
But disabling UAC is certainly not a good way to get the solution. Is there any other way by which I can read/write registry without disabling UAC?
Thanks
Sameer Thakur
|
|
|
|
|
You can write to HKEY_CURRENT_USER in the registry.
Alternatively you can create a manifest file and then allow your application to run under Admin privileges and this would allow you to write to the registry.
There are also some more ways in which you can do this that you can look for yourself.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
I Hope this[^] will help you.
Regards,
Paresh.
|
|
|
|
|
Check the permissions requested when opening the primary keys for reading. You might be using KEY_ALL_ACCESS when you should only request the privileges you need.
Try using only KEY_QUERY_VALUE|KEY_READ instead and oyu will find it probably works as expected.
|
|
|
|
|
Hello All,
I am trying a read text file and extracting words from it and adding to a map.
I want to add only valid words and eliminate numbers and special character words and then add it to map.
Invalid words like 1word , hello# , t2o etc … so I want to eliminate all the number and special characters.
Can anyone please help me with this ….
strlwr(word);
wsize = strlen(word);
stemp = word;
for(int j =0; j<=wsize; j++)
{
if ( stemp[j] == '.' || stemp[j] == ';' || stemp[j] == '*' || stemp[j] == '#' && stemp[j] == '!' || stemp[j] == '@' || stemp[j] == '$' || stemp[j] == '%' && stemp[j] == '^' || stemp[j] == '&' || stemp[j] == '(' || stemp[j] == ')' && stemp[j] == '-' || stemp[j] == '+' || stemp[j] == '/' )
break;
else
FMap[stemp]=offset;
}
This conditions are very lengthy, is there any way I can reduce it by checking the ASCII value and add them to MAP.
Thanking you,
Suresh HC.
|
|
|
|
|
Why don't you simply check if the value is between 'a' and 'z' or between 'A' and 'Z' ?
|
|
|
|
|
Thanks Cedric Moonen for the response.
ASCII values A – 65 to Z – 90 & a – 97 to z – 122.
But hw to check them in the condition ???
|
|
|
|
|
if ( stemp[j] >= 'a' && stemp[j]<= 'z' ||
stemp[j] >= 'A' && stemp[j]<= 'Z' )
{
// add to map
}
nave
|
|
|
|
|
Suresh H wrote: SCII values A – 65 to Z – 90 & a – 97 to z – 122.
IsCharAlpha
|
|
|
|
|
You can use,
isalpha() API
or
You can check the chars are alphabet or not.
if (((stemp[j] >= 65) && (stemp[j] <= 90) ||
((stemp[j] >= 97) && (stemp[j] <= 122)))
else
Do your Duty and Don't expect the Result Rate this Post, if I helped You
|
|
|
|
|
Hi Appu,
Thanks for the response, I made changes but the code as no effect its adding all the words. Including numbers and special characters.
for(int j =0; j<=wsize; j++)<br />
{<br />
if ( (stemp[j] >= 65) && (stemp[j] <= 90) || <br />
(stemp[j] >= 97) && (stemp[j] <= 122) ) <br />
{<br />
FMap[stemp]=offset; <br />
}<br />
} <br />
}<br />
<br />
Something is wrong in the for loop i am unable to find, what will the cause ?
|
|
|
|
|
Suresh H wrote: if ( (stemp[j] >= 65) && (stemp[j] <= 90) ||
(stemp[j] >= 97) && (stemp[j] <= 122) )
you missed out one bracket and it means the whole condition is wrong
if ( ((stemp[j] >= 65) && (stemp[j] <= 90) )||
((stemp[j] >= 97) && (stemp[j] <= 122)) )
Do your Duty and Don't expect the Result Rate this Post, if I helped You
|
|
|
|