VB-Homepage Tipp 108 |
Ausblenden aller Desktopsymbole |
In einem kürzlich vorgestelltem Tipp, ging es um das
Ausblenden der Task-(Start)leiste. Machen wir also den Desktop frei von jeglichem Userunrat :-) und blenden nun als zweiten Schritt auch noch alle Desktopsymbole aus. Hideicon.vbp Form=hideicon.frm ProjWinSize=112,487,248,215 ProjWinShow=2 IconForm="Form1" ExeName32="hideicon.exe" Name="Projekt1" HelpContextID="0" StartMode=0 VersionCompatible32="0" MajorVer=1 MinorVer=0 RevisionVer=0 AutoIncrementVer=0 ServerSupportFiles=0 Hideicon.frm VERSION 4.00 Begin VB.Form Form1 Caption = "VB-Homepage Tipp" ClientHeight = 1485 ClientLeft = 1245 ClientTop = 1800 ClientWidth = 3990 ClipControls = 0 'False Height = 1890 Left = 1185 LinkTopic = "Form1" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 1485 ScaleWidth = 3990 Top = 1455 Width = 4110 Begin VB.CommandButton Command1 Caption = "Ausblenden / Einblenden" Height = 375 Left = 240 TabIndex = 0 Top = 240 Width = 2655 End Begin VB.Label Label2 Caption = "Gefunden auf http://www.basicworld.com/~füssl" Height = 255 Left = 240 TabIndex = 2 Top = 1200 Width = 3615 End Begin VB.Label Label1 Caption = ".... aller Desktopsymbole" Height = 255 Left = 240 TabIndex = 1 Top = 720 Width = 2775 End End Attribute VB_Name = "Form1" Attribute VB_Creatable = False Attribute VB_Exposed = False Private Declare Function IsWindowVisible Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long Sub InvertVisibility(F As Form, tsk$) Dim strlen%, prg$, win%, pgmhwnd% win = GetWindow(F.hwnd, 0) taskalt = 0 Do While win <> 0 strlen = GetWindowTextLength(win) prg$ = Space$(strlen + 1) strlen = GetWindowText(win, prg$, strlen + 1) If strlen > 0 Then task = GetWindowThreadProcessId(win, 0) If taskalt = 0 Then taskalt = task pgm$ = Left$(prg$, strlen): pgmhwnd% = win ElseIf taskalt <> task Then taskalt = task If pgm$ Like tsk$ Then GoSub treffer End If pgm$ = Left$(prg$, strlen): pgmhwnd% = win End If win = GetWindow(win, 2) Loop If taskalt Then If pgm$ Like tsk$ Then GoSub treffer Exit Sub treffer: If IsWindowVisible(pgmhwnd%) Then i% = ShowWindow(pgmhwnd%, 0) Else i% = ShowWindow(pgmhwnd%, 5) End If Return End Sub Private Sub Command1_Click() InvertVisibility Me, ("Program Manager") End Sub Um den Code zu nutzen, erstellen Sie sich mit einem Editor (ZBsp. Notepad) Dateien, die Sie wie beschrieben benennen und den jeweiligen Code hinein kopieren. Rufen Sie dann die *.vbp Datei aus dem Dateimanager auf oder starten Ihr VB-Programm und öffnen das Projekt. Die Anregung zu Tipp und die gesamte Prozedur InvertVisibility entstammt einem tollen Progamm von Thomas Füssl - dieses VB3 Programm inklusive Quellcode gibt es auf seiner Page http://www.cae-software.com/ zum downloaden. |
Tipp-Download |
Quelle : Thomas Füssl |