18 Kasım 2019 Pazartesi

GetWindowLong metodu

Örnek
Şöyle yaparız.
HWND g_hwndTarget;

BOOL CALLBACK  EnumCallback(HWND hwnd, LPARAM lParam)
{
    wchar_t szText[MAX_PATH] = {};
    GetWindowTextW(hwnd, szText, MAX_PATH);

    std::wstring strTitle = szText;
    if (strTitle.find(L"cmd.exe") != std::string::npos)
    {
        g_hwndTarget = hwnd;
        return FALSE;
    }
    return TRUE;
}


int main()
{
  EnumDesktopWindows(NULL, EnumCallback, 0);

  RECT rect = {};
  SystemParametersInfo(SPI_GETWORKAREA, 0, &rect, 0);

  if (g_hwndTarget)
  {
    LONG style = GetWindowLong(g_hwndTarget, GWL_STYLE);
    style &= ~WS_BORDER;
    style &= ~WS_OVERLAPPEDWINDOW;
    SetWindowLong(g_hwndTarget, GWL_STYLE, style);
    SetWindowPos(g_hwndTarget, HWND_BOTTOM, 0, 0, rect.right, rect.bottom, 0);
  }

  return 0;
}

Hiç yorum yok:

Yorum Gönder