如何检查mdi子进程已经运行?

发布于 2024-08-23 04:46:38 字数 63 浏览 4 评论 0原文

请帮助我..我有一个使用 MDI 应用程序的项目。我的问题是,如何检查 mdi 孩子是否已经运行..?请帮我..

please help me.. i have a project use mdi application. my question is, how to check mdi child already running or not..? please help me..

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦明 2024-08-30 04:46:38

我使用以下技术,但它需要每个表单类型都有一个特定的子(我使用的是 VB.NET)。不过,我确信可能有一种方法可以简化此操作,以使用一个子项处理所有子表单

        Dim blExists As Boolean = False
        For Each f As Form In Me.MdiChildren
            If TypeOf (f) Is FormName Then
                f.Focus()
                blExists = True
                Exit For
            End If
        Next
        If Not blExists Then
            fAnalysis = New FormName
            fAnalysis.MdiParent = Me
            fAnalysis.Show()
        End If

以下子项适用于所有表单。

Private Sub ShowNewForm(ByVal frmName As Form)
        Dim blExists As Boolean = False
        Dim f as Form
        For Each f In Me.MdiChildren
            If f.Name Is frmName.Name Then
                f.Focus()
                blExists = True
                Exit For
            End If
        Next
        If Not blExists Then
            f = DirectCast(New Form, frmName.Type)
            fAnalysis.MdiParent = Me
            f.Show()
        End If
End Sub

I use the following technique, but it requires a specific Sub for each Form type(I'm using VB.NET). However I'm sure there could be a way to simplify this to handle all child forms with one sub

        Dim blExists As Boolean = False
        For Each f As Form In Me.MdiChildren
            If TypeOf (f) Is FormName Then
                f.Focus()
                blExists = True
                Exit For
            End If
        Next
        If Not blExists Then
            fAnalysis = New FormName
            fAnalysis.MdiParent = Me
            fAnalysis.Show()
        End If

The following sub works for all forms.

Private Sub ShowNewForm(ByVal frmName As Form)
        Dim blExists As Boolean = False
        Dim f as Form
        For Each f In Me.MdiChildren
            If f.Name Is frmName.Name Then
                f.Focus()
                blExists = True
                Exit For
            End If
        Next
        If Not blExists Then
            f = DirectCast(New Form, frmName.Type)
            fAnalysis.MdiParent = Me
            f.Show()
        End If
End Sub
影子是时光的心 2024-08-30 04:46:38

创建 MDI 窗口时,您使用了 WM_MDICREATE 对吗?该消息返回一个窗口句柄,您应该将该句柄保存在某处,以便稍后要查找该窗口或检查它是否存在时可以引用它。

MDICREATESTRUCT mci;
// fill out mci...
HWND hwndChild = (HWND) SendMessage(hwndMDI, WM_MDICREATE, 0, (LPARAM)(ULONG_PTR)&mci); 

// save hwndChild so that I can use it later.

When you created the MDI window, you used WM_MDICREATE right? Well that message returns a window handle, You should save that handle somewhere so that you can refer to it if you want to find the window later or check to see if it exists.

MDICREATESTRUCT mci;
// fill out mci...
HWND hwndChild = (HWND) SendMessage(hwndMDI, WM_MDICREATE, 0, (LPARAM)(ULONG_PTR)&mci); 

// save hwndChild so that I can use it later.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文