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

getting tittle bar text

i want to get the text written in the tittle bar of the
window of any other application which apperars on the back
of the form.

e.g i created a form and minimized that form and then i
opened a ms-word window now i again activated that vb form
i created. now i want the text in the tittle bar of the
word window which appears at the back of my vb form

plase give me the solution

Nov 20 '05 #1
3 1133
Cor
Hi Shalender,

I don't think it is easy from what I understand that you want to do, quess
you open 10 word windows, which one you want in that opened form from you.

I think it is easier (not easy) to take the other approach and start a vb
application and than start a word application with it.

I hope this helps a little bit,

Cor
Nov 20 '05 #2
Hi,

The getwindowtext api will get the text in the title bar. You need
to know the windows handle to use the api call.

Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal
hwnd As Integer, ByVal lpString As String, ByVal cch As Integer) As Integer

Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal
hwnd As IntPtr, ByVal lpString As String, ByVal cch As Integer) As Integer

Here is an example

Dim pWord As Process

Dim strTitleBar As String = Space(200)

Dim iResult As Integer

pWord = Process.Start("winword.exe")

iResult = GetWindowText(pWord.MainWindowHandle, strTitleBar, 200)

If iResult <> 0 Then

Me.Text = strTitleBar

Else

MessageBox.Show("GetWindowText failed!")

End If

Ken
-------------------
"shalender verma" <ve**********@yahoo.com> wrote in message
news:09****************************@phx.gbl...
i want to get the text written in the tittle bar of the
window of any other application which apperars on the back
of the form.

e.g i created a form and minimized that form and then i
opened a ms-word window now i again activated that vb form
i created. now i want the text in the tittle bar of the
word window which appears at the back of my vb form

plase give me the solution

Nov 20 '05 #3
* "Ken Tucker [MVP]" <vb***@bellsouth.net> scripsit:
Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal
hwnd As Integer, ByVal lpString As String, ByVal cch As Integer) As Integer

Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal
hwnd As IntPtr, ByVal lpString As String, ByVal cch As Integer) As Integer

Here is an example

Dim pWord As Process

Dim strTitleBar As String = Space(200)

Dim iResult As Integer

pWord = Process.Start("winword.exe")

iResult = GetWindowText(pWord.MainWindowHandle, strTitleBar, 200)


It the OP wants to get the text whenever the application looses/gets
focus, he/she should override the form's 'WndProc' and listen for
'WM_ACTIVATEAPP'. In 'lParam' the handle to the window previously being
the active window or getting active will be passed to 'WndProc'.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #4

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

Similar topics

11
by: Brett | last post by:
In Yahoo mail, I click the Inbox link and see my messages. If I view source, I don't have HTML which contains the URL of each message. The source HTML contains javascripting and framesets. This...
2
by: shalender verma | last post by:
Hello All I am using VB 6. I am trying to get the text in the tittle bar of the window i click by using GetWindowText API function but its not working. Here is the code i am using:- Private...
3
by: shalender verma | last post by:
I am using VB6. I want to get the text in the tittle bar of any opened window of other app. such as word,excel or any app. appering at the back of my vb form. What i am doing is i created a small...
3
by: dei3cmix | last post by:
Hey, I am having a problem with a program I am working on. Basically, the first part of the program gets input from a file using cin.getline. Then the second part, (still in the same main as the...
4
by: R.Manikandan | last post by:
Hi In my code, one string variable is subjected to contain more amount of characters. If it cross certain limit, the string content in the varabile is automatically getting truncated and i am...
2
by: soma.gunasekaran | last post by:
Hi All , I've stored the Image file..... But i want to retriving the Image files from MSACCSS 2003 (JPEG,bmp,Gif and etc....) So Pls help me........ help me............... Thanking you,...
4
by: bushi | last post by:
hi ! i have following code to display some text on a web form,after getting it from database. <asp:DataList ID="DataList1" runat="server" DataSourceID="SqlDataSource1"> <ItemTemplate>...
1
by: simbarashe | last post by:
Hie could someone please help me with getting and using the current page url. I have a function that gets the url, I want to use it with header(location : XXX) but it wont work. The code is as...
2
by: hgarg | last post by:
The onpaint() is getting called before calculating the required parameters by listBox1_SelectedIndexChanged function. I tried calling it at the end of this function. But of no use. Due to this issue...
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
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
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...
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.