473,772 Members | 2,965 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Passing messages to windows to get them to do something.

36 New Member
I am trying to pass a message to a userform in VBA. I will include the code of what I have so far below. The problem I am having is that I don't know what I need to send in order to get the text I want to appear in the textfield that I want it to appear in.

Here is the code...

Expand|Select|Wrap|Line Numbers
  1. Private Const WM_SETTEXT As Long = &HC
  2. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
  3.         (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
  4. Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
  5.         (ByVal parentHwnd As Long, _
  6.         ByVal nextChildHwnd As Long, _
  7.         ByVal lpClassName As String, _
  8.         ByVal lpWindowName As String _
  9.         ) As Long
  10.  
  11. Private Sub UserForm_Activate()
  12.   Dim windowHandle As Long
  13.   Dim lpClassName As String
  14.   Dim lpWindowName As String
  15.   Dim childHandle As Long
  16.  
  17.   Dim lParam As String
  18.  
  19.   lpClassName = "ThunderDFrame"
  20.   lpWindowName = Me.Name
  21.   windowHandle = FindWindow(lpClassName, lpWindowName)
  22.   childHandle = FindWindowEx(windowHandle, 0, "F3 Server 60000000", "")
  23.   MsgBox childHandle
  24.  
  25.   lParam = "FuzzButt"
  26.   SendMessage childHandle, WM_SETTEXT, 0&, lParam
  27.  
  28. End Sub
  29.  
So, I get the 'Frame' for the form I want to modify (windowHandle) and then I used that to get the handle to the part of the window inside the frame, but not including the frame (childHandle). I want to set a textField on that form to some text value. What I have above just messes up the 'Caption' of the window. If I send the same text to the parent window then it corrupts the titlebar of the window. It doesn't set it to the text in lParam.

So... What am I doing wrong?
Aug 30 '07 #1
0 1100

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

Similar topics

7
2868
by: Harolds | last post by:
The code below worked in VS 2003 & dotnet framework 1.1 but now in VS 2005 the pmID is evaluated to "" instead of what the value is set to: .... xmlItems.Document = pmXML // Add the pmID parameter to the XSLT stylesheet XsltArgumentList xsltArgList = new XsltArgumentList(); xsltArgList.AddParam("pmID", "", pmID); xmlItems.TransformArgumentList = xsltArgList;
2
1876
by: Gvs | last post by:
Hi, I'm currently trying to pass messages into a queue. This all works fine, however, i'm trying to my program to stop sending messages to the queue when it reaches an upper threshold. At present this threshold is the number of chairs in a waiting room. This is an int represented by nChairs. So i want to compare this to the number of messages in my queue. I'm using the following lines of code to do this, however the queue is always...
3
8004
by: Curious | last post by:
Hi, I need some technique to communicate by passing messages with different threads. For my problem shared memory is not applicable. Can someone give me some help of what there is available in the .net. Thanks in Advance
5
4855
by: zorhel | last post by:
Hi. My clients will be IE, Mozilla and Opera in a Windows and *nix OS. So, my web app need to, from a server, send messages to a specific client (browser), send messages for all clients, redirect a client to another page. In other way, a client will be able to send messages to another client, throw the server. These are the first funcionalities.
19
2533
by: Jaime Stuardo | last post by:
Hi all.. I have created a business logic component that is used from my ASP.NET webform. It works, but connection string to the database is hard coded, as in this method : public DataSet GetCategories() { SqlConnection conn = new SqlConnection("Data Source=DEVSERVER;Initial Catalog=XXXX;User ID=X;Password=Y");
6
1316
by: Nak | last post by:
Hi there, I was wondering if it was possible to pass objects in windows messages, obviously via pointers I would presume, but I can't quite work out how to turn an object into a pointer in VB.NET, if it is even possible of course?!? Anyway, if anyone knows a way of doing this I would be most appreciative of some advice, thanks yet again in advance! Nick.
3
6774
by: Rune Jacobsen | last post by:
Hi all, I am working on my single instance application that now also has a URL type associated with it, according to the Asynchronous Pluggable Protocols information from MSDN. Now, if my application is not already started, everything works fine. The APP setup starts my program with the URL as the command line argument, and it displays the proper information to the user. This works great and was a pleasure to program. However, my...
2
5061
by: Hakan Örnek | last post by:
Hi , I want to parameter passing to my windows sevice. I call service commands like this ; '------------------------------------------------------------ Dim sc As ServiceController sc = New ServiceController("ProsetLogServices") sc.MachineName = "." If sc.Status = ServiceControllerStatus.Stopped Then sc.Start() End If
11
1997
by: MikeY | last post by:
Perhaps someone can point me in the right direction in finding code, or finding reading information on how to pass information (ie. ArrayList, string, etc) between two running window applications, that won't neccessarily be on the same machine. This will be my first attempt at this, and I'm not sure if this falls under COM, or ActiveX. Any and all help is appreciated.
0
878
by: AAaron123 | last post by:
On a Form I have a RichTextBox. I do the call for EM_SETEVENTMASK with ENM_REQUESTRESIZE The user control's WndProc writes to the consol to keep track of any EN_REQUESTRESIZE messages. As I type into the RichTextBox I see the results of the console writes in the Output window.
0
9620
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, 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...
0
10261
Oralloy
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...
0
10104
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9912
tracyyun
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...
0
8934
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, 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...
0
5354
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...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2850
bsmnconsultancy
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...

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.