Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15057

VS 2010 Another window doesnt popup though it should

$
0
0
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.

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

I dont see the problem since theres AND in my code i.e. both conditions are handled.

Viewing all articles
Browse latest Browse all 15057

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>