Get Window styles and exstyles ?
-
How can I get the style of a window class. Ex: I have a window (handle=0x00000b94, class name=#32770(dialog) ) I want to get the styles and extended styles of it as CS_DBLCLKS, WS_EX_CLIENTEDGE.... How can I do that ? I try this way: LONG lStyles=::GetWindowLong(hwnd,GWL_STYLE); LONG lExStyles=::GetWindowLong(hwnd,GWL_EXSTYLE); CString strStyles; if ((lStyles&BS_OWNERDRAW)==BS_OWNERDRAW) strStyles+="BS_OWNERDRAW"; if ((lStyles&CS_VREDDRAW)==CS_VREDDRAW) strStyles+="CS_VREDDRAW"; ... ... (hundreds of "if" !!!!!!!!!!!!!!!) Help me ! Hung Son A Vietnamese student i-g.hypermart.net dlhson2001@yahoo.com
-
How can I get the style of a window class. Ex: I have a window (handle=0x00000b94, class name=#32770(dialog) ) I want to get the styles and extended styles of it as CS_DBLCLKS, WS_EX_CLIENTEDGE.... How can I do that ? I try this way: LONG lStyles=::GetWindowLong(hwnd,GWL_STYLE); LONG lExStyles=::GetWindowLong(hwnd,GWL_EXSTYLE); CString strStyles; if ((lStyles&BS_OWNERDRAW)==BS_OWNERDRAW) strStyles+="BS_OWNERDRAW"; if ((lStyles&CS_VREDDRAW)==CS_VREDDRAW) strStyles+="CS_VREDDRAW"; ... ... (hundreds of "if" !!!!!!!!!!!!!!!) Help me ! Hung Son A Vietnamese student i-g.hypermart.net dlhson2001@yahoo.com
dlhson wrote: extended styles of it as CS_DBLCLKS, WS_EX_CLIENTEDGE First off the CS_DBLCLKS is a CLASS style, not a window style the GetWindowLong, using the GWL_STYLE or GWL_EXSTYLE will only return you the window styles (i.e. WS_XXX ,or WS_EX_XXX) for CS_XXX you need to call GetClassLong( hwnd, GCL_STYLE ) As far as conmverting them to a string, I think you are stuck with a big if/else statement, sorry ! :)