网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

vb.net判断已启动,vb运行时默认启动的窗体是

vb.net 怎样判断某个窗体是否打开

Dim F1 As New Datasystem.Form2 '实例化窗体

我们提供的服务有:网站设计、成都网站建设、微信公众号开发、网站优化、网站认证、即墨ssl等。为1000多家企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的即墨网站制作公司

For Each na As Form In Application.OpenForms '打开窗体的集合

If na.ProductName = F1.ProductName AndAlso na.Name = F1.Name 0 Then '判断程序集的产品名称和窗体名称是否已存在打开的窗体中

If na.WindowState = FormWindowState.Minimized Then '判断窗体是否最小化

na.WindowState = FormWindowState.Normal '还原窗体

End If

na.Activate() '激活窗体

Return '返回

End If

Next

F1.Show() '如果没有打开的窗体中未找到,重新打开窗体

vb.net 怎么判断当前程序是否正在运行?

Imports System.Runtime.InteropServices

Module Module1

Sub Main()

Dim instance As Process = RunningInstance()

If instance IsNot Nothing Then

ShowWindowAsync(instance.MainWindowHandle, 3) '调用api函数,正常显示窗口

Return

End If

Dim F1 As New Form1

Application.Run(F1) '显示窗体

End Sub

DllImport("User32.dll")

Public Function ShowWindowAsync(ByVal hWnd As System.IntPtr, ByVal cmdShow As Integer) As Boolean

End Function

Private Function RunningInstance() As Process '返回进程中已经打开的程序

Dim current As Process = Process.GetCurrentProcess()

Dim processes As Process() = Process.GetProcessesByName(current.ProcessName)

For Each process As Process In processes

If process.Id current.Id Then

If process.MainModule.FileName = current.MainModule.FileName Then

Return process

End If

End If

Next

Return Nothing

End Function

End Module

vb.net 检查程序已运行

这个提供进程即可以判断程序是否已经启动

这个是最一般的方法了

希望能帮到你


标题名称:vb.net判断已启动,vb运行时默认启动的窗体是
标题链接:http://bjjierui.cn/article/hogode.html

其他资讯