View Single Post
Old 16-12-2002, 18:43   #4
cionci
Senior Member
 
L'Avatar di cionci
 
Iscritto dal: Apr 2000
Città: Vicino a Montecatini(Pistoia) Moto:Kawasaki Ninja ZX-9R Scudetti: 29
Messaggi: 53971
Quote:
Originally posted by "CIUFFO"

The CloseWindow function minimizes (but does not destroy) the specified window.
Il 90% delle finestre si chiude con questo comando... Guarda l'esempio della DestroyWindow nel MSDN...
In caso venga ricevuto un WM_CLOSE (che è il emssaggio che invia CloseWindow) allora viene richiamato DestroyWindow che termina l'operazione di chiusura...
Comunque si può provare con entrambi...
Quote:
Originally posted by "CIUFFO"

Io vorrei fare da VB quello che faccio con l'icona della connessione in basso a dx del desktop: (stato o disconnetti)
Fare questo è un po' più complicato... Potresti comunque tentare di trovare la finestra della classe "Connections Tray" con FindWindow e provare ad inviargli CloseWindow...
Altrimenti bisogna passare da altri lidi...cioè con le librerie RAS...
Ecco un esempio :
Codice:
Const RAS_MAXENTRYNAME = 256
Const RAS_MAXDEVICETYPE = 16
Const RAS_MAXDEVICENAME = 128
Const RAS_RASCONNSIZE = 412
Private Type RasConn
    dwSize As Long
    hRasConn As Long
    szEntryName(RAS_MAXENTRYNAME) As Byte
    szDeviceType(RAS_MAXDEVICETYPE) As Byte
    szDeviceName(RAS_MAXDEVICENAME) As Byte
End Type
Private Declare Function RasEnumConnections Lib "rasapi32.dll" Alias "RasEnumConnectionsA" (lpRasConn As Any, lpcb As Long, lpcConnections As Long) As Long
Private Declare Function RasHangUp Lib "rasapi32.dll" Alias "RasHangUpA" (ByVal hRasConn As Long) As Long
Private Sub Form_Load()
    'KPD-Team 1998
    'URL: http://www.allapi.net/
    'E-Mail: [email protected]
    'This program will close your Internet-connection, so to test this, you will have to open an Internet-connection.
    Dim i As Long, lpRasConn(255) As RasConn, lpcb As Long
    Dim lpcConnections As Long, hRasConn As Long
    'Set the structure's size
    lpRasConn(0).dwSize = RAS_RASCONNSIZE
    lpcb = RAS_MAXENTRYNAME * lpRasConn(0).dwSize
    lpcConnections = 0
    'Enumerate all the available connections
    returncode = RasEnumConnections(lpRasConn(0), lpcb, lpcConnections)

    If returncode = 0 Then
        For i = 0 To lpcConnections - 1
            hRasConn = lpRasConn(i).hRasConn
            'Hang up
            returncode = RasHangUp(ByVal hRasConn)
        Next i
    End If
End Sub
cionci è offline   Rispondi citando il messaggio o parte di esso