View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
AA2e72E AA2e72E is offline
external usenet poster
 
Posts: 400
Default How to close an open image...

Is is possible, if somewhat messy to achieve.

Determine the application that opens the picture; it could be Paint or
another application with which the extension TIF is associated.

Use the FindWindow API call to get the handle of the Window for that
application. If you do not know the class name, use the caption (the latter
is less reliable as it is difficult to get right ... it has to match exactly).

Use the PostMessage API to send a WM_CLOSE message to the Window handle.

The APIs a

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

Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd
As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As
Long