devxlogo

Programmatically Close Another Program

Programmatically Close Another Program

To have a program programmatically close another program, use this code:

 ' Close an existing program	Title = "VBApp"	ihWnd = FindWindow(0&, Title)	ihTask = GetWindowTask(ihWnd)	iRet = PostAppMessage(ihTask, WM_QUIT, 0, 0&)	MsgBox "Check it out! The VB App should be history"

devx-admin

Share the Post: