Help Center/ Meeting/ Client SDK Reference/ Windows SDK/ API Reference/ UI Customization/ Obtaining Information About the Main Window
Updated on 2024-09-13 GMT+08:00

Obtaining Information About the Main Window

GetMainWindowInfo

API Description

This API is used to obtain information about the main window.

Precautions

  1. This API is an asynchronous API. The return value only indicates whether the API is successfully called. The actual service processing result is returned in the corresponding callback function.

Method Definition

1
HWM_SDK_AGENT_API hwmsdk::HwmErrCode GetMainWindowInfo();

Callback Function

1
virtual void OnGetMainWindowInfoResult(hwmsdk::HwmErrCode ret, const char* reason, const HwmMainWindowInfo *mainWindowInfo) {};

Parameter Description

Table 1 HwmMainWindowInfo description

Parameter

Type

Description

x

int

Offset of the window relative to the left side of the screen.

y

int

Offset of the window relative to the top of the screen.

width

int

Width of the window.

height

int

Height of the window.

handle

HWND

Window handle.

Table 2 Return values

Type

Description

HwmErrCode

If 0 is returned, the operation is successful. If other values are returned, the operation fails. For details about values returned upon failures, see Common Error Codes.

HwmMainWindowInfo

Main window information.

Sample Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
/**
* Obtain information about the main window.
*/
void demoGetMainWindowInfoDlg::OnBnClickedOk()
{
    int ret = hwmsdkagent::GetMainWindowInfo();
    if (hwmsdk::HWM_COMMON_SUCCESS != ret)
    {
        AfxMessageBox(_T("get mainwindow info error"));
        return;
    }
}