HI,
I have a vb.net program that uses axmediaplayer to play a wmv file.
I have a timer in this program that loads another form after 5 seconds.
Everything works fine in the program except..
On Win XP machines (Win7 works perfect) if screensaver starts first, then my program loads (it's on a scheduled task) my form doesn't show. Neither the first form or the second form. Thinking it may have to do with timer, but my main form doesn't load either. The wmv file loads, but that's it. Wierd...only on XP and only if the screensaver loads first.
Any ideas? I'll attach the code. I tried send keys to disable the screensaver. Didn't work.
I have a vb.net program that uses axmediaplayer to play a wmv file.
I have a timer in this program that loads another form after 5 seconds.
Everything works fine in the program except..
On Win XP machines (Win7 works perfect) if screensaver starts first, then my program loads (it's on a scheduled task) my form doesn't show. Neither the first form or the second form. Thinking it may have to do with timer, but my main form doesn't load either. The wmv file loads, but that's it. Wierd...only on XP and only if the screensaver loads first.
Any ideas? I'll attach the code. I tried send keys to disable the screensaver. Didn't work.
Code:
Imports WMPLib
Imports System.Windows.Forms.SendKeys
Public Class Form1
Private Sub RectangleShape1_doubleClick(sender As Object, e As EventArgs) Handles RectangleShape1.MouseDoubleClick
MsgBox(Environment.MachineName)
' For Each nic As System.Net.NetworkInformation.NetworkInterface In System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()
' If nic.OperationalStatus = Net.NetworkInformation.OperationalStatus.Up Then
' MessageBox.Show(String.Format("The MAC address of {0} is{1}{2}", nic.Description, Environment.NewLine, nic.GetPhysicalAddress()))
' End If
' Next
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
SendKeys.Send("{DOWN}") 'kills screensaver if running - use only on winxp machines REMOVE this if win7 build
Me.Width = 674
Me.Height = 553
Me.Label1.Height = 41
Me.Label1.Width = 343
Me.RectangleShape1.Height = 154
Me.RectangleShape1.Width = 583
Me.RectangleShape2.Height = 50
Me.RectangleShape2.Width = 583
Me.AxWindowsMediaPlayer1.Height = 416
Me.AxWindowsMediaPlayer1.Width = 577
Me.Panel1.Height = 147
Me.Panel1.Width = 576
Me.PictureBox1.Height = 41
Me.PictureBox1.Width = 115
Me.PictureBox2.Height = 41
Me.PictureBox2.Width = 115
Label1.Location = New Point(168, 320)
RectangleShape1.Location = New Point(44, 159)
RectangleShape2.Location = New Point(44, 316)
AxWindowsMediaPlayer1.Location = New Point(0, -133)
Panel1.Location = New Point(48, 164)
PictureBox1.Location = New Point(48, 320)
PictureBox2.Location = New Point(508, 320)
'If My.Application.IsNetworkDeployed Then
' Me.PictureBox1.ImageLocation = "\\WSIPR2\GSAP\yes.jpg"
'End If
Me.BackColor = Color.FromArgb(152, 0, 136)
Me.TransparencyKey = Color.FromArgb(152, 0, 136)
'black screen when running wmv from server until I changed this..
'AxWindowsMediaPlayer1.URL = "\\WSIPR2\GSAP\g4s_new.wmv"
AxWindowsMediaPlayer1.URL = "C:\program files\G4SGS\Time Reminder Installer\g4s_new.wmv"
'If My.Application.IsNetworkDeployed Then
' AxWindowsMediaPlayer1.URL = My.Application.Info.DirectoryPath & "\resources\g4s_new.wmv"
'End If
'AxWindowsMediaPlayer1.URL = Application.StartupPath & "\g4s_new.wmv"
RectangleShape2.Visible = False
Label1.Visible = False
PictureBox1.Visible = False
PictureBox2.Visible = False
'If My.Application.IsNetworkDeployed Then
' PictureBox1.ImageLocation = My.Application.Info.DirectoryPath & "\resources\yes.jpg"
'End If
'If My.Application.IsNetworkDeployed Then
' PictureBox1.ImageLocation = My.Application.Info.DirectoryPath & "\resources\no.jpg"
'End If
''when using 'advanced installer for setup/delpoy - below must use program files (x86) for 64bit installs
'32 bit installs go to program files
' - build application then point to sln - program won't run like this black screen but used for installer
PictureBox1.ImageLocation = "C:\program files\G4SGS\Time Reminder Installer\yes.jpg"
'PictureBox1.Image = My.Resources.yes
'PictureBox2.Image = My.Resources.no
'AxWindowsMediaPlayer1.URL = My.Resources.g4s_new
PictureBox2.ImageLocation = "C:\program files\G4SGS\Time Reminder Installer\no.jpg"
End Sub
Dim timercount As Integer = 10
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
timercount = timercount - 1
If timercount = 5 Then
RectangleShape2.Visible = True
Label1.Visible = True
PictureBox1.Visible = True
PictureBox2.Visible = True
'close if left running
End If
If timercount > 20 Then
Me.Close()
End
End If
End Sub
Private Sub PictureBox2_Click(sender As Object, e As EventArgs) Handles PictureBox2.Click
Timer1.Enabled = False
Me.Close()
End Sub
Private Sub PictureBox1_Click(sender As Object, e As EventArgs) Handles PictureBox1.Click
Timer1.Enabled = False
Shell("\\wsipr2\gsap\wsites\TES.exe", 1)
Me.Close()
End Sub
End Class