changing window styles during runtime
How can a Visual C++ program change window styles (WS_* flags) during runtime? I am using Win32 API. Also how can I change the size and location of a window during runtime?
Edited by - whats a username on August 29, 2001 11:36:42 AM
August 29, 2001 10:55 AM
That depends on the fact if you''re using window-handles or MFC CWnd-Objects.
In case of window-handles (HWND) see method SetWindowPos:
BOOL SetWindowPos(
HWND hWnd, // handle to window
HWND hWndInsertAfter, // placement-order handle
int X, // horizontal position
int Y, // vertical position
int cx, // width
int cy, // height
UINT uFlags // window-positioning options
);
In case of MFC CWnd-derivative window:
BOOL CWnd::SetWindowPos(
const CWnd* pWndInsertAfter,
int x,
int y,
int cx,
int cy,
UINT nFlags
);
I hope it''s not neccessary to list all the flags and so on here... in that case, buy a book :]
The styles might be requested and set with non mfc-windows and HWNDs by using
LONG GetWindowLong(
HWND hWnd, // handle to window
int nIndex // offset of value to retrieve
);
and
LONG SetWindowLong(
HWND hWnd, // handle to window
int nIndex, // offset of value to set
LONG dwNewLong // new value
);
where you should use GWL_STYLE as nIndex parameter.
In MFC CWnd-Objects use
DWORD CWnd::GetStyle();
for retrieving and
BOOL CWnd::ModifyStyle(
DWORD dwRemove, // flags to be unset (0 if no flags to remove)
DWORD dwAdd, // flags to be set (0 if no flags to set)
UINT nFlags = 0
);
for setting your WS_* flags...
have fun,
w473rh34d
In case of window-handles (HWND) see method SetWindowPos:
BOOL SetWindowPos(
HWND hWnd, // handle to window
HWND hWndInsertAfter, // placement-order handle
int X, // horizontal position
int Y, // vertical position
int cx, // width
int cy, // height
UINT uFlags // window-positioning options
);
In case of MFC CWnd-derivative window:
BOOL CWnd::SetWindowPos(
const CWnd* pWndInsertAfter,
int x,
int y,
int cx,
int cy,
UINT nFlags
);
I hope it''s not neccessary to list all the flags and so on here... in that case, buy a book :]
The styles might be requested and set with non mfc-windows and HWNDs by using
LONG GetWindowLong(
HWND hWnd, // handle to window
int nIndex // offset of value to retrieve
);
and
LONG SetWindowLong(
HWND hWnd, // handle to window
int nIndex, // offset of value to set
LONG dwNewLong // new value
);
where you should use GWL_STYLE as nIndex parameter.
In MFC CWnd-Objects use
DWORD CWnd::GetStyle();
for retrieving and
BOOL CWnd::ModifyStyle(
DWORD dwRemove, // flags to be unset (0 if no flags to remove)
DWORD dwAdd, // flags to be set (0 if no flags to set)
UINT nFlags = 0
);
for setting your WS_* flags...
have fun,
w473rh34d
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement