mirror of
https://github.com/greenshot/greenshot
synced 2025-08-14 10:47:02 -07:00
Some fixed for not getting windows to focus/to front which were inspired by FEATURE-992. [skip ci]
This commit is contained in:
parent
b92d79ed39
commit
5a1a4737ec
8 changed files with 51 additions and 9 deletions
|
@ -22,6 +22,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Drawing;
|
||||
using GreenshotPlugin.Core;
|
||||
|
||||
namespace Greenshot.Interop.Office {
|
||||
public class ExcelExporter {
|
||||
|
@ -72,6 +73,11 @@ namespace Greenshot.Interop.Office {
|
|||
}
|
||||
}
|
||||
}
|
||||
int hWnd = excelApplication.Hwnd;
|
||||
if (hWnd > 0)
|
||||
{
|
||||
WindowDetails.ToForeground(new IntPtr(hWnd));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using GreenshotOfficePlugin;
|
||||
using Greenshot.IniFile;
|
||||
using GreenshotPlugin.Core;
|
||||
|
||||
namespace Greenshot.Interop.Office {
|
||||
public class WordExporter {
|
||||
|
@ -123,7 +124,15 @@ namespace Greenshot.Interop.Office {
|
|||
// ignored
|
||||
}
|
||||
try {
|
||||
wordDocument.Activate();
|
||||
using (var activeWindow = wordDocument.ActiveWindow)
|
||||
{
|
||||
activeWindow.Activate();
|
||||
int hWnd = activeWindow.Hwnd;
|
||||
if (hWnd > 0)
|
||||
{
|
||||
WindowDetails.ToForeground(new IntPtr(hWnd));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
@ -192,7 +201,15 @@ namespace Greenshot.Interop.Office {
|
|||
// ignored
|
||||
}
|
||||
try {
|
||||
wordDocument.ActiveWindow.Activate();
|
||||
using (var activeWindow = wordDocument.ActiveWindow)
|
||||
{
|
||||
activeWindow.Activate();
|
||||
int hWnd = activeWindow.Hwnd;
|
||||
if (hWnd > 0)
|
||||
{
|
||||
WindowDetails.ToForeground(new IntPtr(hWnd));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
|
@ -37,13 +37,21 @@ namespace Greenshot.Interop.Office {
|
|||
string Version {
|
||||
get;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an Integer indicating the top-level window handle of the Microsoft Excel window.
|
||||
/// </summary>
|
||||
int Hwnd
|
||||
{
|
||||
get;
|
||||
}
|
||||
}
|
||||
|
||||
// See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.workbooks.aspx
|
||||
public interface IWorkbooks : ICommon, ICollection {
|
||||
IWorkbook Add(object template);
|
||||
// Use index + 1!!
|
||||
IWorkbook this[object Index] {
|
||||
IWorkbook this[object index] {
|
||||
get;
|
||||
}
|
||||
}
|
||||
|
@ -76,14 +84,14 @@ namespace Greenshot.Interop.Office {
|
|||
}
|
||||
|
||||
// See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.iworksheets_members.aspx
|
||||
public interface IWorksheets : ICommon, ICollection {
|
||||
public interface IWorksheets : ICollection {
|
||||
// Use index + 1!!
|
||||
IWorksheet this[object Index] {
|
||||
IWorksheet this[object index] {
|
||||
get;
|
||||
}
|
||||
}
|
||||
|
||||
public interface IPictures : ICommon, ICollection {
|
||||
public interface IPictures : ICollection {
|
||||
// Use index + 1!!
|
||||
//IPicture this[object Index] { get; }
|
||||
void Insert(string file);
|
||||
|
|
|
@ -289,7 +289,9 @@ namespace Greenshot.Interop.Office {
|
|||
}
|
||||
}
|
||||
|
||||
// See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.inspector_members.aspx
|
||||
/// <summary>
|
||||
/// See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.inspector_members.aspx
|
||||
/// </summary>
|
||||
public interface IInspector : ICommonExplorer {
|
||||
IItem CurrentItem {
|
||||
get;
|
||||
|
|
|
@ -60,6 +60,11 @@ namespace Greenshot.Interop.Office {
|
|||
string Caption {
|
||||
get;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an Integer (int in C#) that indicates the window handle of the specified window
|
||||
/// </summary>
|
||||
int Hwnd { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue