473,395 Members | 2,713 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,395 software developers and data experts.

send a message to IE


Hi all,
i am writing an App that reads from a barcode scanner. (no output
statments,i.e no active window)
i want to find a way to send the barcode to an open window (such as
Internet Explorer) so that when the user scans the barcode, the result
is displayed in any text box the user clicked. (the user has to click
on that text box --set focus-- before he triggers the barcode scanner)
i was looking into PostMessage(HWND_BROADCAST,WM_KEYDOWN,barocde,0).
but wasn't working.
i also tried PostMessage(GetForegroundWindow(),WM_KEYDOWN,baroc de,0).
but wasn't working either.
my APP is a console app, no output statements (so a windows is not
created)

Any idea?
the window name is non constant so i cannot use
FindWindow( LPCTSTR lpClassName, LPCTSTR lpWindowName );
i looked into using EnumWindows() to get a handle to all active windows,
but how can i implement that ? (especially the call back function)?

Your help is greatly appreciated

Thanks
Mo
ma******@hotmail.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #1
2 2160
"mo A" <ma******@hotmail.com> wrote in message news:eJ**************@TK2MSFTNGP12.phx.gbl...
i looked into using EnumWindows() to get a handle to all active windows,
but how can i implement that ? (especially the call back function)?


EnumWindows can be accessed through P/Invoke using a signature
like this,

[DllImport( "USER32.DLL")]
public static extern int EnumChildWindows(
IntPtr hwndParent,
[MarshalAs( UnmanagedType.FunctionPtr)]
EnumFunc lpfnEnumFunc,
int lParam
);

The "callback" function is just a .NET delegate marshaled as a function
pointer in the above signature. Define it like this,

public delegate int EnumFunc( IntPtr hwnd, int lParam);

Elsewhere within your application, you define a method that gets called
back (in this trivial example, I'll just emit the HWND of the windows, al-
though in more sophisticated implementations you may have other Win32
P/Invoke methods like GetWindowText and can pass the HWND to them
to display more relevant information as required),

private int EnumChildren( IntPtr hwnd, int lParam)
{
Console.WriteLine( "HWND {0:X8}", (int)hwnd);
}

With these three pieces of code in place, the final line of code, the
actual calling to EnumWindows( ), becomes elementary,

MyClassName.EnumChildWindows(
IntPtr.Zero,
new EnumFunc( this.EnumChildren),
0
);
Derek Harmon
Nov 16 '05 #2
hi derek,
thanks for your reply, but my app is in c++ (not .net) so i need to know
how to use callback functions?

another question, how do i get a handle for an internet explorer window
so i can use postmessage/sendmessage to send data (in my case, scanned
barcode from my headless c++ app)to that window (a textbox in that
window)?

i tried FindWindow(LPCTSTR("IEfraame"),NULL): where IEframe is the name
of the Internet explorer class.t didnt work?

Thanks
Mo
ma******@hotmail.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #3

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

Similar topics

11
by: Google Mike | last post by:
I've got RH9 Linux with default PHP. Is there a way to send email on Linux to an Exchange Server from PHP and/or other tools when there is *NOT* SMTP access? Has anyone figured out a way to...
9
by: Etienne Charland | last post by:
Hi, there is an application running on a remote desktop (under Citrix ICA, but the same problem applies for RDC or PC Anywhere). Now, I want to send keys to the remote application from a local app....
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...
0
by: David Burson | last post by:
Hi, I have a VB.NET windows app that needs to automatically send a simple text email when my users run a new version of the app for the first time. I thought this would be simple, but after...
4
by: zhimin | last post by:
Hi, I'm writing a program to send large file(100m) through dotnet using TCPListener & TCPClient, I'm sending the file with a ask and response loop: 1. Client send a flag 1 to server indicate it...
13
by: Manfred Braun | last post by:
Hi All, I am trying to understand the blocking method socket.Send(). The call blocks as expected, but does this mean, it returnes after the underlying TCP layer got a confirmation, that the send...
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...
3
by: Gerard | last post by:
Hello I have created a windows service to monitor a database, it starts some checks when a timer elapses. The checks send emails depending on their findings. My issue is that when I created a...
14
by: supz | last post by:
Hi, I use the standard code given below to send an email from an ASP.NET web form. The code executes fine but no Email is sent. All emails get queued in the Inetpub mail queue. I'm using my...
3
by: ultr | last post by:
Hello, I have read that send() may not send whole message and returns the nuber of bytes sent, so that we can handle the rest of the message. Is it true, because i have tested sending even 1MB...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
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,...

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.