Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Detecting and Closing an Activex Application from MS Access

Posted on 1998-10-15
4
Medium Priority
?
166 Views
Last Modified: 2010-04-30
I have created an ActiveX EXE that pops up a form which maintains a status...I can sucessfully invoke the application, as well as manipulate the data in the ActiveX application from MS Access.  What I would like to be able to do is detect whether or not the ActiveX application is running, and if it is, send a command from MS Access to the ActiveX application to close down.  
0
Comment
Question by:dhoule
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 13

Accepted Solution

by:
Mirkwood earned 150 total points
ID: 1440036
How I would do it is search for the window using FindWindowEx. If the window is found I would close it using SendMessage.

hWndApp = FindWindow("ThunderForm", <title>")
if (hwndapp <> 0) then
   SendMessage (hwndApp, WM_CLOSE, 0, byval 0)
--

Public Const WM_CLOSE = &H10

Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

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


0
 

Author Comment

by:dhoule
ID: 1440037
That worked great, thanks.  How would I go about controlling MINIMIZE and RESTORE?  The same way? &H?


0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1440038
Yep, same way. Send WM_SIZE messages, the wParam must be a value between 0 and 16 I think.
0
 

Author Comment

by:dhoule
ID: 1440039
Thank you for your help.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question