Visualizzazione dei risultati da 1 a 4 su 4

Discussione: avvio OnTop

  1. #1

    avvio OnTop

    ciao ho creato un programmino che appena si avvia avvia un altro programma e poi si chiude potrebbe sembrare poco utili ma a me serve, cmq mi serve che il programma che viene avviato dal mio programmino venga avviato OnTop, come posso fare??

    grazie


    ---------------------------------------------------------------------
    pea.3000.it

  2. #2
    Utente bannato
    Registrato dal
    Mar 2002
    Messaggi
    1,811
    l'api setposition ti permette di farlo avere sempre in primo piano
    se ti interessa ti posso posare del codice

  3. #3
    te ne sarei grato no sono molto pratico di API

  4. #4
    Utente bannato
    Registrato dal
    Mar 2002
    Messaggi
    1,811
    nel modulo:

    Public Const SWP_NOACTIVATE As Short = &H10S
    Public Const SWP_SHOWWINDOW As Short = &H40S
    Public Const HWND_TOPMOST As Short = -1
    Public Const HWND_NOTOPMOST As Short = -2
    Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Integer, ByVal hWndInsertAfter As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal cx As Integer, ByVal cy As Integer, ByVal wFlags As Integer) As Integer

    Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer


    Public Sub AlwaysOnTop(ByRef X As System.Windows.Forms.Form, ByRef Y As Boolean)
    Select Case Y
    Case Is = True
    SetWindowPos(X.Handle.ToInt32, HWND_TOPMOST, 100, 100, 100, 100, SWP_NOACTIVATE Or SWP_SHOWWINDOW)
    Case Is = False
    SetWindowPos(X.Handle.ToInt32, HWND_NOTOPMOST, 100, 100, 100, 100, SWP_NOACTIVATE Or SWP_SHOWWINDOW)
    End Select
    End Sub

    poi nel form scrivi

    Dim Success As Short
    ' Success = SetWindowPos(Me.Handle.ToInt32, HWND_TOPMOST, 100, 100, 100, 100, 1)
    'AlwaysOnTop(Me, True)


    ' Me.Height = 312
    ' Me.Width = 464

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.