|
-
Jun 30th, 2000, 07:49 AM
#1
Thread Starter
Member
I've created a Word application in my VB app using the Word Object Library. I need to be able to get the handle of this word application, as I want to show a form through my VB app with Word as it's owner,
Ie: frmWordFunctions.Show 1, hWndWordApp
Any ideas ????
Ps. Any info on getting another windows handle full stop would also be appreciated.
Thanx!!!!
-
Jun 30th, 2000, 08:07 AM
#2
Lively Member
if you know the caption of Word (the title bar), you can use this code
Code:
Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As Any, ByVal lpWindowName As Any) As Long
Function GetWindowsHandle(WindowsCaption as string) as long
GetWindowsHandle = FindWindow(CLng(0), WindowsCaption)
End Function
-
Jun 30th, 2000, 08:12 AM
#3
Use the FindWindow API. Here is an example of how to get the handle for Calculator.
Code for a module.
Code:
Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As Any, ByVal lpWindowName As Any) As Long
' lpClassName is the name of the Window Class
' lpWindowName is the title of the window
Code for a CommandButton.
Code:
'If you pass 0 as the parameter, it will find a window
'with any class or any name.
CalcHandle = FindWindow(CLng(0), "Calculator")
-
Jun 30th, 2000, 09:07 AM
#4
transcendental analytic
If you have a variable caption you could find the window by it's classname:
Code:
hwnd = FindWindow(classname, vbnullstring)
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|