Page 2 of 2

Posted: Sun Apr 13, 2008 4:27 pm
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 

Posted: Sun Apr 13, 2008 5:18 pm
by rsts
Dereks code = close but not quite filled.

Sparkie's code = filled completely.

Vista64 ultimate.

cheers

Posted: Sun Apr 13, 2008 8:52 pm
by Derek
Thanks Sparkie, works great. :D

Posted: Mon Apr 14, 2008 12:44 pm
by blueznl
rsts wrote: Vista64 ultimate.
Perhaps a Vista64 issue?

Posted: Mon Apr 14, 2008 12:58 pm
by Derek
No, mines vista 32. I posted a bug report and freak had a solution.