Hi,
I am facing strange issue - when another app is not running and folder exists, it does not shown another form. However, if folder does not exists and app is running, it works fine. I prior thought that timers restarting policy is the issue, but its not since it works when folder does not exists.
2nd app only creates folder and removes it every 5 seconds.
another form is a form with close button that closes it.
I dont see the problem since theres AND in my code i.e. both conditions are handled.
I am facing strange issue - when another app is not running and folder exists, it does not shown another form. However, if folder does not exists and app is running, it works fine. I prior thought that timers restarting policy is the issue, but its not since it works when folder does not exists.
2nd app only creates folder and removes it every 5 seconds.
another form is a form with close button that closes it.
Code:
Imports System.Net
Public Class my_program
Public Declare Auto Function FindWindowNullClassName Lib "user32.dll" Alias "FindWindow" (ByVal lpClassName As Integer, ByVal lpWindownName As String) As Integer
Dim Counter As Integer = 0
Private Sub mainwindow_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If My.Computer.FileSystem.DirectoryExists("C:\directory.desc\") Then
Else
My.Computer.FileSystem.CreateDirectory("C:\directory.desc\")
End If
timer1.Interval = 15000 '15 sek
timer1.Start()
End Sub
Private Sub timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles timer1.Tick
Dim hWnd As Integer = FindWindowNullClassName(0, "nazov.okna.este.nie.je")
If hWnd = 0 And Not My.Computer.FileSystem.DirectoryExists("C:\directory.desc\initial-check\") Then
AnotherForm.Show()
Else
End If
End Sub