c# - Determine if window has close button (Or, why isn't GetTitleBarInfo working?) -


i'm trying determine if given window has close button using gettitlebarinfo function, recommended in this answer. when call function return value rgstate[5] - should indicate close button state - 0 , don't understand why. have idea i'm doing wrong here? alternatively, if 1 can suggest method information, helpful well. thanks!

[dllimport("user32.dll", exactspelling = true, setlasterror = true)] internal static extern intptr getforegroundwindow();  [dllimport("user32.dll", setlasterror = true, charset = charset.auto)] [return: marshalas(unmanagedtype.bool)] internal static extern bool gettitlebarinfo(intptr hwnd, ref titlebarinfo pti);  [structlayout(layoutkind.sequential)] internal struct titlebarinfo {     public int cbsize;     public rect rctitlebar;     [marshalas(unmanagedtype.byvalarray, sizeconst = 6)]     public int[] rgstate; }  intptr handle = getforegroundwindow(); titlebarinfo titlebarinfo = new titlebarinfo(); titlebarinfo.cbsize = marshal.sizeof(titlebarinfo);  if (!gettitlebarinfo(handle, ref titlebarinfo))     throw new win32exception(marshal.getlastwin32error());  // titlebarinfo.rgstate[5] 0 here. why? 

edit: clear, according msdn return value should combination of 1 or more of the values listed here.


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c++ - Using OpenSSL in a multi-threaded application -

All overlapping substrings matching a java regex -