Results 1 to 4 of 4

Thread: Pkzip

  1. #1
    Guest
    It's always a good idea to use DestroyWindow to free up any resources. Also, since Winoldap is the name, it should be in the second parameter of FindWindow.
    Code:
    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 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 DestroyWindow Lib "user32" (ByVal hwnd As Long) As Long
    Private Const WM_CLOSE = &H10
    
    Private Sub Command1_Click()
    
        Dim hApp As Long
        hApp = FindWindowEx(0&, 0&, vbNullString, "Winoldap")
        If hApp <> 0 Then
            SendMessage hApp, WM_CLOSE, 0, 0
            DestroyWindow hApp
        End If
        
    End Sub

  2. #2
    Hyperactive Member Juan Carlos Rey's Avatar
    Join Date
    Aug 1999
    Location
    Mendoza, Argentina
    Posts
    301

    Wink Thanks!

    Thank you both, I´ll paste the code and try it right now!
    Combat poverty: kill a poor!!

  3. #3
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    An easier way of doing it since you call up a DOS application:
    Code:
    Call Shell(Environ("ComSpec") & " /c pkunzip myfile.zip", vbHide)
    This will open a command prompt run the pkunzip application and close after it's done.

    Good luck!

  4. #4
    Hyperactive Member Juan Carlos Rey's Avatar
    Join Date
    Aug 1999
    Location
    Mendoza, Argentina
    Posts
    301

    Wink Thank you

    It works smoothly. I only notice a small "flash" when DOS window opens, but it´s OK.

    Obrigado!
    Combat poverty: kill a poor!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width