| |

Allgemeine DiskussionenProblem beim minimieren | |  | Autor: BigDeal | Datum: 11.12.03 10:04 |
| Hi Leute!
Ich hab da ein kleines Programm das eine Form anzeigt wenn ein bestimmtes Programm gestartet wird. Mein Problem ist jetzt wenn ich das Programm minimiere bleibt meine Form auf dem Desktop stehen. Ich hätte aber gerne das die Form dann
Visible=False ist und wenn ich das Programm dann wieder maximiere die Form dann wieder Visible=True ist.
Ich hab mir schon die Zähne ausgebissen.
Hier ist mein Source.
option explicit
Private Declare Function GetCursorPos Lib "user32" (lpPoint As _
POINTAPI) As Long
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint _
As Long, ByVal yPoint 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 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 SetWindowPos Lib "user32" (ByVal hwnd As _
Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As _
Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Const SWP_NOMOVE = &H2
Const SWP_NOSIZE = &H1
Const HWND_TOPMOST = -1
Const HWND_NOTOPMOST = -2
Private Const EM_SETPASSWORDCHAR = &HCC
Private Type POINTAPI
X As Long
Y As Long
End Type
Dim bRunning As Boolean 'Zeigt an, ob das Programm läuft
Private Sub Form_Load()
'Formular anzeigen
'Me.Show
'Form1.Left = 13950
Form1.Left = 13750
Form1.Top = 500
Form1.Width = 2280
Form1.Height = 525
'Aktuelle hWnd ermitteln etc.
Call getWindowUM
End Sub
Public Sub getWindowUM()
Dim P As POINTAPI
Dim lo As Long
Dim str As String
'Formular immer oben halten
SetWindowPos hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE
'Form1.Visible = false
'Bis das Programm beendet wird weitermachen...
bRunning = True
Do Until bRunning = False
'Cursorposition auslesen
GetCursorPos P
'Das entsprechende Fenster finden
'lo = WindowFromPoint(P.X, P.Y)
lo = WindowFromPoint(0, 0)
DoEvents
'Label4.Caption = P.X
'Label5.Caption = P.Y
'Den Titel auslesen
str = String(GetWindowTextLength(lo), Chr$(0))
GetWindowText lo, str, 100
If InStr(str, "MCS") Then
If InStr(str, "[Kartei") Then
Form1.Visible = True
Label1.Caption = Mid(str, InStr(str, "(") + 1, InStr(str, ")") - InStr(str, "(") - 1)
Label2.Caption = Mid(str, InStr(str, "[") + 1, InStr(str, ")") - InStr(str, "[") - 3)
Else
Label1.Caption = ""
Label2.Caption = ""
Form1.Visible = False
End If
Else
'Call Form_QueryUnload(0, 0)
End If
'Ergebnisse anzeigen
'Label1.Caption = str
'Label2.Caption = lo
'Den Passwortcharacter entfernen
SendMessage lo, EM_SETPASSWORDCHAR, 0, ""
DoEvents
Loop
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
'Programm beenden
bRunning = False
End Sub
'Private Sub Timer1_Timer()
' Call getWindowUM
'End Sub |  |
 | Sie sind nicht angemeldet! Um auf diesen Beitrag zu antworten oder neue Beiträge schreiben zu können, müssen Sie sich zunächst anmelden.
Einloggen | Neu registrieren |
  |
|
vb@rchiv CD Vol.6 vb@rchiv Vol.6
Geballtes Wissen aus mehr als 8 Jahren vb@rchiv!
Online-Update-Funktion Entwickler-Vollversionen u.v.m.Jetzt zugreifen Tipp des Monats Oktober 2025 Matthias KozlowskiUmlaute konvertierenErsetzt die Umlaute in einer Zeichenkette durch die entsprechenden Doppelbuchstaben (aus ä wird ae, usw.) TOP! Unser Nr. 1 
Neu! sevDataGrid 3.0
Mehrspaltige Listen, mit oder ohne DB-Anbindung. Autom. Sortierung, Editieren von Spalteninhalten oder das interaktive Hinzufügen von Datenzeilen sind ebenso möglich wie das Erstellen eines Web-Reports. Weitere Infos
|