Carloz Posted December 14, 2006 at 01:42 AM Report #70505 Posted December 14, 2006 at 01:42 AM É o seguinte...eu estou a criar um programa no qual tenho uma opção que é quando se abre o programa ele começa em modo hide (escondido). O programa, quando o utilizador escolhe essa opção, cria um ficheiro numa pasta denominado "INF2". Ao abrir o programa da próxima vez, este vai verificar se existe tal ficheiro e se existir então supostamente o programa entraria em modo hide. O problema é que o "Me.hide()" não está a funcionar não sei porque. Se fizer um botao funciona, mas se o puser no "Form1_load" já nao. Já experimente por no inicio do form, no fim...ja verifiquei como o programa actua quando é corrido (que por acaso o programa le a instrução mas não a executa) mas continua a nao dar e eu sem perceber porque. Aqui fica o código... Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If My.Computer.FileSystem.DirectoryExists("C:\Program Files\PCSecurityCam") = False Then My.Computer.FileSystem.CreateDirectory("C:\Program Files\PCSecurityCam\Log") My.Computer.FileSystem.CreateDirectory("C:\Program Files\PCSecurityCam\Screens") My.Computer.FileSystem.CreateDirectory("C:\Program Files\PCSecurityCam\Data") End If Timer1.Interval = 600000 Timer1.Enabled = True ListBox.Text = "10 min" If My.Computer.FileSystem.FileExists("C:\Program Files\PCSecurityCam\Data\INF1") Then autostartBox.Checked = True End If If My.Computer.FileSystem.FileExists("C:\Program Files\PCSecurityCam\Data\INF2") Then startontrayBox.Checked = True me.hide() End If End Sub O resto não posto porque é muito extenso, mas penso que o essencial está aqui. Obrigado pela ajuda. Fiquem bem 😉 "Rejoice not against me, O mine enemy: when I fall, I shall arise; when I sit in darkness, the LORD shall be a light unto me." - Micah 7:8 (KJV)
Asgorath Posted December 14, 2006 at 09:35 AM Report #70513 Posted December 14, 2006 at 09:35 AM Boas Coloca o Me.Hide() num Timer_Tick Jorge "The Dark Side Clouds Everthing. Impossible To See The Future Is."My rig: Intel Core 2 Quad Q9450 | abit IP35P | 4G Kingston 800 Mhz | XFX GeForce 9800 GX2 1G ddr3 | 2X WD5000AAJS 500Gb Sata 2 | PSU 600W || Caixa El-Diablo | Creative XMod
Carloz Posted December 14, 2006 at 12:51 PM Author Report #70527 Posted December 14, 2006 at 12:51 PM ok vou experimentar.Depois digo algo. obrigado. "Rejoice not against me, O mine enemy: when I fall, I shall arise; when I sit in darkness, the LORD shall be a light unto me." - Micah 7:8 (KJV)
Crack Posted December 14, 2006 at 01:15 PM Report #70531 Posted December 14, 2006 at 01:15 PM Me.Opacity = 0 Me.ShowInTaskbar = False tá feito
killercode Posted December 14, 2006 at 02:03 PM Report #70536 Posted December 14, 2006 at 02:03 PM Me.Opacity = 0 Me.ShowInTaskbar = False tá feito Essa solução digo-te ja é um pouco a padeiro 😉.... Geek PressWeboeste.Com
SoulOnFire Posted December 14, 2006 at 02:27 PM Report #70538 Posted December 14, 2006 at 02:27 PM Po Boas Coloca o Me.Hide() num Timer_Tick Jorge porque é que n usas esta ieia... ficava mt melhor Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If My.Computer.FileSystem.DirectoryExists("C:\Program Files\PCSecurityCam") = False Then My.Computer.FileSystem.CreateDirectory("C:\Program Files\PCSecurityCam\Log") My.Computer.FileSystem.CreateDirectory("C:\Program Files\PCSecurityCam\Screens") My.Computer.FileSystem.CreateDirectory("C:\Program Files\PCSecurityCam\Data") End If Timer1.Interval = 600000 Timer1.Enabled = True ListBox.Text = "10 min" If My.Computer.FileSystem.FileExists("C:\Program Files\PCSecurityCam\Data\INF1") Then autostartBox.Checked = True End If If My.Computer.FileSystem.FileExists("C:\Program Files\PCSecurityCam\Data\INF2") Then startontrayBox.Checked = True 'Agora o Codigo novo Dim t As Timer = New Timer AddHandler t.Tick, AddressOf t_Tick t.Interval = 100 t.Start() End If End Sub 'Mais Codigo novo Sub t_Tick(ByVal sender As Object, ByVal e As EventArgs) Me.Hide() CType(sender, Timer).Stop() End Sub Fikem Bem!!!Miguel Duarte - (SoulOnFire)O meu BLOG - XAML E WPF - http://wpfpt.wordpress.com/
Crack Posted December 14, 2006 at 03:38 PM Report #70543 Posted December 14, 2006 at 03:38 PM Me.Opacity = 0 Me.ShowInTaskbar = False tá feito Essa solução digo-te ja é um pouco a padeiro 😉.... padeiro? é mais padeiro fazer Me.Hide num timer a correr vezes infinitas do que esta, e em termos de perfomance nem se compara...mas pronto cada um come o padeiro que quer 😉
Carloz Posted December 14, 2006 at 11:28 PM Author Report #70609 Posted December 14, 2006 at 11:28 PM Ok...já consegui. Aqui fica o código: Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If My.Computer.FileSystem.DirectoryExists("C:\Program Files\PCSecurityCam") = False Then My.Computer.FileSystem.CreateDirectory("C:\Program Files\PCSecurityCam\Log") My.Computer.FileSystem.CreateDirectory("C:\Program Files\PCSecurityCam\Screens") My.Computer.FileSystem.CreateDirectory("C:\Program Files\PCSecurityCam\Data") End If Timer1.Interval = 600000 Timer1.Enabled = True ListBox.Text = "10 min" If My.Computer.FileSystem.FileExists("C:\Program Files\PCSecurityCam\Data\INF1") Then autostartBox.Checked = True End If If My.Computer.FileSystem.FileExists("C:\Program Files\PCSecurityCam\Data\INF2") Then startontrayBox.Checked = True startontray_timer.Interval = 10 startontray_timer.Enabled = True End If End Sub Private Sub startontray_timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles startontray_timer.Tick Me.Hide() startontray_timer.Stop() End Sub Obrigado pela ajuda. "Rejoice not against me, O mine enemy: when I fall, I shall arise; when I sit in darkness, the LORD shall be a light unto me." - Micah 7:8 (KJV)
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