Implement SetWindowPos (#98)

This commit is contained in:
Anders Jenbo 2025-05-16 22:28:02 +02:00 committed by GitHub
parent 4ada014dfd
commit d58ce5e9a9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 23 additions and 5 deletions

View File

@ -16,7 +16,7 @@
#define CALLBACK #define CALLBACK
#define FAR #define FAR
#define WINAPI #define WINAPI
#define HWND_NOTOPMOST (HWND) - 2 #define HWND_NOTOPMOST -2
#define RGB(r, g, b) ((r) | ((g) << 8) | ((b) << 16)) #define RGB(r, g, b) ((r) | ((g) << 8) | ((b) << 16))
#define S_OK ((HRESULT) 0) #define S_OK ((HRESULT) 0)
#define E_NOINTERFACE (0x80004002) #define E_NOINTERFACE (0x80004002)
@ -147,10 +147,7 @@ struct IUnknown {
int m_refCount; int m_refCount;
}; };
inline BOOL SetWindowPos(HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags) BOOL SetWindowPos(HWND hWnd, int hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags);
{
return TRUE;
}
inline HDC WINAPI GetDC(HWND hWnd) inline HDC WINAPI GetDC(HWND hWnd)
{ {

View File

@ -24,6 +24,27 @@ HRESULT IUnknown::QueryInterface(const GUID& riid, void** ppvObject)
return E_NOINTERFACE; return E_NOINTERFACE;
} }
BOOL SetWindowPos(HWND hWnd, int hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags)
{
if (!hWnd) {
return FALSE;
}
if (!(uFlags & SWP_NOACTIVATE)) {
SDL_RaiseWindow(hWnd);
}
if (!(uFlags & SWP_NOSIZE)) {
SDL_SetWindowSize(hWnd, cx, cy);
}
if (!(uFlags & SWP_NOMOVE)) {
SDL_SetWindowPosition(hWnd, X, Y);
}
return TRUE;
}
VOID WINAPI Sleep(DWORD dwMilliseconds) VOID WINAPI Sleep(DWORD dwMilliseconds)
{ {
SDL_Delay(dwMilliseconds); SDL_Delay(dwMilliseconds);