473,378 Members | 1,527 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,378 software developers and data experts.

can't send WM_KEYDOWN correctly?

9
Hi,everyone!

I'm tring to write a program to send key press message to other program(such as notepad).I mean if I press "M" in my program,this "M" will append to the notepad text entry.

here is my code:
hwnd = FindWindow(NULL,"Untitled - Notepad");
if(hwnd!=0){
char buffer[100] = "";
GetWindowText(hwnd,buffer,50);
MoveWindow(hwnd,0,0,500,500,TRUE);
SendMessage(hwnd,WM_KEYDOWN,VK_NUMPAD0,0);
SendMessage(hwnd,WM_KEYUP,VK_NUMPAD0,0);
printf("%d\n%s\n",hwnd,buffer);

}else{
printf("%d\n",hwnd);
printf("failure\n");
}


After running this program,the MoveWidnow() function worked,but there isn't any character in notepad text entry...
What should I do to solve this problem?
Any suggestion is appreciated!
Apr 9 '10 #1
0 1547

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Pete Loveall | last post by:
I have a server application that monitors a private local queue for messages. The message sent to it has a label and a response queue defined. It works correctly when the queue is accessed via...
6
by: DigitalRick | last post by:
I have been running CDONTS in my ASPpages to send emails to me sent from my guestbook. It had been working fine untill I upgraded to Server 2003 (I am also running Exchange 2003) all locally. I...
2
by: Just Me | last post by:
I have two situations: 1) a form with a picturebox on it This picturebox does NOT gets WM_KEYDOWN messages if the key is an arrow key. Works OK if Num Lock is on so those keys are numerals. ...
0
by: Michael Grabelkovsky | last post by:
I call ActiveX from my C# program. ActiveX is 3D navigator that is successfully works from Browser. The problem: if I call ActiveX from C#, I can't transmit keyboard management to it ( WM_KEYDOWN...
0
by: DotNetBBK | last post by:
Hi, I am using a custom text box, where I need to override TabSelection, as I have to generate an event and based on that event, I need to do some processing in other class, who is listening to...
1
by: michi | last post by:
Hi there.... Got here a tricky thing with my SMTP. First I show you what works on my machine.. **This Works** SmtpMail.SmtpServer = "mail.gmx.net" <-gmx is my mail provider...
2
by: Christian Blackburn | last post by:
Hi Gang, I would like to send the Alt+A keystroke to a Window. What's the best way to go about that? This didn't seem to work. What message should I work with WM_KEYDOWN and WM_KEYUP are...
2
by: Just Me | last post by:
I do not get WM_KEYDOWN messages for arrow keys presses in my overridden WndProc for a picturebox control. Something must be eating them - anyone familiar with what's going on? Thanks
0
by: Chris Auer | last post by:
I have: Set up Database Mail Set up and Operator (me) Set up a job to send a message to that operator. When I run the TSQL EXECUTE msdb.dbo.sp_notify_operator @name=N'Chris...
0
by: MegaOctet | last post by:
Hello, I'm trying to send some text in wordpad and here is my script: import win32gui import win32api import win32con import time Notepad= win32gui.FindWindow(None,"Sans titre - Bloc-notes")...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.