I am trying to create a on screen key board.
I simply want to send a key (Simulate the keyboard) to a combo box using the Handle of the control.
The below code is not working
public const ushort WM_KEYDOWN = 0x0100;
public const ushort WM_KEYUP = 0x0101;
//Set the active window
[DllImport("user 32.dll")]
public static extern IntPtr SetActiveWindow (IntPtr hWnd);
//sends a windows message to the specified window
[DllImport("user 32.dll")]
public static extern int SendMessage(Int Ptr hWnd, int Msg, uint wParam, int lParam);
public void SendKey(ushort key, IntPtr hWnd)
{
SetActiveWindow (hWnd);
// Control c = this.ActiveCont rol;
// MessageBox.Show (c.Name.ToStrin g());
SendMessage(hWn d, WM_KEYDOWN, key, 0);
// c = this.ActiveCont rol;
// MessageBox.Show (c.Name.ToStrin g());
// SendMessage(hWn d, 0, key, 0);
SendMessage(hWn d.Handle, WM_KEYUP, key, 0);
}
#endregion
private void button3_Click(o bject sender, EventArgs e)
{
SendKey((int)Ke ys.A, comboBox1.Handl e);
}
I have tested SendKeys, Key_evnt and sendinput, they don't satisfy what is needed.
Thanks, 1 3147
SendMessage(hWn d, WM_KEYDOWN, key, 0);
SendMessage(hWn d.Handle, WM_KEYUP, key, 0);
You'll have to create the corresponding lParam and wParam.
Only "key-code" will not do. http://msdn.microsoft.com/en-us/libr...80(VS.85).aspx
Try this out:
SendMessage(hWn d, WM_KEYDOWN, key, 0x220001)
SendMessage(hWn d, WM_KEYUP, key, 0xC0220001)
Derived from: http://bytes.com/forum/thread124681.html
--
Happy Hacking,
Gaurav Vaish | http://dwt.sourceforge.net http://blogs.mastergaurav.com | http://eduzine.edujini-labs.com
-------------------------------- This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: vgrssrtrs |
last post by:
<html>
<head>
<script language="JavaScript">
<!--
/*
*** Multiple dynamic combo boxes
*** by Mirko Elviro, 9 Mar 2005
***
***Please do not remove this comment
|
by: baileystuff |
last post by:
I have an issue where I have three Cases that SHOULD act the same but
don't. If you look at the code below you will see that the general
premise is to open a MSWord template and then use SendKey commands to
get it to save the file using a new name (NewFName is assigned earlier
in the code).
A couple of issues to keep in mind. These are MailMerge templates that
are attached to a Text Deliminted File (a separate one for each Case,
i.e....
|
by: hmiller |
last post by:
Hey everyone,
I am having a hell of a time trying to set this menu system up. Here's
what I'm trying to do.
Combo Box One; is populated by names under properties "row source"
"Phase 1" through "Phase 10" (there are 10 Phases I want to sort from)
Once the phase has been selected a second combo box would populate.
|
by: kiranmn75 |
last post by:
I want to dynamically populate a combo box through javascript. Data is
coming from a array. Sometimes data list may contain items in excess of
2000.
Explorer takes more than 5 seconds to populate the combo (for a list of
2500).
Can anybody optimize the code. I tried Duffs devise instead of 'for
loop', but no improvement.
|
by: angelsoft |
last post by:
How to send Microsoft Natural Keyboard keys with sendkey method
ej. Windows Logo: Start menú, Windows Logo+R: Run dialog box
| |
by: Gunawan |
last post by:
Can someone help me how to write console application to sendkey
c:>sendkey {ALT}+{TAB}
simulate key ALT+TAB
TIA
Gun
|
by: JV |
last post by:
I am running a large Access 2000 application (installed using Access Runtime) that uses many VB SendKeys, primarily to expand combo boxes On Enter.
When trying to run it on Vista I get a "Permission denied" (error 70) error whenever entering a combo box. I have already changed the shortcut that starts access and opens the database to "Run as Administrator". I also changes msaccess.exe itself to "Run as Administrator".
I also tried using...
|
by: Dave |
last post by:
I want to put the information that the user selects in my combo boxes
into a subform that lies on the same form as the combo boxes.
Thanks for your help already,
Dave
|
by: DAHMB |
last post by:
I have a form that calls up a report in the form I have several date fields that have date input masks. I have created a cancel button as:
Private Sub btnCancel_Click()
On Error GoTo Err_btnCancel_Click
Dim stDocName As String
DoCmd.Close
Exit_btnCancel_Click:
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |