コード例 #1
0
ファイル: TaskDialog.cs プロジェクト: ScriptBox21/mpv.net
    public IntPtr GetHandle()
    {
        StringBuilder lpszFileName     = new StringBuilder(260);
        IntPtr        foregroundWindow = TaskDialogNative.GetForegroundWindow();

        TaskDialogNative.GetWindowModuleFileName(foregroundWindow, lpszFileName, 260U);

        if (Path.GetFileName(lpszFileName.ToString().Replace(".vshost", "")) ==
            Path.GetFileName(Assembly.GetEntryAssembly().Location))
        {
            return(foregroundWindow);
        }

        return(IntPtr.Zero);
    }
コード例 #2
0
ファイル: TaskDialog.cs プロジェクト: Revan654/MediaInfo.NET
    public IntPtr GetHandle()
    {
        StringBuilder fileNameSelf     = new StringBuilder(260);
        StringBuilder fileNameActive   = new StringBuilder(260);
        IntPtr        foregroundWindow = TaskDialogNative.GetForegroundWindow();

        TaskDialogNative.GetWindowModuleFileName(foregroundWindow, fileNameActive, 260U);
        TaskDialogNative.GetModuleFileName(IntPtr.Zero, fileNameSelf, fileNameSelf.Capacity);

        if (Path.GetFileName(fileNameActive.ToString().Replace(".vshost", ""))
            == Path.GetFileName(fileNameSelf.ToString()))
        {
            return(foregroundWindow);
        }

        return(IntPtr.Zero);
    }