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

Receive SendMessage in VB 6.0

MCC
I need to send messages to a VB 6.0 exe with SendMessage (from a C++ app).
Anybody have sample code for a VB 6.0 message handler to receive SendMessage
or PostMessage commands?

Thanks.
Nov 21 '05 #1
2 6792
<< I need to send messages to a VB 6.0 exe with SendMessage (from a C++
app).
Anybody have sample code for a VB 6.0 message handler to receive SendMessage
or PostMessage commands? >>

The safest trick is to send a seldom-used message for which VB defines a
form-level event handler. That way you can trap the message by just
handling the event. For example, you could send a WM_RBUTTONDOWN, showing
the <Ctrl> and <Alt> keys are pressed. In the form's MouseDown event
handler, look for this combo and execute your code if found.

You can subclass the form in VB6, allowing you to see the windows' messages
before VB does. Just call SetWindowLong with nIndex set to GWL_WNDPROC.
Pass the address of your new window procedure using the AddressOf keyword.

But be warned -- VB 6 programs that subclass forms (or any other window) are
inherently unstable. If they exit, while debugging or released, without
restoring the original Window procedure, Windows may crash afterwards.
Sending messages that trigger supported form events gets around that
problem.

Hope that helps.

Karen Kenworthy
http://www.karenware.com/
Nov 21 '05 #2
"MCC" <MC*@discussions.microsoft.com> schrieb:
I need to send messages to a VB 6.0 exe with SendMessage (from a C++ app).
Anybody have sample code for a VB 6.0 message handler to receive
SendMessage
or PostMessage commands?


<URL:http://www.thescarms.com/vbasic/PassString.asp>

Note that this is a VB.NET newsgroup. VB6-related questions should be
posted to appropriate groups in the "microsoft.public.vb.*" hierarchy.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3

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

Similar topics

5
by: Mark Overstreet | last post by:
I am trying to click a button in another window and I have it's hWnd value so I was trying to use Send message. Here is my code but it doesn't work as expected... response =...
3
by: JSK | last post by:
Hi, As any one worked in VB.NET and made use of Sendmessage API? The Issue I am running into is how to pass pointers of Data Structures (UDT) to the SendMessage. I starting looking at "IntPrt"...
0
by: SamSpade | last post by:
In my C# library I have many SendMessages like the following: public static extern int SendMessage(IntPtr hwnd, int wMsg, int wParam, ref PARAFORMAT2 pf2); I use this one like this:
18
by: Lars Netzel | last post by:
Hello! Thanx to this newgroup I have finally, with the help of you guys, gotten this to work halfway.. but the final action is still not working, clicking the "Button2" thru SendMessage(). ...
4
by: Abubakar | last post by:
Hi, My application has a lot of threads which at some point call SendMessage api passing it the handle of the gui window. The calls r a lot. My question is that should I call the SendMessage api...
22
by: SQACSharp | last post by:
I'm trying to get the control name of an editbox in another window. The following code set the value "MyPassword" in the password EditBox but it fail to return the control name of the EditBox. ...
2
by: Hooyoo | last post by:
Hello, guys. In my application, I need to receive a windows message from another window, and the other window is a MFC application using SendMessage to send a custom windows message. So, in my...
1
by: Necromis | last post by:
Ok, I have gotten my head around things better regarding SendMessage and FindWindow functions. However, I am running into an issue with my code still. The program I am working with is EXTRA! by...
5
by: michelqa | last post by:
Hi, I need to call a lot of different native SendMessage to retreive informations from non managed application. Some win32 messages use struct pointer for lparam....how to create and...
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...
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: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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
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...

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.