a3deluxe Posted April 10, 2014 Report Share Posted April 10, 2014 (edited) Boas, Precisava de uma ajudinha com o seguinte programa. E uma PictureBox que abre maximizada. ela bloqueia-me o Ambiente de trabalho só funciona o menu iniciar. com a tecla ESC fecha a aplicação. Como posso fazer para permitir abrir outros programas? deixo aqui o código que usei: Private 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 Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer Private Const SWP_HIDEWINDOW As Integer = &H80 Private Const SWP_SHOWWINDOW As Integer = &H40 Dim taskBar As Integer Public Sub New() Me.InitializeComponent() TopMost = True Me.pictureBox1.Image = Image.FromFile("C:\picture1.jpg") HideTaskBar() End Sub Public Sub HideTaskBar() SetWindowPos(FindWindow("Shell_traywnd", ""), 0&, 0&, 0&, 0&, 0&, SWP_HIDEWINDOW) End Sub Sub MainFormFormClosing(ByVal sender As Object, ByVal e As FormClosingEventArgs) Handles MyBase.FormClosing If k = Keys.Escape Then e.Cancel = False Else e.Cancel = True End If End Sub Edited April 10, 2014 by a3deluxe Link to comment Share on other sites More sharing options...
a3deluxe Posted April 10, 2014 Author Report Share Posted April 10, 2014 Alguem para dar uma ajudinha? Link to comment Share on other sites More sharing options...
a3deluxe Posted April 16, 2014 Author Report Share Posted April 16, 2014 (edited) Tive uma ideia como posso resolver esta situação da seguinte maneira: O programa principal chama-se (Lockdesktop.exe), arranca em TopMost. A ideia era colocar um Timer a verificar a cada 5segundos por exemplo, se o processo ou janela existem.(Menu.exe) se existirem, então o programa (Menu.exe) fica o Topmost =True e o (Lockdesktop.exe),passa a topmost =False. Depois quando fechar o (Menu.exe) o (Lockdesktop.exe) passa a topmost=True novamente. Estou com alguma dificuldade em desenvolver esta ideia, alguem para dar uma ajudinha? Obrigado Edited April 16, 2014 by a3deluxe Link to comment Share on other sites More sharing options...
killerbest Posted April 16, 2014 Report Share Posted April 16, 2014 (edited) Tente meter isto Private toggle As Boolean = False Private myColor As Color Private picBoxLocation As Point Private Sub Form9_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load myColor = Me.BackColor picBoxLocation = PictureBox1.Location Me.KeyPreview = True End Sub Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown If toggle = True Then PictureBox1.Dock = DockStyle.None Me.FormBorderStyle = Windows.Forms.FormBorderStyle.Sizable Me.WindowState = FormWindowState.Normal PictureBox1.Location = picBoxLocation Me.BackColor = myColor toggle = False Button1.Visible = True Button2.Visible = True Button3.Visible = True TextBox1.Visible = True End If End Sub Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click If toggle = False Then 'Uncomment this line if you want PictureBox1 to FILL the FORM.>> PictureBox1.Dock = DockStyle.Fill Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None Me.WindowState = FormWindowState.Maximized myColor = Me.BackColor Me.BackColor = Color.Black PictureBox1.Location = New Point((Me.Width - PictureBox1.Width) \ 2, (Me.Height - PictureBox1.Height) \ 2) toggle = True Button1.Visible = False Button2.Visible = False Button3.Visible = False Button4.Visible = False Button5.Visible = False Label1.Visible = False Label2.Visible = False Label3.Visible = False Label4.Visible = False Label5.Visible = False TextBox1.Visible = False Else PictureBox1.Dock = DockStyle.None Me.FormBorderStyle = Windows.Forms.FormBorderStyle.Sizable Me.WindowState = FormWindowState.Normal PictureBox1.Location = picBoxLocation Me.BackColor = myColor toggle = False Button1.Visible = True Button2.Visible = True Button3.Visible = True Button4.Visible = True Button5.Visible = True Label1.Visible = True Label2.Visible = True Label3.Visible = True Label4.Visible = True Label5.Visible = True TextBox1.Visible = True End If End Sub End Class Este codigo faz com que, ou clicar na picturebox fique em fullscreen, e depois carrega em alguma tecla volta ao normal. Não sei se é isto que você pretende mas tente Edited April 16, 2014 by killerbest Link to comment Share on other sites More sharing options...
a3deluxe Posted April 16, 2014 Author Report Share Posted April 16, 2014 killerbest obrigado pela tua ajuda, mas nao e bem o que pertendo. Tinha que ter um TIMER a verificar se o processo ou janela existe. Link to comment Share on other sites More sharing options...
a3deluxe Posted April 18, 2014 Author Report Share Posted April 18, 2014 (edited) Tentei com este código mas não esta a funcionar: queria que ele verifica-se se o processo existe e ficar topmost. tambem queria adicionar um Timer. // Dim myprocesses As Process() myprocesses = Process.GetProcessesByName("Menu.exe") If myprocesses.Length > 0 Then TopMost = True Else TopMost = False End If Este programa abre e fica sobre a picturebox depois quando carrego na picturebox este programa desaparece. queria que ele fica-se sempre visivel sobre a picturebox. enquanto ele existir no processo. Edited April 18, 2014 by a3deluxe Link to comment Share on other sites More sharing options...
a3deluxe Posted April 19, 2014 Author Report Share Posted April 19, 2014 Alguem para dar uma ajudinha? sff Link to comment Share on other sites More sharing options...
a3deluxe Posted April 21, 2014 Author Report Share Posted April 21, 2014 http://prntscr.com/3c112n Queria que este programa externo fica-se sempre a frente da picturebox. ja tentei com topmost e o focus mas não funcionou Link to comment Share on other sites More sharing options...
a3deluxe Posted April 22, 2014 Author Report Share Posted April 22, 2014 Alguem para dar uma ajuda? sff Link to comment Share on other sites More sharing options...
killerbest Posted April 22, 2014 Report Share Posted April 22, 2014 Infelizmente não sei... Mas não desista de procurar, vai ver que vai encontrar 😄 Link to comment Share on other sites More sharing options...
a3deluxe Posted April 22, 2014 Author Report Share Posted April 22, 2014 killerbest Obrigado na mesma, ainda não consegui em vb.net mas exprimentei para ver o resutado em uma outra linguagem que se chama Autokey e funcionou. Agora queria mas em vb.net deixo aqui o codigo em autokey para verem o que pertendo em vb.net // #SingleInstance ignore #SingleInstance force #Persistent #NoTrayIcon SetTimer, time, 200 return time: IfWinExist, Menu WinActivate else ControlFocus return Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now