|
-
Jan 24th, 2001, 05:54 AM
#1
Thread Starter
Fanatic Member
how can i close access window?
If a post has helped you then Please Rate it!
-
Jan 24th, 2001, 10:47 AM
#2
Addicted Member
Building A Better Body Albeit Left Out Under Intense Extrapolation
-
Jan 24th, 2001, 01:29 PM
#3
PowerPoster
VBKNIGHT:
Here how we close an external application.
Code:
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As Long, ByVal lpWindowName As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_SYSCOMMAND = &H112
Private Const SC_CLOSE = &HF060&
Private xhWnd As Long
Private Sub CloseExtApplication()
xhWnd = FindWindow(0&, "Access Windows name")
If xhWnd <> 0 Then SendMessage xhWnd, WM_SYSCOMMAND, SC_CLOSE, 0&
End Sub
-
Jan 24th, 2001, 03:29 PM
#4
You also need to Destroythe window.
Code:
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
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 Declare Function DestroyWindow Lib "user32" (ByVal hwnd As Long) As Long
Private Const WM_CLOSE = &H10
Private Sub Command1_Click()
Dim hWnd_App As Long
hWnd_App = FindWindowEx(0, 0, "WindowClass", "WindowName")
SendMessage hWnd_App, WM_CLOSE, 0, 0
DestroyWindow hWnd_App
End Sub
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
|