|
-
Nov 22nd, 2000, 12:31 PM
#1
Thread Starter
Lively Member
i would like to get the handle from Oracle's SQL*Plus application. I'd like to send data to it for automation purposes.
Is there a way to get a handle by cycling through the open applications til i find one with a form caption of 'Oracle SQL*Plus'?
thanks
-
Nov 22nd, 2000, 12:57 PM
#2
Fanatic Member
-
Nov 22nd, 2000, 01:28 PM
#3
Example
Code:
Private Declare Function FindWindow Lib "user32" _
Alias "FindWindowA" (ByVal lpClassName As String, ByVal _
lpWindowName As String) As Long
Private Sub Command1_Click()
hWin = FindWindow(Class, Caption)
If hWin <> 0 Then
MsgBox "Window found: " & hWin
Else
MsgBox "Window not found: " & hWin
'hWin = 0
End If
End Sub
-
Nov 22nd, 2000, 03:14 PM
#4
Thread Starter
Lively Member
tried that!
i'm using the following.. taken mostly from the WinNT Win32 API bible...
for example.. start up the windows clock (clock.exe).. try to return the handle of the window by searching for a window with 'Clock' as the title (as per the book example)
Private Declare Function FindWindow Lib "user32" _
Alias "FindWindowA" (ByVal lpClassName As String, ByVal _
lpWindowName As String) As Long
Private Sub Command1_Click()
Dim i As Long
i = FindWindow(vbNull, "Clock")
'show me the @#$% handle!
MsgBox Str(i)
'always returns 0 =(
End Sub
-
Nov 22nd, 2000, 03:27 PM
#5
First off, use FindWindowEx instead of FindWindow (it's an updated version).
Secondly, Use vbNullString instead of vbNull.
Thirdly, I think you are referring to "date/time properties" instead of clock.
Add the following to a Form with a CommandButton.
Code:
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Sub Command1_Click()
Dim hApp As Long
hApp = FindWindowEx(0, 0, vbNullString, "Date/Time Properties")
If hApp <> 0 Then MsgBox "Clock is open"
End Sub
-
Nov 22nd, 2000, 04:09 PM
#6
Thread Starter
Lively Member
thanks everyone!
findwindowex is working great now.
megatron: i actually *was* using clock.exe (not date/time properties) its that crusty old clock thats been carried over from the win3.x days. I know its included with nt4.. not sure about win98 and after.. anyway.. no matter.. thanks for your help
have a good turkey day
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
|