vb@rchiv
VB Classic
VB.NET
ADO.NET
VBA
C#
Schützen Sie Ihre Software vor Software-Piraterie - mit sevLock 1.0 DLL!  
 vb@rchiv Quick-Search: Suche startenErweiterte Suche starten   Impressum  | Datenschutz  | vb@rchiv CD Vol.6  | Shop Copyright ©2000-2024
 
zurück

 Sie sind aktuell nicht angemeldet.Funktionen: Einloggen  |  Neu registrieren  |  Suchen

Suche Visual-Basic Code
Re: Noch eine wichtige Frage! 
Autor: McKinley
Datum: 09.06.05 17:58

Hier der Code, dass die Form immer im Vordergrund bleibt. Du brauchst ne Form und nen Modul.

Form:
Option Explicit
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
Private Const HWND_TOPMOST = -1
Private Const HWND_NOTOPMOST = -2
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
Private XPos&, YPos&
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" ( _
  ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" ( _
ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong _ As Long) As Long
Private Const SWP_FRAMECHANGED = &H20
Private Const SWP_NOACTIVATE = &H10
Private Const SWP_NOZORDER = &H4
Private Const SWP_REFRESH = SWP_NOZORDER Or SWP_NOSIZE Or SWP_NOMOVE Or _
  SWP_NOACTIVATE Or SWP_FRAMECHANGED
Private Const GWL_STYLE = (-16)
 
Private Sub Form_Load()
TopWindow Me.hwnd
End Sub
 
Public Sub FormOnTop(ByVal hwnd As Long, ByVal OnTop As Boolean)
If OnTop Then
SetWindowPos hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
Else
SetWindowPos hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
End If
End Sub
 
Public Sub TopWindow(hwnd As Long)
SetWindowPos hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE + SWP_NOMOVE
End Sub
Und fürs Modul:
Option Explicit
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
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" ( _
ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" ( _
ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong _ As Long) As Long
Private Const SWP_FRAMECHANGED = &H20
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOACTIVATE = &H10
Private Const SWP_NOZORDER = &H4
Private Const SWP_REFRESH = SWP_NOZORDER Or SWP_NOSIZE Or SWP_NOMOVE Or _
  SWP_NOACTIVATE Or SWP_FRAMECHANGED
Private Const GWL_STYLE = (-16)
Private Const HWND_TOPMOST = -1
Hinweis: In der IDE funzt das nich bei Windows Fenstern. Da geht es erst, wenn du die exe-Datei hast. Du kannst trotzdem prüfen, ob es geht, denn wenn es funzt, dürfte die IDE beim starten(F5) nich mehr in den Vordergrund kommen.
Ansonsten einfach mal kurz die exe erstellen und testen.

Um etwas in der Registry zu speichern nehme ich folgendes:
speichern
SaveSetting (App.Title, "optionen", "bla", bla)
auslesen
GetSetting(App.Title, "optionen", "bla", bla)
Die Begriffe in der Klammer kannst du selber wählen. Die quickhelp in vb erklärt alles in der Klammer ganz gut. Einfach die Klammer setzen, dann sagt vb dir schon was es will.
Falls trotzdem noch Fragen sind, einfach fragen.

----------------------------------------------------------------
vb@rchiv =/= To boldly go where no programmer has gone before =/=

alle Nachrichten anzeigenGesamtübersicht  |  Zum Thema  |  Suchen

 ThemaViews  AutorDatum
Noch eine wichtige Frage!924Baumgartner Alex09.06.05 09:24
Re: Noch eine wichtige Frage!564McKinley09.06.05 10:00
Re: Noch eine wichtige Frage!535Baumgartner Alex09.06.05 10:15
Re: Noch eine wichtige Frage!552McKinley09.06.05 17:58
Re: Noch eine wichtige Frage!534Baumgartner Alex09.06.05 18:48

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

Funktionen:  Zum Thema  |  GesamtübersichtSuchen 

nach obenzurück
 
   

Copyright ©2000-2024 vb@rchiv Dieter Otter
Alle Rechte vorbehalten.
Microsoft, Windows und Visual Basic sind entweder eingetragene Marken oder Marken der Microsoft Corporation in den USA und/oder anderen Ländern. Weitere auf dieser Homepage aufgeführten Produkt- und Firmennamen können geschützte Marken ihrer jeweiligen Inhaber sein.

Diese Seiten wurden optimiert für eine Bildschirmauflösung von mind. 1280x1024 Pixel