|
Thank you. That helped me much
I am working at a IE plug-in and I had to use CTR-R, CTRL-H as hotkeys for the plug-in. These were also hotkeys for the browser.
So I used RegisterHotKey and UnregisterHotKey.
Is there another way that I can override or disable the browser's hotkeys while the plugin is used?
danginkgo
|
|
|
|
|
I have never worked with IE plugins, so I can't help you there.
Cheers
Steen.
"Are you gonna check your makeup when you're done whining?" John Simmons, 05/31/2006
"Of course, the next day it automatically updates, and your quick'n'dirty patches cause the new binaries to segfault all over your linoleum. If only you'd had the source..." Shog, 10/18/2006
"One day I realized that sadness is just another word for not enough coffee" Wally, 10/18/2006
|
|
|
|
|
OK, thank you for your help.
I'll use system wide keys and I hope I don't get no problems
danginkgo
|
|
|
|
|
Hi,
I am establishing a connection with the postgres database when my application comes up. And closing the connection during the exit of my application.
But some times during the exit, application hangs in the "database.close()" statement. i.e. Execution is not moving to the next line. even for 2 days it stays there in the same close statement.
Any help would be appreciated.
Thanks in advance...
Selva
|
|
|
|
|
First of all, let me salute your patience. 2 days? Not bad.
You don't need an explicit close() since it's taken care of in the destructor if it's still open. (Of course, you need to delete the CDatabase object if it's allocated in the heap.)
Try without, and see what happens. You should be able to call close() multiple times, so there is probably something fishy in you code (or ODBC driver).
|
|
|
|
|
Hello Friends,
I am using c language.
I have a thread 'A', it does some downloading thing, and may take several minutes to complete.
So, I need another thread 'B' which will monitor thread 'A', and will kill it, if 'A' takes more than a fixed period of time, say 1 min or so.
Kindly help me in this by giving some clue or code sample.
Thanks in Advance.
Dolly, IN
|
|
|
|
|
Set a flag (eg bool isThreadToBeKilled = false) in thread B and keep thread A running unless this flag is set to true. If this thread becomes true at any stage (after a specific period in your case) return from thread A function.
Note: Killing or terminating a thread is not a good idea. It's always better to check some value and return from thread function in order to terminate it so that all resources are freed.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Thanks for the reply!
So, do we need to implement a timer to set that flat to be true??
dolly,
N,IN
|
|
|
|
|
Yes you may set a timer to do that job.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thanks will bother u more if I would need some help.
dolly,
N,IN
|
|
|
|
|
You're welcome.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Any sample application for this threading?.
|
|
|
|
|
You are her alter ego, aren't you?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Sir i realy need some sample appln.
|
|
|
|
|
AFAIK, the search functionality is still active on this site. Just type "Threading" in the Search box and you will get lots of links to articles related with Threading.
Another good place to search for is here[^]
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
But remember that the functionality of a timer is not very precise, ie it may or may not fire always after some specified time interval. SO unless you are building something that needs accurate value feel free to use a timer to set the value of the flag to false.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
So, what should we use if timer is not that efficient and reliable.
If I mean that i need to kill my thread after 1 min...1 min means 1 min...
viz. accuracy of time should be there, without fail.
dolly,
N,IN
|
|
|
|
|
You can extend anshuman's solution.
you need not implement timer
Check the following code
ThreadB()
{
DWORD nInterval = 36000;
DWORD nTime = GetTickCount();
flag=false;
while(flag==false)
{
...
..//Code that will do ThreadB monitoring or whatever.
if((GetTickCount()-nTime)>=nInterval)//nInterval can be set to whatever time you need.
flag=true; //This will cause both threads to terminate.
}
I hope it makes sense.
Kindly read about GetTickCount() function before you calculate the your required timeout.
Regards,
Sandip.
|
|
|
|
|
thanks so much sandeep, I am looking into the solution you gave!
Dolly,
N,IN
|
|
|
|
|
Do we have some function to check if a thread is running or not!
Actually i need to check it, before terminating the thread.
Becuase if the thread has already completed its tasks, so no need for another thread to monitor the first thread till a particular fixed period of time!
dolly,
N,IN
|
|
|
|
|
Do we have some function to check if a thread is running or not!
Actually i need to check it, before terminating the thread.
Becuase if the thread has already completed its tasks, so no need for another thread to monitor the first thread till a particular fixed period of time!
Language : c
dolly,
N,IN
|
|
|
|
|
dolly wrote: 1 min...1 min means 1 min...
Well exactly 1 minute is impossible (PC s cannot achieve picosecond precision, for instance), anyway if you set 1 minute timer you maybe confident it will expire before the 61 th second.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
ya...I used GetTickCount()....and it's working upto the precision I need.
Will fire more questions if I would need to!
Thanks you friends for helping me out!
Regards!!
dolly,
N,IN
|
|
|
|
|
New
I traced the code in CMFCPropertyGridProperty, and find what is wrong is like this:
CString s;
s.Format(_T("%f"), 1166.7800f);
MessageBox(s);
It displays 1166.780029 on my machine.
How to solve this problem?
=============================================================================
construct like this
CMFCPropertyGridProperty prop(_T(""), COleVariant(f));
When I add the following data:
f = 2.803f;
f = 14419.788f;
The first one is ok, is display 2.803000.
The second one got a problem, is displays 14419.788086.
How to solve this? Thanks.
modified on Wednesday, June 25, 2008 2:49 AM
|
|
|
|
|
I guess that this is a problem of the data conversion from float to string.
Use a double.
Greetings from Germany
|
|
|
|