Tech Support > Computer Hardware > Desktops > unloading DesktopX and WindowBlinds at the same time
unloading DesktopX and WindowBlinds at the same time
Posted by SnowMan on August 12th, 2004


Hi,

I would like to have the following functionality:

if the user clicks on an object windows blinds AND DesktopX is unloaded
automatically.

I have the following approach: I wrote a VB program which figures out
the Process handles for Windowblinds and DesktopX. Then I have send all
those processes the WM_CLOSE event. This works fine with Windowblinds.
However DesktopX closes but does not restores the desktop. If it is
started again, it complains that is has not been closed correctly.

DesktopX has 3 threads (on my machine). Does anyone know which thread I
have to send which message in order to unload DesktopX gracefully.

Any other help is also appreciated

Thanks
Snowman

Posted by SnowMan on August 12th, 2004


I found the required message : 0x040D has to be send to "MainDX" thread.

Below I have the VB source code for anyone who wants to do something
simular.




Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpszClassName As String, ByVal lpszWindow As String) As Long

Private Declare Function PostMessageByLong& Lib "user32" Alias
"PostMessageA" (ByVal hwnd&, _
ByVal wMsg&,
ByVal wParam&, ByVal lParam&)
Private Const WM_CLOSE& = &H10
Private Const WM_USER_CLOSE = &H40D

Private Sub Command1_Click()
Dim hnd As Long
hnd = FindWindow(vbNullString, "WindowBlinds")
If hnd <> 0 Then
Call PostMessageByLong(hnd, WM_CLOSE, 0, 0)
End If
hnd = FindWindow(vbNullString, "DXMain")
If hnd <> 0 Then
Call PostMessageByLong(hnd, WM_USER_CLOSE, 0, 0)
End If

Unload Me
End Sub


SnowMan wrote:


Similar Posts