How to open a window full client size?

Just starting out? Need help? Post your questions and find answers here.
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post by Sparkie »

Derek wrote:Anyone else getting this with Vista?
No problem here with Vista HomePremium.

Now that I see exactly what it is you're looking for, I modified my original code...
Window is max size with borders and all gadgets being visible
Window cannot be moved
SysMenu item Move is disabled
Taskbar location (left/right/top/bottom) is taken into account

Code: Select all

SystemParametersInfo_(#SPI_GETWORKAREA,0,@screen.RECT,0) 
captionheight=GetSystemMetrics_(#SM_CYCAPTION) 
borderwidth=GetSystemMetrics_(#SM_CXFIXEDFRAME) 
borderheight=GetSystemMetrics_(#SM_CYFIXEDFRAME) 
windowwidth=screen\right-screen\left-(borderwidth*2) 
windowheight=screen\bottom-screen\top-captionheight-(borderheight*2) 
windowx=screen\left
windowy=screen\top
Procedure.l WinCallback(hwnd,msg,wParam,lParam) 
  result=#PB_ProcessPureBasicEvents 
  Select msg 
    Case #WM_WINDOWPOSCHANGING
      result=0
  EndSelect 
  ProcedureReturn result 
EndProcedure 

Procedure.l DisableMenuMove(hwnd)
  hMenu=GetSystemMenu_(hwnd,0)
  mii.MENUITEMINFO
  mii\cbSize=SizeOf(MENUITEMINFO)
  mii\fMask=#MIIM_STRING
  mii\dwTypeData=0
  GetMenuItemInfo_(hMenu,#SC_MOVE,0,@mii.MENUITEMINFO)
  mItem$ = Space(mii\cch+1)
  mii\dwTypeData=@mItem$
  mii\cch+1
  GetMenuItemInfo_(hMenu,#SC_MOVE,0,@mii.MENUITEMINFO)
  ModifyMenu_(hMenu,#SC_MOVE,#MF_GRAYED|#MF_BYCOMMAND,0,mItem$)
  DrawMenuBar_(hwnd)
EndProcedure
  
OpenWindow(0,windowx,windowy,windowwidth,windowheight,"",#PB_Window_SystemMenu) 
CreateGadgetList(WindowID(0)) 
ButtonGadget(0,0,0,100,100,"") 
ButtonGadget(1,WindowWidth(0)-100,0,100,100,"") 
ButtonGadget(2,0,WindowHeight(0)-100,100,100,"") 
ButtonGadget(3,WindowWidth(0)-100,WindowHeight(0)-100,100,100,"") 
DisableMenuMove(WindowID(0))
SetWindowCallback(@WinCallback())
Repeat 
  
Until WaitWindowEvent()=#PB_Event_CloseWindow 
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

Post by rsts »

Dereks code = close but not quite filled.

Sparkie's code = filled completely.

Vista64 ultimate.

cheers
Derek
Addict
Addict
Posts: 2354
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post by Derek »

Thanks Sparkie, works great. :D
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

rsts wrote: Vista64 ultimate.
Perhaps a Vista64 issue?
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Derek
Addict
Addict
Posts: 2354
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post by Derek »

No, mines vista 32. I posted a bug report and freak had a solution.
Post Reply