*Experts* DiverDan Posted June 4, 2004 *Experts* Posted June 4, 2004 I've got a splash screen as a seperate program which loads a very large main program. The main program takes different times to load depending of the user's file size, if the dotnet framework has been prior loaded, etc. I thought that I could create a file "Loaded.tmp" with the loading of the main program. The splash screen would then see the creation of "Loaded.tmp" and close. What I have so far is not working so well and I could use some help. In the splash screen load sub... With FileSystemWatcher1 .EnableRaisingEvents = True .Path = Application.StartupPath .Filter = "Loaded.tmp" .NotifyFilter = NotifyFilters.LastWrite _ Or NotifyFilters.CreationTime _ Or NotifyFilters.LastAccess End With AddHandler FileSystemWatcher1.Created, AddressOf FileSystemWatcher1_Created then - it seems this sub never gets executed Private Sub FileSystemWatcher1_Created(ByVal sender As System.Object, ByVal e As System.IO.FileSystemEventArgs) Handles _ FileSystemWatcher1.Created If e.ChangeType = WatcherChangeTypes.Created Then File.Delete(Application.StartupPath & "Loaded.tmp") tmrProgressBar.Enabled = False Me.Close() End If End Sub tmrProgressBar advances a progress bar. Thanks Dan Quote Member, in good standing, of the elite fraternity of mentally challenged programmers. Dolphins Software
bpayne111 Posted June 4, 2004 Posted June 4, 2004 hey dan here's some c# code of mine that might help.... InitializeComponent(); this._watcher.Created += new System.IO.FileSystemEventHandler(this._watcher_Created); this._watcher.Changed += new System.IO.FileSystemEventHandler(this._watcher_Changed); this._watcher.IncludeSubdirectories = true; this._watcher.EnableRaisingEvents = true; let me know if it helps Quote i'm not lazy i'm just resting before i get tired.
*Experts* DiverDan Posted June 4, 2004 Author *Experts* Posted June 4, 2004 Hi Brandon, nice to hear from you again!! I see what you did, but I'm have a problem converting this into VB lingo. Me.FileSystemWatcher1.Created = New System.IO.FileSystemEventHandler(Me.FileSystemWatcher1_Created) produces a pretty nice error. Dan Quote Member, in good standing, of the elite fraternity of mentally challenged programmers. Dolphins Software
Administrators PlausiblyDamp Posted June 4, 2004 Administrators Posted June 4, 2004 in vb you can either use the handles clause Private Sub FileSystemWatcher1_Changed(ByVal sender As System.Object, ByVal e As System.IO.FileSystemEventArgs) Handles FileSystemWatcher1.Changed End Sub or the addhandler keyword Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load AddHandler FileSystemWatcher1.Changed, AddressOf FileSystemWatcher1_Changed End Sub Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
*Experts* DiverDan Posted June 4, 2004 Author *Experts* Posted June 4, 2004 Thanks Plausibly Damp, I tried that too with equally dismal results...and after doing some more research found that FileSystemWatcher is not very reliable and is not supported by Windows 98 and ME. So I decided to solve this problem differently and close the splash screen from the main program with reliable, Windows 98 & ME safe code. Private Sub Kill_SplashScreen() Dim myProcess As Process Dim myProcesses() As Process = Process.GetProcesses() For Each myProcess In myProcesses If myProcess.ProcessName = "SplashScreen" Then myProcess.Kill() Exit For End If Next End Sub works perfectly! Thanks Dan Quote Member, in good standing, of the elite fraternity of mentally challenged programmers. Dolphins Software
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.