473,326 Members | 2,438 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Calling api - bug, pr threading problem


Hi
I have a simple situation, and complicated for me problem.
I have an event that is raised if data receive to RS port.
This event calls few api functions
Here is the code:

case "Alt":
{
if (!isAltPressed)
{
keybd_event(18, 0, 0, UIntPtr.Zero);
isAltPressed = true;
notifyIcon1.ShowBalloonTip(1, "", "Alt is now
active", ToolTipIcon.Info);

System.Threading.Thread.Sleep(500);
break;
}

isAltPressed = false;
keybd_event(18, 0, 0x0002, UIntPtr.Zero);
notifyIcon1.ShowBalloonTip(1, "", "Alt is no more
active", ToolTipIcon.Info);

System.Threading.Thread.Sleep(500);
break;
}
case "Tab":
{
if (isAltPressed)
{
keybd_event(9, MapVirtualKey(9, 0), 0,
UIntPtr.Zero);
keybd_event(9, MapVirtualKey(9, 0), 0x0002,
UIntPtr.Zero);
}
break;
}
This code simulates pressing alt+tab.
And the problem is that in 1/5 of situations, when i try to deactivate ALT
key,alt+tab menu is still visible.
Algorithm is simple. Alt -> n-times TAB -> Alt again. Alt tab menu doesn't
wanish every time i do it this way.

I think that maybe it's threading problem or somthing of this kind.
For any help thanks.
May 21 '06 #1
0 1027

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Matthew Bell | last post by:
Hi, I've got a question about whether there are any issues with directly calling attributes and/or methods of a threaded class instance. I wonder if someone could give me some advice on this. ...
8
by: Steven Bethard | last post by:
I'm playing around with some threading stuff right now, and I'm having a little trouble calling a function from one thread that affects another. Here's my setup: py> import os, threading, time...
0
by: Raghul | last post by:
Hi friends, I am creating a jabber client and a separate class for dialog is created,So when the roster name is clicked this dialog open and can continue chat.What I need is I am calling the same...
3
by: Rob | last post by:
I have a vb form which calls a thread which makes webrequest calls into the internet, processes the info, and passes the info to another routine in another sub. It is stopping when it tries to make...
15
by: Bryan | last post by:
I have a multi-threaded C# console application that uses WMI (System.Management namespace) to make RPC calls to several servers (600+ ) and returns ScheduledJobs. The section of my code that...
5
by: Homa | last post by:
Hi all, Can anyone give me some links about how to do an async web service call from aspx and display a temperary page before the web service returns? Thanks, Homa Wong
4
by: barker7 | last post by:
In our app, we need to collect data at regular intervals (4, 8 or 16 seconds - user settable). The collection happens in a background thread. My first approach was to do the collection, which takes...
11
by: briankirkpatrick | last post by:
Forgive me if my post seems a little amateurish... I'm requesting assistance from some of you smart folks out there to get the managed calls write that meet the specification in the esa.h for...
0
by: pinky22 | last post by:
I am calling SSIS package from a .Net windows UI. Both SSIS & .Net app are created in 2008. The SSIS package is stored in file system. When I ran .Net app I got error- The package failed to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.