Table of Contents

Class GuiMainWindow

Namespace
SapGui.Wrapper
Assembly
SapGui.Wrapper.dll

Represents a SAP GUI window (main window, modal dialog, etc.). Equivalent to VBA GuiFrameWindow / GuiMainWindow.

public class GuiMainWindow : GuiComponent
Inheritance
GuiMainWindow
Inherited Members

Properties

Handle

Win32 window handle (HWND) of this SAP window.

public IntPtr Handle { get; }

Property Value

IntPtr

IsDialog

Returns true if this window is a modal dialog.

public bool IsDialog { get; }

Property Value

bool

IsMaximized

Returns true if the window is currently maximized. Determined via the Win32 IsZoomed API on the window handle, which is reliable across all SAP GUI versions (the SAP COM property IsMaximized is not consistently updated after Maximize()).

public bool IsMaximized { get; }

Property Value

bool

Title

The window title bar text.

public string Title { get; }

Property Value

string

Methods

Close()

Closes the window (equivalent to the X button).

public void Close()

HardCopy(string, string)

Takes a screenshot and saves it to a file. Format is determined by the file extension (.png, .bmp, .jpg).

public void HardCopy(string filePath, string format = "PNG")

Parameters

filePath string
format string

Iconify()

Minimizes (iconifies) the window to the taskbar.

public void Iconify()

Maximize()

Maximises the window.

public void Maximize()

Restore()

Restores the window to normal size.

public void Restore()

SendVKey(int)

Sends a virtual key to the window.

0Enter
3Back (F3)
4Input Help (F4)
5Matchcode (Search)
8Execute (F8)
11Save (Ctrl+S)
12Exit (F12 / Shift+F4)
15Cancel (F15 / Shift+F3)
71Scroll to top
82Scroll to bottom
public void SendVKey(int vKey)

Parameters

vKey int