:Start of 3Bars 3Bars.dsc
DragonSphereSoftware

DragonSphere Software Demos


If you are viewing this script in your browser you can save it as a VDS 5.x source file (*.dsc) to run it.




# =========================Program Header===============================
#     FILENAME:                3bars.dsc
#     PROGRAM NAME:            ThreeBars
#     PROGRAM VERSION:         2.00
#     INTENDED O/S:            Windows 9x, ME, NT, 2000, and XP
#     WRITTEN BY:              Johnny Kinsey (aka...Dragon Sphere)
#     DATE CREATED:            December 10, 2005
#     EXTERNAL COMPONENTS:     gadgetx.dll, File Management.ico, SAVE.BMP,
#                              toolbar.bmp, and dragonfly-h100.bmp
#     SUGGESTED SCREEN SIZE:   800 x 600   32bit Colors
# =========================Description of Program=======================
#
#  Below is a list of Features that this script demostrates
#  1) Win32 API menu functions
#  2) Win32 API Bit blitting functions for BITMAPS and Icons
#  3) StatusBar command
#  4) Toolbar element
#  5) Rebar element
#  6) PrintDialog command
#  7) SetWin Theme command
#  8) SetWin Backgrond,ShapeToBmp
#  9) Placing VDS elements on GadgetX'es Toolbar element
#
# DragonSphere Software's Home Page
#  
# All Source Files for this demo
#
# Warning: Since this script is designed to use Bitmap resources inside the final Exe it cannot be ran 
#          inside of the VDS IDE.  Please compile the script and execute the Exe.
#
# ===========================BEGIN  SCRIPT==============================
If @Greater(@Name(@Sysinfo(DSVER)),4)

External GadgetX.dll,@SYSINFO(DSVER)

  # GadgetX commands
  #DEFINE COMMAND,GADGETX,DEFINE,FREEDLL,SLEEP,SET,CALL,SETWIN,SETMSG,STATUSBAR,TOOLBAR,REBAR,SaveBmp,FireEvent,PRINTDIALOG,DELICO,DelDesktopBmp
  # GadgetX Functions
  #DEFINE FUNCTION,GADGETX,LOADDLL,GET,GETLASTERROR,CALL,OR,AND,HIWORD,LOWORD,GETWIN,GETMSG,GETBMP,TOOLBAR,REBAR,SPACE,ADDROF,GetDesktopBMP,GETICO,MAKELONG,GETPRINTER,MAKEINTRESOURCE
  # VDS defined function
  #DEFINE FUNCTION,GETMENUPOS  
Else
  Warn This demo was designed to work with@CR()VDS 5.x from http://www.dialogscript.com
  Stop
End

# Add save.bmp as a BITMAP resource
#RESOURCE ADD,BITMAP,save.bmp,SAVBMP
# Add toolbar.bmp as a BITMAP resouce
#RESOURCE ADD,BITMAP,toolbar.bmp,TOOLBMP
# Add File Management.ico as a Icon resouce
#RESOURCE ADD,ICON,FileMan.ico,FILEICO

OPTION ERRORTRAP,ONERROR
OPTION DECIMALSEP,.
Title ThreeBars
:CONST
# For convience define the constants TRUE & FALSE
Define Constant,FALSE,0
Define Constant,TRUE,1

# Constants for the GetWindowLong API function
Define Constant,GWL_EXSTYLE,-20
Define Constant,GWL_STYLE,-16
Define Constant,GWL_WNDPROC,-4
Define Constant,GWL_HINSTANCE,-6
Define Constant,GWL_HWNDPARENT,-8
Define Constant,GWL_ID,-12
Define Constant,GWL_USERDATA,-21
Define Constant,DWL_DLGPROC,4
Define Constant,DWL_MSGRESULT,0
Define Constant,DWL_USER,8

# Constants for XP's Themes and color schemes
Define Constant,PGM_FIRST,$1400
Define Constant,CCM_FIRST,$2000
Define Constant,CCM_LAST,@Sum(@Get(CCM_FIRST),$200)
Define Constant,CCM_SETVERSION,@Sum(@Get(CCM_FIRST),$7)
Define Constant,CCM_GETVERSION,@Sum(@Get(CCM_FIRST),$8)
Define Constant,CCM_SETNOTIFYWINDOW,@Sum(@Get(CCM_FIRST),$9)
Define Constant,CCM_SETWINDOWTHEME,@Sum(@Get(CCM_FIRST),$B)
Define Constant,CCM_DPISCALE,@Sum(@Get(CCM_FIRST),$C)
Define Constant,INFOTIPSIZE,1024
Define Constant,CCM_SETBKCOLOR,@Sum(@Get(CCM_FIRST),1)
Define Constant,CCM_SETCOLORSCHEME,@Sum(@Get(CCM_FIRST),2)
Define Constant,CCM_GETCOLORSCHEME,@Sum(@Get(CCM_FIRST),3)
Define Constant,CCM_GETDROPTARGET,@Sum(@Get(CCM_FIRST),4)
Define Constant,CCM_SETUNICODEFORMAT,@Sum(@Get(CCM_FIRST),5)
Define Constant,CCM_GETUNICODEFORMAT,@Sum(@Get(CCM_FIRST),6)

# Constants for the comctl32.dll bitmap resource ID's
Define Constant,IDB_STD_LARGE_COLOR,1
Define Constant,IDB_STD_SMALL_COLOR,0
Define Constant,IDB_VIEW_LARGE_COLOR,5
Define Constant,IDB_VIEW_SMALL_COLOR,4
Define Constant,IDB_HIST_SMALL_COLOR,8
Define Constant,IDB_HIST_LARGE_COLOR,9
Define Constant,STD_COPY,1
Define Constant,STD_CUT,0
Define Constant,STD_DELETE,5
Define Constant,STD_FILENEW,6
Define Constant,STD_FILEOPEN,7
Define Constant,STD_FILESAVE,8
Define Constant,STD_FIND,12
Define Constant,STD_HELP,11
Define Constant,STD_PASTE,2
Define Constant,STD_PRINT,14
Define Constant,STD_PRINTPRE,9
Define Constant,STD_PROPERTIES,10
Define Constant,STD_REDOW,4
Define Constant,STD_REPLACE,13
Define Constant,STD_UNDO,3
Define Constant,VIEW_LARGEICONS,0
Define Constant,VIEW_SMALLICONS,1
Define Constant,VIEW_LIST,2
Define Constant,VIEW_DETAILS,3
Define Constant,VIEW_SORTNAME,4
Define Constant,VIEW_SORTSIZE,5
Define Constant,VIEW_SORTDATE,6
Define Constant,VIEW_SORTTYPE,7
Define Constant,VIEW_PARENTFOLDER,8
Define Constant,VIEW_NETCONNECT,9
Define Constant,VIEW_NETDISCONNECT,10
Define Constant,VIEW_NEWFOLDER,11
Define Constant,VIEW_VIEWMENU,12
Define Constant,HIST_BACK,0
Define Constant,HIST_FORWARD,1
Define Constant,HIST_FAVORITES,2
Define Constant,HIST_ADDTOFAVORITES,3
Define Constant,HIST_VIEWTREE,4

# Some constants for Window API message IDs to hook
Define Constant,WM_USER,1024
Define Constant,WM_COMMAND,273
Define Constant,WM_SYSCOMMAND,274
Define Constant,WM_NOTIFY,78
Define Constant,WM_PAINT,15
Define Constant,WM_SIZE,5
Define Constant,WM_SIZING,532
Define Constant,WM_WINDOWPOSCHANGED,71
Define Constant,WM_MOVE,3
Define Constant,WM_QUIT,18
Define Constant,WM_CLOSE,16
Define Constant,WM_ERASEBKGND,20
Define Constant,WM_CHAR,258
Define Constant,WM_LBUTTONDOWN,513
Define Constant,WM_LBUTTONUP,514
Define Constant,BN_PAINT,1

# I am not sure if this is the right value for the
# TTN_NEEDTEXT notification message?
Define Constant,TTN_NEEDTEXT,-520
# Define Constant,TTN_FIRST,-520
# Some window styles
Define Constant,WS_BORDER,8388608
Define Constant,WS_CHILD,60
# Some extended window styles
Define Constant,WS_EX_NOPARENTNOTIFY,4
Define Constant,WS_EX_CLIENTEDGE,512
Define Constant,WS_EX_STATICEDGE,131072
Define Constant,WS_EX_WINDOWEDGE,256
Define Constant,WS_EX_TRANSPARENT,32
Define Constant,WS_EX_OVERLAPPEDWINDOW,800
Define Constant,WS_EX_TOOLWINDOW,128

# Position Constant's for any common control like Toolbars, Statusbars, Rebars, and others.
Define Constant,CCS_BOTTOM,3
Define Constant,CCS_LEFT,100
Define Constant,CCS_VERT,100
Define Constant,CCS_TOP,1
Define Constant,CCS_RIGHT,@Or(CCS_VERT,CCS_BOTTOM)
Define Constant,CCS_NOPARENTALIGN,8
Define Constant,CCS_NORESIZE,4
Define Constant,CCS_ADJUSTABLE,32
Define Constant,CCS_NODIVIDER,64
Define Constant,DCX_CACHE,2
Define Constant,DCX_LOCKWINDOWUPDATE,$400

# Rebar styles
Define Constant,RBS_TOOLTIPS,$0100
Define Constant,RBS_VARHEIGHT,$0200
Define Constant,RBS_BANDBORDERS,$0400
Define Constant,RBS_FIXEDORDER,$0800
Define Constant,RBS_REGISTERDROP,1000
Define Constant,RBS_AUTOSIZE,$2000
Define Constant,RBS_VERTICALGRIPPER,$4000
Define Constant,RBS_DBLCLKTOGGLE,$8000

# Rebar flag for image list.  By default GadgetX loads an empty imagelist into it's REBAR element
Define Constant,RBIM_IMAGELIST,1

# Rebar Band flags
Define Constant,RBBIM_STYLE,1
Define Constant,RBBIM_COLORS,2
Define Constant,RBBIM_TEXT,4
Define Constant,RBBIM_IMAGE,8
Define Constant,RBBIM_CHILD,16
Define Constant,RBBIM_CHILDSIZE,32
Define Constant,RBBIM_SIZE,64
Define Constant,RBBIM_BACKGROUND,$80
Define Constant,RBBIM_ID,$100
Define Constant,RBBIM_IDEALSIZE,$200
Define Constant,RBBIM_LPARAM,$400
Define Constant,RBBIM_HEADERSIZE,$800

# Rebar Band Styles
Define Constant,RBBS_BREAK,1
Define Constant,RBBS_FIXEDSIZE,2
Define Constant,RBBS_CHILDEDGE,4
Define Constant,RBBS_HIDDEN,8
Define Constant,RBBS_NOVERT,16
Define Constant,RBBS_FIXEDBMP,32
Define Constant,RBBS_VARIABLEHEIGHT,$40
Define Constant,RBBS_GRIPPERALWAYS,$80
Define Constant,RBBS_NOGRIPPER,$100
Define Constant,RBBS_USECHEVRON,$200
Define Constant,RBBS_HIDETITLE,$400
Define Constant,RBBS_TOPALIGN,$0800

# Rebar Message API's to be used with @Sendmsg
Define Constant,RB_INSERTBANDA,@Sum(@Get(WM_USER),1)
Define Constant,RB_DELETEBAND,@Sum(@Get(WM_USER),2)
Define Constant,RB_GETBARINFO,@Sum(@Get(WM_USER),3)
Define Constant,RB_SETBARINFO,@Sum(@Get(WM_USER),4)
Define Constant,RB_GETBANDINFO,@Sum(@Get(WM_USER),5)
Define Constant,RB_SETBANDINFOA,@Sum(@Get(WM_USER),6)
Define Constant,RB_SETPARENT,@Sum(@Get(WM_USER),7)
Define Constant,RB_HITTEST,@Sum(@Get(WM_USER),8)
Define Constant,RB_GETRECT,@Sum(@Get(WM_USER),9)
Define Constant,RB_INSERTBANDW,@Sum(@Get(WM_USER),10)
Define Constant,RB_SETBANDINFOW,@Sum(@Get(WM_USER),11)
Define Constant,RB_GETBANDCOUNT,@Sum(@Get(WM_USER),12)
Define Constant,RB_GETROWCOUNT,@Sum(@Get(WM_USER),13)
Define Constant,RB_GETROWHEIGHT,@Sum(@Get(WM_USER),14)
Define Constant,RB_IDTOINDEX,@Sum(@Get(WM_USER),16)
Define Constant,RB_GETTOOLTIPS,@Sum(@Get(WM_USER),17)
Define Constant,RB_SETTOOLTIPS,@Sum(@Get(WM_USER),18)
Define Constant,RB_SETBKCOLOR,@Sum(@Get(WM_USER),19)
Define Constant,RB_GETBKCOLOR,@Sum(@Get(WM_USER),20)
Define Constant,RB_SETTEXTCOLOR,@Sum(@Get(WM_USER),21)
Define Constant,RB_GETTEXTCOLOR,@Sum(@Get(WM_USER),22)
Define Constant,RB_SIZETORECT,@Sum(@Get(WM_USER),23)
Define Constant,RB_BEGINDRAG,@Sum(@Get(WM_USER),24)
Define Constant,RB_ENDDRAG,@Sum(@Get(WM_USER),25)
Define Constant,RB_DRAGMOVE,@Sum(@Get(WM_USER),26)
Define Constant,RB_GETBARHEIGHT,@Sum(@Get(WM_USER),27)
Define Constant,RB_GETBANDINFOW,@Sum(@Get(WM_USER),28)
Define Constant,RB_GETBANDINFOA,@Sum(@Get(WM_USER),29)
Define Constant,RB_MINIMIZEBAND,@Sum(@Get(WM_USER),30)
Define Constant,RB_MAXIMIZEBAND,@Sum(@Get(WM_USER),31)
Define Constant,RB_GETBANDBORDERS,@Sum(@Get(WM_USER),34)
Define Constant,RB_SHOWBAND,@Sum(@Get(WM_USER),35)
Define Constant,RB_SETPALETTE,@Sum(@Get(WM_USER),37)
Define Constant,RB_GETPALETTE,@Sum(@Get(WM_USER),38)
Define Constant,RB_SETCOLORSCHEME,CCM_SETCOLORSCHEME
Define Constant,RB_GETCOLORSCHEME,CCM_GETCOLORSCHEME
Define Constant,RB_GETDROPTARGET,CCM_GETDROPTARGET
Define Constant,RB_SETUNICODEFORMAT,CCM_SETUNICODEFORMAT
Define Constant,RB_GETUNICODEFORMAT,CCM_GETUNICODEFORMAT
Define Constant,RB_GETBANDMARGINS,@Sum(@Get(WM_USER),40)
Define Constant,RB_SETWINDOWTHEME,CCM_SETWINDOWTHEME
Define Constant,RB_PUSHCHEVRON,@Sum(@Get(WM_USER),43)
Define Constant,RB_MOVEBAND,@Sum(@Get(WM_USER),39)

# For use with BitBlt/StretchBlt Raster Operation codes
Define Constant,SRCCOPY,13369376
Define Constant,DSTINVERT,5570569
Define Constant,WHITENESS,$FF0062

# The 2 Rop codes from Charles Petzold's book Programming Windows....
Define Constant,MAGIC_ROP1,12060490
Define Constant,MAGIC_ROP2,2229030
# To combine Rop codes just 'Or' them together like so
Define Constant,COPY_INVERT_MAGIC,@Or(SRCCOPY,DSTINVERT)

# For use with SetStretchMode Stretch color mode
Define Constant,COLORONCOLOR,3

# Some Constants for LoadImage
Define Constant,IMAGE_BITMAP,0
Define Constant,IMAGE_CURSOR,2
Define Constant,IMAGE_ICON,1

Define Constant,LR_DEFAULTCOLOR,0
Define Constant,LR_LOADREALSIZE,128
Define Constant,LR_MONOCHROME,1
Define Constant,LR_COPYRETURNORG,4
Define Constant,LR_COPYDELETEORG,8
Define Constant,LR_LOADFROMFILE,16
Define Constant,LR_LOADTRANSPARENT,32
Define Constant,LR_DEFAULTSIZE,64
Define Constant,LR_VGACOLOR,$80
Define Constant,LR_LOADMAP3DCOLORS,$1000
Define Constant,LR_CREATEDIBSECTION,$2000
Define Constant,LR_COPYFROMRESOURCE,$4000
Define Constant,LR_SHARED,$8000

# Toolbar API message IDs.
Define Constant,TB_SETPARENT,1061
Define Constant,TB_SETROWS,1063
Define Constant,TB_GETROWS,1064
Define Constant,TB_SETSTATE,1041
Define Constant,TB_PRESSBUTTON,1027
Define Constant,TB_CHECKBUTTON,1026
Define Constant,TB_GETTOOLTIPS,1059
Define Constant,TB_BUTTONCOUNT,1048
Define Constant,TB_ADDSTRINGA,1052
Define Constant,TB_ADDSTRINGW,1101
Define Constant,TB_AUTOSIZE,1057
Define Constant,TB_CUSTOMIZE,1051
Define Constant,TB_MAPACCELERATOR,@Sum(@Get(WM_USER),90)
Define Constant,TB_SETINSERTMARKCOLOR,@Sum(@Get(WM_USER),88)
Define Constant,TB_LOADIMAGES,@Sum(@Get(WM_USER),50)
Define Constant,TB_SETSTYLE,@Sum(@Get(WM_USER),56)
Define Constant,TB_SETMAXTEXTROWS,@Sum(@Get(WM_USER),60) 
Define Constant,TB_SETEXTENDEDSTYLE,@Sum(@Get(WM_USER),84)

# XP Theme and color scheme message API ID's for the toolbar
Define Constant,TB_SETCOLORSCHEME,CCM_SETCOLORSCHEME
Define Constant,TB_GETCOLORSCHEME,CCM_GETCOLORSCHEME
Define Constant,TB_GETDROPTARGET,CCM_GETDROPTARGET
Define Constant,TB_SETUNICODEFORMAT,CCM_SETUNICODEFORMAT
Define Constant,TB_GETUNICODEFORMAT,CCM_GETUNICODEFORMAT
Define Constant,TB_SETWINDOWTHEME,CCM_SETWINDOWTHEME

# Toolbar Styles
Define Constant,TBSTATE_ENABLED,4
Define Constant,TBSTATE_CHECKED,1
Define Constant,TBSTYLE_BUTTON,0
Define Constant,TBSTYLE_CHECK,2
Define Constant,TBSTYLE_GROUP,4
Define Constant,TBSTYLE_SEP,1
Define Constant,TBSTYLE_CHECKGROUP,6
Define Constant,TBSTYLE_TRANSPARENT,32768
Define Constant,TBSTYLE_FLAT,2048
Define Constant,TBSTYLE_LIST,4096
Define Constant,TBSTYLE_AUTOSIZE,16
Define Constant,TBSTYLE_WRAPABLE,512
Define Constant,TBSTYLE_DROPDOWN,8
Define Constant,TBSTYLE_TOOLTIPS,256

Define Constant,TBSTYLE_EX_DRAWDDARROWS,1
Define Constant,TBSTYLE_EX_MIXEDBUTTONS,$8
Define Constant,TBSTYLE_EX_HIDECLIPPEDBUTTONS,$10
Define Constant,TBSTYLE_EX_DOUBLEBUFFER,$80

Define Constant,BTNS_SHOWTEXT,$0040

# Some Win32 API Message ID's for the Status Bar
Define Constant,SB_SETTEXT,1025
Define Constant,SB_GETTEXT,1026
Define Constant,SB_GETTEXTLENGTH,1027
Define Constant,SB_GETPARTS,1030
Define Constant,SBT_NOBORDERS,256
Define Constant,SBT_POPOUT,512
Define Constant,SBT_RTLREADING,1024
Define Constant,SBT_NORMAL,0
Define Constant,SBT_OWNERDRAW,4096
Define Constant,SBT_PARTNUM,255

# Some Constants for the Menu's
Define Constant,MF_BYCOMMAND,0
Define Constant,MF_BYPOSITION,1024
Define Constant,MF_CHECKED,8
Define Constant,MF_UNCHECKED,0
Define Constant,MF_POPUP,16
Define Constant,MF_STRING,0

# Some Constants for the TrackPopupMenu api function
define Constant,TPM_CENTERALIGN,4
define Constant,TPM_LEFTALIGN,0
define Constant,TPM_RIGHTALIGN,8
define Constant,TPM_LEFTBUTTON,0
define Constant,TPM_RIGHTBUTTON,2
define Constant,TPM_HORIZONTAL,0
define Constant,TPM_VERTICAL,64
define Constant,TPM_TOPALIGN,0
define Constant,TPM_VCENTERALIGN,16
define Constant,TPM_BOTTOMALIGN,32
define Constant,TPM_NONOTIFY,128
define Constant,TPM_RETURNCMD,256
define Constant,TPM_RECURSE,1
define Constant,TPM_HORPOSANIMATION,$0400
define Constant,TPM_HORNEGANIMATION,$0800
define Constant,TPM_VERPOSANIMATION,$1000
define Constant,TPM_VERNEGANIMATION,$2000
define Constant,TPM_NOANIMATION,$4000

# DrawText Constants
define Constant,DT_BOTTOM,8
define Constant,DT_CALCRECT,1024
define Constant,DT_CENTER,1
define Constant,DT_EDITCONTROL,8192
define Constant,DT_END_ELLIPSIS,32768
define Constant,DT_PATH_ELLIPSIS,16384
define Constant,DT_EXPANDTABS,64
define Constant,DT_EXTERNALLEADING,512
define Constant,DT_LEFT,0
define Constant,DT_MODIFYSTRING,65536
define Constant,DT_NOCLIP,256
define Constant,DT_NOPREFIX,2048
define Constant,DT_RIGHT,2
define Constant,DT_RTLREADING,131072
define Constant,DT_SINGLELINE,32
define Constant,DT_TABSTOP,128
define Constant,DT_TOP,0
define Constant,DT_VCENTER,4
define Constant,DT_WORDBREAK,16
define Constant,DT_INTERNAL,4096
define Constant,DT_WORD_ELLIPSIS,$40000
define Constant,DT_NOFULLWIDTHCHARBREAK,$80000
define Constant,DT_HIDEPREFIX,$100000
define Constant,DT_PREFIXONLY,$200000


# These are for the GetSystemMetrics API function
# They get the size of the Menu's check box 
Define Constant,SM_CXMENUCHECK,71
Define Constant,SM_CYMENUCHECK,72

%%OpenChk = @Get(FALSE)
:DialogX	
  # This is just a signature splash screen
  DIALOG CREATE,Dialog X,-1,0,200,200,NOTITLE
    # Set window Mask to a prebuilt bmp file with transparent sections....
    DIALOG ADD,BITMAP,BITMAP2,0,0,168,124,#dragonfly-h100.bmp,,CLICK,HAND
    SetWin BackGround,ShapeToBMP,Dialog X,#DRAGONFL
  DIALOG SHOW
  WAIT 2

:LoadDLL	 
# Load the DLL's that we need	 
Define Variable,Handle,USER32
Define Variable,Handle,GDI32
Define Variable,Handle,kernel32
Set USER32,@LoadDll(user32.dll)
Set GDI32,@LoadDll(gdi32.dll)
Set kernel32,@LoadDLL(kernel32.dll)


:STRUCTURES
# Define the structures we will use later
Define Structure,msg,Handle|hwndfrom,DWORD|id,DWORD|WPARAM,DWORD|LPARAM
Define Structure,MIIM,DWORD|cbSize,DWORD|fMask,DWORD|fType,DWORD|fState,DWORD|wID,Handle|hSubMenu,Handle|hbmpChecked,Handle|hbmpUnchecked,DWORD|dwItemData,String|dwTypeData[256],DWORD|cch
Define Structure,pt,Integer|X,Integer|Y

:DLL_FUNCTIONS
# Define the API functions we will use later
Define Function,Handle,USER32,GetDC,GetDC,Handle|Hwnd
Define Function,Integer,USER32,MessageBox,MessageBox,Handle|Hwnd,String|Prompt,String|MyTitle,Long|Flag
Define Function,Integer,USER32,GetSystemMetrics,GetSystemMetrics,Integer|nIndex
Define Function,Handle,USER32,GetDesktopWindow,GetDesktopWindow,Pointer|Void
Define Function,Integer,USER32,LockWindowUpdate,LockWindowUpdate,Handle|Hwnd

Define Function,Handle,USER32,GetDCEx,getdcEx,Handle|Hwnd,Handle|Hrgn,DWORD|flags
Define Function,Handle,GDI32,CreateCompatibleDC,CreateCompatibleDC,Handle|HDC
Define Function,Integer,USER32,ReleaseDC,Releasedc,Handle|Hwnd,Handle|HDC
Define Function,Integer,GDI32,DeleteDC,Deletedc,Handle|HDC
Define Function,Integer,GDI32,StretchBlt,MyStretchBlt,Handle|hdcDest,Integer|nXOriginDest,Integer|nYOriginDest,Integer|nWidthDest,Integer|nHeightDest,Handle|hdcSrc,Integer|nXOriginSrc,Integer|nYOriginSrc,Integer|nWidthSrc,Integer|nHeightSrc,DWORD|dwRop
Define Function,Integer,GDI32,BitBlt,BitBlt,Handle|hdcDest,Integer|nXOriginDest,Integer|nYOriginDest,Integer|nWidthDest,Integer|nHeightDest,Handle|hdcSrc,Integer|nXOriginSrc,Integer|nYOriginSrc,DWORD|dwRop
Define Function,Handle,GDI32,CreateCompatibleBitmap,CreateCompatibleBitmap,Handle|HDC,Integer|nWidth,Integer|nHeight
Define Function,Handle,USER32,LoadImage,LoadImage,Handle|hinst,String|lpszName,DWORD|uType,Integer|cxDesired,Integer|cyDesired,DWORD|fuLoad
Define Function,Handle,USER32,LoadBitmap,LoadBitmap,Handle|hinst,String|lpszName
Define Function,Integer,GDI32,DeleteObject,DeleteObject,Handle|Hobj
Define Function,Handle,GDI32,SelectObject,SelectObject,Handle|HDC,Handle|Hobj
Define Function,Integer,USER32,ClientToScreen,ClientToScreen,Handle|Hwnd,Pointer|lpPoint
Define Function,Integer,USER32,ScreenToClient,ScreenToClient,Handle|Hwnd,Pointer|lpPoint
Define Function,Handle,USER32,SetParent,SetParent,Handle|hwndChild,Handle|hwndParent
Define Function,Handle,USER32,GetParent,GetParent,Handle|hwndChild
Define Function,Integer,USER32,DestroyWindow,DestroyWindow,Handle|hwnd

Define Function,Integer,USER32,DrawMenuBar,RedrawMenu,Handle|Hwnd
Define Function,Handle,USER32,GetMenu,GetMenu,Handle|Hwnd
Define Function,Integer,USER32,SetMenu,SetMenu,Handle|Hwnd,Handle|hMenu
Define Function,Handle,USER32,GetSubMenu,GetSubMenu,Handle|hMenu,Integer|nPos
Define Function,Handle,USER32,GetSystemMenu,GetSystemMenu,Handle|Hwnd,Integer|bRevert
Define Function,Integer,USER32,TrackPopupMenu,PopupMenu,Handle|hMenu,DWORD|uFlags,Integer|X,Integer|Y,Integer|nReserved,Handle|Hwnd,Pointer|prcRect
Define Function,Integer,USER32,SetMenuItemInfo,SetMenuItemInfo,Handle|hMenu,DWORD|uItem,Integer|fByPosition,Pointer|lpmii
Define Function,Integer,USER32,GetMenuItemInfo,GetMenuItemInfo,Handle|hMenu,DWORD|uItem,Integer|fByPosition,Pointer|lpmii
Define Function,Integer,USER32,SetMenuItemBitmaps,SetMenuItemBitmaps,Handle|hMenu,DWORD|uItem,DWORD|fuFlags,Handle|hbmUnchecked,Handle|hbmChecked
Define Function,Integer,USER32,ModifyMenu,MoveMenu,Handle|hMenu,DWORD|uPosition,DWORD|uFlags,Handle|uIDNewItem,String|pNewItem
Define Function,Integer,USER32,RemoveMenu,HideMenu,Handle|hMenu,DWORD|uItem,DWORD|fuFlags
Define Function,DWORD,USER32,CheckMenuItem,CheckMenuItem,Handle|hMenu,DWORD|uIDCheckItem,DWORD|uCheck
Define Function,Integer,USER32,CheckMenuRadioItem,CheckMenuRadioItem,Handle|hMenu,DWORD|idFirst,DWORD|idLast,DWORD|idCheck,DWORD|uFlags
Define Function,Handle,GDI32,CreateSolidBrush,CreateSolidBrush,DWORD|crColor
Define Function,HANDLE,USER32,GetWindowLong,GetWindowLong,Handle|Hwnd,Integer|nIndex
Define Function,Handle,kernel32,GetModuleHandle,GetModuleHandle,String|lpszFileName

:MAIN
  %%Main_hwnd = "#3BARS"
  DIALOG CREATE,ThreeBars,-1,0,336,480,CLASS 3BARS,CLICK,RESIZABLE,PAINT
# *** Modified by Dialog Designer on 01/01/2003 - 12:46 ***
	 DIALOG ADD,MENU,&File,O&pen,S&ave to Bitmap,-,Sub Menu,-,&Print,-,Customize Toolbar,-,&Quit
	 DIALOG ADD,MENU,&Image,I&nvert,Flip &Vertical,Flip &Horizontal
	 DIALOG ADD,COMBO,COMBO1,2,2,100,22,,,CLICK,EXIT	 
     DIALOG ADD,BITMAP,BITMAP1,100,0,336,370,,,CLICK
     DIALOG ADD,STATUS,STATUSBAR,This is a test
:REBAR
  # Add GadgetX'es Rebar control to your VDS dialog
  # GadgetX Add,ReBar,ReBar Name,VDS dialog Window Handle/ID/Class Name,Top,Left,Minimum ReBar Width,Minimum ReBar Height,ReBar Styles,Extended ReBar Styles
  Gadgetx Add,ReBar,RB,%%Main_hwnd,0,0,336,480,@OR(WS_BORDER,RBS_BANDBORDERS,RBS_VARHEIGHT,RBS_VERTICALGRIPPER)
  %%rb = @ReBar(Get,Handle,RB)
  If @SysInfo(THEMED)
     # If themes are turned on
     # turn them off for the rebar since we
     # will not be able to see the visual effect
     # of the background color changes for the rebar.
     SetWin Theme,%%rb
  End
  
:TOOLBAR
    # Add the improved GadgetX ToolBar element
    # Syntax:   
    # GadgetX Add,ToolBar,Toolbar Name,VDS dialog Window Handle/ID/Class Name,Top,Left,Minimum ToolBar Width,Minimum ToolBar Height,Toolbar Styles,Extended Toolbar Styles
    # Example:
	GadgetX Add,ToolBar,TB,RB,0,0,24,22,@Or(CCS_NOPARENTALIGN,CCS_NORESIZE,CCS_NODIVIDER,CCS_ADJUSTABLE,TBSTYLE_TRANSPARENT,TBSTYLE_FLAT,TBSTYLE_LIST,TBSTYLE_TOOLTIPS),TBSTYLE_EX_HIDECLIPPEDBUTTONS
    # You can get the Window handle/ID of the Toolbar with the command below
    %%tb = @ToolBar(Get,Handle,TB)

:TBBITMAP	
	# Ok I thought that the Toolbar command was too long so I seperated the bitmap part off to a command
	# This will give us more options because if we wanted to use an imagelist instead of this next
	# command we will be able to now.  Also we can turn transparent on and off for the bitmap that is
	# being loaded by using the style LR_LOADTRANSPARENT = 32 as the last parameter.
	# This only loads one bmp file per toolbar but you can place multiple images in the bmp
	# file to make a mapped bitmap.  Take a look at the toolbar.bmp in a Graphics program to see what 
    # I mean.
    # It is now possible to add a bitmap resource to your Exe and use the resouce ID/name.
	# Also the this command can use the bitmaps that are resources of the common control
	# DLL comctl32.dll.  This way you will not need to distribute a bitmap with your script for common
    # tools like the SAVE, OPEN, and View.
    # Syntax:
    # GadgetX Add,TBBitmap,Toolbar Name,Bitmap FileName or Resouce ID,Number of Bitmaps,Width|Height of a single image in the bitmap,Image Styles
	GadgetX Add,TBBitmap,TB,"#TOOLBMP",9,16,15,@Or(LR_LOADMAP3DCOLORS,LR_LOADTRANSPARENT)
    
:TBBUTTONS
	 # Now we will add our buttons to the toolbar
	 # Syntax:
     # GadgetX Add,TBSeperator,Seperator Name,Toolbar Name,Width
     # GadgetX Add,TBButton,Button Name,ToolBar Name,Button Text,Bitmap Index,button Hint,Button Styles
     # Example:
     GadgetX Add,TBButton,Save,TB,&Save,8,Click to Save,@Or(TBSTYLE_AUTOSIZE,TBSTYLE_BUTTON,TBSTYLE_FLAT,TBSTYLE_LIST)
     # Set a hotkey for the button
     HOTKEY ADD,SAVEMENU,ALT+S
     # Button ID
     %%SaveID = @ToolBar(Get,Handle,Save)
     
     # A vertical seperator bar
     GadgetX Add,TBSeperator,SEP2,TB,0
     # Next button to add
     GadgetX Add,TBButton,Open,TB,&Open,7,Click to Open,@Or(TBSTYLE_AUTOSIZE,TBSTYLE_BUTTON,TBSTYLE_FLAT,TBSTYLE_LIST)
     # Set a hotkey for the button
     HOTKEY ADD,OPENMENU,ALT+O
     # Button ID 
     %%OpenID = @ToolBar(Get,Handle,Open)
   
:MENUS	 
  # Ok we are going to play with our menus

	 # We first need to get all the handles to all of the menus that we
	 # have on our Dialog
	 # Get the Handle to the Menu bar itself
	 %%mnu_hwnd = @Call(GetMenu,%%Main_hwnd)
	 # Get the Handle to the system menu
	 %%sysmnu_hwnd = @Call(GetSystemMenu,%%Main_hwnd, 0)	 
	 # Get the Handle to the First sub menu which is called 'File'
	 %%filemnu_hwnd = @Call(GetSubMenu,%%mnu_hwnd,0)
	 # Get the Handle to the second sub menu which is called 'Sub Menu'
	 %%submenu_hwnd = @Call(GetSubMenu,%%mnu_hwnd,1)
     
	 # We have to set several flags to load a image from a file.
	 # Since we only need to load this image for the menu we are
	 # only going to talk about the flags needed just for that.
	 # We first need to tell LoadImage the name of the file
	 # Then we need to tell it what type of file to load in this case a bitmap
	 # so lets set it to IMAGE_BITMAP = 0
	 # next we need to set the desired size of our image.  Since this bitmap
	 # is going into the checkmark section of our menu item we will
	 # use the system default size of that area.  We can retrieve this area
	 # using the GetSystemMetrics API function and passing it the value of
	 # SM_CXMENUCHECK = 71
	 # SM_CYMENUCHECK = 72
	 # next we need to set uFlags to tell LoadImage that we are
	 # going to load the image from a file
	 # LR_LOADFROMFILE = 16
	 # LR_CREATEDIBSECTION = 8192
	 # Ok once you are done with the Image or your program closes Delete the bitmap
	 # using DeleteObject API function
     # This example is using the bitmap resource added above
     # Use the GetModuleHandle API function to get a Instance handle for this process
	 %%Hinst = @Call(GetModuleHandle,NULL)
     # Load the resouce image with the LoadImage API function
	 %%MenuBMP = @Call(LoadImage,%%Hinst,SAVBMP,IMAGE_BITMAP,@Call(GetSystemMetrics,SM_CXMENUCHECK),@Call(GetSystemMetrics,SM_CYMENUCHECK),@Or(LR_LOADTRANSPARENT,LR_CREATEDIBSECTION))
     # I have not figured this out yet but for some reason the LoadImage API function sets a System error
     # complaining about an invalid Handle. What is strange is the fact that it still returns the 
     # Bitmap's handle and finds the resource name requested?
     # So we will just have to clear this error from the GadgetX error queue.
     WHILE @GetLastError()
     WEND
	 # If you want you can load seperate bitmaps for the checked and unchecked states but we just want one bitmap
	 # for this example.
	 # MF_BYPOSITION = 1024
	 %%Ret = @Call(SetMenuItemBitmaps,%%filemnu_hwnd,1,MF_BYPOSITION,%%MenuBMP,%%MenuBMP)
	 # Now we will tell our window to redraw the Menu bar.
	 %%Ret = @Call(RedrawMenu,%%Main_hwnd)
     WHILE @GetLastError()
     WEND
     
     #%A = @GetLastError()
	 # Now we are going to move our Sub Menu under the Sub Menu item in the file menu
     # renaming the menu item to '&Image Menu' in the process of moving the item
	 # First we need some flags
	 # MF_BYPOSITION = 1024 + MF_POPUP = 16 + MF_STRING = 0
	 %%Ret = @Call(MoveMenu,%%filemnu_hwnd,3,@Or(MF_BYPOSITION,MF_POPUP,MF_STRING),%%submenu_hwnd,&&Image Menu)
	 # Ok we want to hide our Sub Menu from the top level menu bar
	 # First we need the value of a flag
	 # MF_BYPOSITION = 1024
	 %%Ret = @Call(HideMenu,%%mnu_hwnd,1,MF_BYPOSITION)
     # Now hide the VDS menu bar completly by hiding the first sub-menu
	 %%Ret = @Call(HideMenu,%%mnu_hwnd,0,MF_BYPOSITION)
	 # Now we will tell VDS to redraw the Menu bar as hidden.
	 %%Ret = @Call(RedrawMenu,%%Main_hwnd)	
     WHILE @GetLastError()
     WEND
     # add a Toolbar to replace the VDS menu bar
     GadgetX Add,ToolBar,MenuTB,RB,0,0,18,18,@Or(CCS_NOPARENTALIGN,CCS_NORESIZE,CCS_NODIVIDER,CCS_ADJUSTABLE,TBSTYLE_FLAT,TBSTYLE_LIST,TBSTYLE_TRANSPARENT,TBSTYLE_TOOLTIPS),0
     # Get the handle of the new Menu ToolBar
	 %%MenuTB = @ToolBar(Get,Handle,MenuTB)
	 # Get the button text padding from the Menu ToolBar
     Parse "%%HPadding;%%VPadding",@Toolbar(Get,TextPadding,MenuTB)
     # Using the current padding values set the new padding values
     Toolbar Set,TextPadding,MenuTB,@Diff(%%HPadding,2),@Diff(%%VPadding,4)
     If @SysInfo(THEMED)
       # If themes are turned on
       # turn them off for this toolbar since we
       # will not be able to see the visual effect
       # of the background color changes and buttons 
       # for the menu toolbar.
       SetWin Theme,%%MenuTB
     End
	 
     # add a button for each top level VDS menu item
     # this example only has 1 top level sub menu that we want to use
     GadgetX Add,TBButton,File,MenuTB,"  &File",,File Menu,@Or(TBSTYLE_AUTOSIZE,TBSTYLE_BUTTON,TBSTYLE_FLAT,TBSTYLE_LIST,TBSTYLE_TRANSPARENT,TBSTYLE_DROPDOWN)
     # set a hotkey for the menu items that need it.
     HOTKEY ADD,FILECLICK,ALT+F
     # Get the button id
     %%FileID = @ToolBar(Get,Handle,File)
	 
:REBARBANDS	 
    # Now we will add bands to the GadgetX Rebar element
    # GadgetX Add,RBBand parameter information
    # Syntax: 
    # GadgetX Add,RBBand,Name of Band,Name of Rebar,Window ID of element to add,Band Text,Band Mask,Band Styles,Minimum Child Width,Minimum Child Height,Length of the band,Initial Height of the band,Maximum height of the band,grow/shrink Step value,Ideal width,Foreground Color,Background Color
    # Parameter discriptions:
    # Name of Band:                The element name you want to give to the band.
    # Name of Rebar:               The element name you gave to the Rebar element when you created it.
    # Window ID of control to add: The VDS element Window ID, Class Name, or GadgetX TOOLBAR Name that 
    #                              you want to add to a band.
    # Band Text:                   The text that shows up infront of the control or element your adding.
    #                              Setting text is optional.
    # Band Mask:                   Flags that indicate which parameters of this command are valid or must be filled.
    # Band Style:                  Flags that indicate the style of band you are creating.
    # Minimum Child Width:         Minimum width of the child window, in pixels. The band can't be sized smaller than this value
    #                              plus the length of the text in pixels
    # Minimum Child Height:        Minimum height of the child window, in pixels. The band can't be sized smaller than this value.
    # Length of the band:          Length of the band, in pixels.
    # Initial Height of the band:  comctl32.dll Version 4.71+. Initial height of the band, in pixels.
    # Maximum height of the band:  comctl32.dll Version 4.71+. Maximum height of the band, in pixels.
    # grow/shrink Step value:      comctl32.dll Version 4.71+. Step value by which the band can grow or shrink, in pixels.
    #                              If the band is resized, it will be resized in steps specified by this value.
    # Ideal width:                 comctl32.dll Version 4.71+. Ideal width of the band, in pixels.
    # Foreground Color:            A hex value for the bands foreground color.
    # Background Color:            A hex value for the bands background color.
    
    # Example:
    # Since this band will host our Menu ToolBar we need to know the current button size   
    Parse "%%MenuTBBtnW;%%MenuTBBtnH",@ToolBar(Get,SIZEOFBTNS,MenuTB)
    # Add the Menu ToolBar to the Rebar Element and create a band for it.
	GadgetX Add,RBBand,MenuBand,RB,MenuTB,,RBBIM_COLORS,@Or(RBBS_VARIABLEHEIGHT,RBBS_GRIPPERALWAYS),%%MenuTBBtnW,%%MenuTBBtnH,%%MenuTBBtnH,,,,,BLACK,WHITE
    # Get the ID of the MenuBand
	%%TBBandID = @Rebar(Get,Handle,MenuBand)
    # Since this band will host our regular ToolBar we need to know the current button size       
    Parse "%%TBBtnW;%%TBBtnH",@ToolBar(Get,SIZEOFBTNS,TB)
    # Add the regular ToolBar to the Rebar Element and create a band for it.    
	GadgetX Add,RBBand,TBBand,RB,TB,GadgetX ToolBar:,RBBIM_TEXT,@Or(RBBS_VARIABLEHEIGHT,RBBS_GRIPPERALWAYS),%%TBBtnW,%%TBBtnH,0
    # Get the ID of the Toolbar band
	%%TBBandID = @Rebar(Get,Handle,TBBand)
    # Add the VDS combobox element to the rebar element and create a band for it.
    # note if you do not set any of the size parameters the GadgetX rebar element will automaticly use
    # the client cordinates of the control that is placed on the band.  The only exception to this
    # is with the GadgetX toolbar element since it's size and location is dependent upon the parent that
    # is hosting it.
    GadgetX Add,RBBand,Combo1Band,RB,@winexists(~COMBO1),VDS ComboBox:,RBBIM_TEXT,@Or(RBBS_VARIABLEHEIGHT,RBBS_GRIPPERALWAYS,RBBS_BREAK)
    # Get the ID of the Combo1Band
	%%Combo1BandID = @Rebar(Get,Handle,Combo1Band)    
:STATUSBAR
	 # Here is how to make a multi panel Status Bar.
	 # notice how we tell it how many panels we want and there
	 # sizes.  Also note that for the last panel we use the full
	 # width of the dialog.  This is very important...
    # Get the window handle to the statusbar
    %%Status_hwnd = @Winexists(~STATUSBAR)
    %%dlgWidth = @dlgpos(,W)
    If @SysInfo(THEMED)
     # If themes are turned on
     # turn them off for the statusbar since we
     # will not be able to see the visual effect
     # of a poped out panel when themes are on.
     SetWin Theme,%%Status_hwnd
    End

     StatusBar SetParts,%%Status_hwnd,3,65|65|@Sum(%%dlgWidth,1)
	 # Ok now that we have a multi panel Status Bar how do we get text
	 # to show up in each of the panels...Simple we Send the Status bar
	 # a message using @Sendmsg and SB_SETTEXT.... The WPARAM of the message
	 # has both the zero based panel number and a format type.  The LPARAM is
	 # the text we want to put in the specified panel.
     %V = 0
  %%Setstat = @Sendmsg(%%Status_hwnd,@Get(SB_SETTEXT),@Or(0,SBT_NORMAL),@Addr("%V"))
	 # Notice here I am going to make the middle panel show as poped out like a
	 # button....
	 # %%WPARAM = @Or(1,@Gadget(SBT_POPOUT))
     %V = 100
  %%Setstat = @Sendmsg(%%Status_hwnd,@Get(SB_SETTEXT),@Or(1,SBT_POPOUT),@Addr("%V"))
	 # %%WPARAM = @Or(2,@Gadget(SBT_NORMAL))
     %V = 200
  %%Setstat = @Sendmsg(%%Status_hwnd,@Get(SB_SETTEXT),@Or(2,SBT_NORMAL),@Addr("%V"))
	 # Ok that is all well and good but how do we get the text from each panel?
	 # Take a look in the Toolbar section when we assign the combo box to the ToolBar
:COMBOBOX     
	 # lets add some Items to our combo box.  Notice that nothing has changed
	 # for the COMBO box.  You can access it the same as any VDS combo box element.
	 # But we are going to add a twist to this and pull the text from our Multi-panel
	 # StatusBar using @Sendmsg() and the ID for SB_GETTEXT 
	 # along with the panel number in the WPARAM and use the @AddrOf()
	 # function to get the memory address of the StringBuf string variable to pass 
     # to the SB_GETTEXT API message....
   # Define the StringBuf string variable  
   Define Variable,String,StringBuf
   # Initialize the StringBuf variable with spaces to hold the text
   Set StringBuf,@Space(256)
   # Send the SB_GETTEXT message and add the string from each panel to the combobox element
   %%ret = @Sendmsg(@Winexists(~STATUSBAR),@Get(SB_GETTEXT),0,@AddrOf(StringBuf))
   List Add,COMBO1,@Get(StringBuf)
   List Add,COMBO1,50
   %%ret = @Sendmsg(@Winexists(~STATUSBAR),@Get(SB_GETTEXT),1,@AddrOf(StringBuf))
   List Add,COMBO1,@Get(StringBuf)
   List Add,COMBO1,150
   %%ret = @Sendmsg(@Winexists(~STATUSBAR),@Get(SB_GETTEXT),2,@AddrOf(StringBuf))
   List Add,COMBO1,@Get(StringBuf)
   List Add,COMBO1,250
   List Seek,COMBO1,@Pred(@COUNT(COMBO1))
:SkipRest
   
# Hide the splash screen
DIALOG SELECT,0	 
DIALOG HIDE
# Show our main dialog
DIALOG SELECT,1
DIALOG SHOW	 
     

:INITICON  
	 # Load our icon....
	 # we need to load it in a place we have not painted anything yet or
	 # we will get what ever is on our dialog because Icons can have transparent sections
     # Ok we are going to make a backup copy of the BITMAP1 VDS element on our dialog
     # Since it is blank this is by far the easiest way to do this:-)  That way we can
     # blank out our bitmap anytime we need too.
     Set pt.X,@dlgpos(BITMAP1,L)
     Set pt.Y,@dlgpos(BITMAP1,T)
     %%Ret = @Call(ClientToScreen,%%Main_hwnd,@AddrOf(pt))
     while @GetLastError()
     wend
     %%ctrlT = @Get(pt.Y)
     %%ctrlL = @Get(pt.X)
     %%ctrlR = @Sum(%%ctrlL,@dlgpos(BITMAP1,W))
     %%ctrlB = @Sum(%%ctrlT,@dlgpos(BITMAP1,H))
     %%BMP = @GetDesktopBMP(%%ctrlT,%%ctrlL,%%ctrlR,%%ctrlB)
     if %%BMP
       SaveBmp %%BMP,@WINDIR(T)\blank.bmp
       DelDesktopBmp %%BMP
       %%BMP =
     End
     # Now lets grab the Device context of the VDS dialog
	 # %%Hdc = @Call(GetDC,%%Main_hwnd)
     %%Hdc = @GetWin(HDC,%%Main_hwnd)
     # It is now possible to use ICON resources from the Exe
     %%IconFile = #FILEICO
     # Now lets load the icon into memory
	 PARSE "%%HIcon;%%Hdcico;%%icow;%%icoh",@Getico(%%Hdc,%%IconFile,%%ctrlT|%%ctrlL)
     # Stretch the Icon across the BITMAP1 control using the StretchBlt API function
     # Note: I am using the Alias that I defined above in the DLL_FUNCTIONS section
	 %%Ret = @Call(MyStretchBlt,%%Hdc,@dlgpos(BITMAP1,L),@dlgpos(BITMAP1,T),@dlgpos(BITMAP1,W),@dlgpos(BITMAP1,H),%%Hdcico,0,0,%%icow,%%icoh,SRCCOPY)
     # Delete the Icon Device Context since we are done with it.
     #%%Hdcico = @Call(Deletedc,%%Hdcico)
     SetWin HDC,Deleted,%%Hdcico
     %%Hdcico =
     
     # Delete the Icon handle
     DelIco %%HIcon
     %%HIcon =
     # Release the VDS dialog device context
	 # %%Hdc = @Call(ReleaseDC,%%Main_hwnd,%%Hdc)
     SetWin HDC,Released,%%Main_hwnd,%%Hdc
     # Save a snapshot of the new stretched icon that is displayed to a temp bitmap
     %%BMP = @GetDesktopBMP(%%ctrlT,%%ctrlL,%%ctrlR,%%ctrlB)
     if %%BMP
       File Delete,@WINDIR(T)\temp.bmp
       SaveBmp %%BMP,@WINDIR(T)\temp.bmp
       DelDesktopBmp %%BMP
       %%BMP =
     End
     # Load the temp.bmp into the bitmap element and let VDS handle the repainting
     Dialog Set,BITMAP1,@WINDIR(T)\temp.bmp
# Goto SkipRotate
:SEMIROTATE
  # This is just a joke and can be skipped.
  # I just wanted to show just want is possible with common GDI API functions.
%%cnt = 0
%%cnt2 = 10
Repeat
  # A cheap bitmap rotation routine.  It will flip the bitmap
  # vertically and the horizontally giving the effect that the
  # bitmap is rotating but in reality it is not it is just flipping out ;)
  Gosub FLIPVERT
  Gosub FLIPHORZ
  %%cnt = @Succ(%%cnt)
Until @Equal(%%cnt,%%cnt2)
Dialog TITLE,"***HICCUP***"
Wait 2
# Using a similar technic above we will do the same with the desktop
# window.
# First lock the desktop window
# if @Equal(@Call(LockWindowUpdate,@Call(GetDesktopWindow)),@Get(TRUE))
SetWin Lock,ON,@Call(GetDesktopWindow)
If @Ok()
  # Once it is locked flip the desktop vertically
  Gosub FLIPSCREENVERT
  WAIT 2
  # Now flip it back
  Gosub FLIPSCREENVERT
  # unlock the desktop
  #%%Ret = @Call(LockWindowUpdate)
  SetWin Lock,OFF
End
Dialog TITLE,ThreeBars
Info Oh! Excuse me@CR()I lost it for a min.@CR()I'm much better now.

%%OldPos =

:SkipRotate
:Evloop
  wait event,0.003
  %E = @event()
  If %E
    %%Setstat = @Sendmsg(%%Status_hwnd,@Get(SB_SETTEXT),@Or(0,SBT_NORMAL),%E)
    Goto %E
  End
goto Evloop
:HOTKEY
  # Use the GadgetX FireEvent command to execute the Hotkey return
  FireEvent @Hotkey()
goto Evloop
:TIMER
  %%NewPos = @dlgpos(,TLWH)
  If @UnEqual(%%OldPos,%%NewPos)
    # VDS does not send a PAINT event if the window has moved
    # Re-paint the window if it's position has changed.
    SetWin Background,Update,%%Main_hwnd
    # This must go in the Paint event to achieve the translucent window
    SetWin Background,Translucent,%%Main_hwnd,@dlgtext(COMBO1),RED,CLIENT
    %%OldPos = @dlgpos(,TLWH)
  End
goto Evloop	 

:PAINT
:RESIZE
     # resize the GadgetX rebar element so it stretches with
     # the VDS dialog
     %%BarHeight = @SendMsg(%%rb,@Get(RB_GETBARHEIGHT),0,0)
     Window Position,%%rb,0,0,@dlgpos(,W),%%BarHeight
     # Clear the window.
     SetWin Background,Update,%%Main_hwnd
     # This must go in the Paint event to achieve the translucent window
     SetWin Background,Translucent,%%Main_hwnd,@dlgtext(COMBO1),RED,CLIENT
     While @event()
       # Clear extra paint events
     Wend
Goto Evloop

:FILECLICK
:FILEMENU
    # The @GETMENUPOS function uses the GadgetX @ToolBar(Get,Pos
    # function to return only the left and bottom cordinates of the tool bar button
    parse "%X;%Y",@GETMENUPOS(MenuTB,File) 
    # Hold the File button down while we show our sub menu
    ToolBar Check,MenuTB,File
    # Popup the File sub menu just below our toolbar button
    %%Ret = @Call(PopupMenu,%%filemnu_hwnd,@Or(TPM_LEFTALIGN,TPM_LEFTBUTTON,TPM_VERTICAL,TPM_VERPOSANIMATION),%X,%Y,0,%%Main_hwnd,NULL)
    # When the user is done with the menu release the button
    ToolBar UnCheck,MenuTB,File
    
Goto Evloop
:PRINTMENU
  # I have wanted this command from day one that I started using VDS.
  # This command allows you to send a picture of the VDS dialog or a VDS element to
  # your default printer.  This command is similar to the VisualBasic PrintWindow function.
  PrintDialog ThreeBars,ThreeBars,@dlgpos(BITMAP1,T),@dlgpos(BITMAP1,L),@dlgpos(BITMAP1,W),@dlgpos(BITMAP1,H)
Goto Evloop
:CLICK	
 If @EQUAL(@CLICK(B),RIGHT) 
    # Here we show a popup menu which is just the File menu moved to
    # a context menu.
    %%Ret = @Call(PopupMenu,%%filemnu_hwnd,@Or(TPM_LEFTALIGN,TPM_LEFTBUTTON,TPM_VERTICAL,TPM_VERPOSANIMATION),@Mousepos(X),@Mousepos(Y),0,%%Main_hwnd,NULL)
 End
Goto Evloop

:CUSTOMIZE TOOLBARMENU
  # The GadgetX toolbar element is user customizable.
  # The user can click or double click the toolbar to bring up a
  # dialog for adding and removing tools from the toolbar.
  # Here we initiate the customize dialog by sending our regular toolbar
  # the TB_CUSTOMIZE message API
  %A = @SendMsg(%%tb,@Get(TB_CUSTOMIZE),0,0)
Goto Evloop
:COMBO1CLICK
  # If you click an item in the Combo box that is now on the toolbar.
  # Info You selected @Item(COMBO1)
  FireEvent PAINT
Goto Evloop

:COMBO1EXIT
  FireEvent PAINT
  # Info You left the combo box
Goto Evloop

:BITMAP1CLICK
:Showpopup
  If @EQUAL(@CLICK(B),RIGHT) 
    # Here we show a popup menu which is just the File menu moved to
    # a context menu.
    %%Ret = @Call(PopupMenu,%%filemnu_hwnd,@Or(TPM_LEFTALIGN,TPM_LEFTBUTTON,TPM_VERTICAL,TPM_VERPOSANIMATION),@Mousepos(X),@Mousepos(Y),0,%%Main_hwnd,NULL)
  End
Goto Evloop
:OPENCLICK
:OPENMENU
  # Just as a demo we are going to set a checkmark for our Open menu
  # item using the CheckMenuItem.
  # The uChecked parameter can be
  # MF_BYCOMMAND = 0 or MF_BYPOSITION = 1024
  # and
  # MF_CHECKED = 8 or MF_UNCHECKED = 0
  # So if we want to specify the Menu Item by it's position and place
  # a check mark by the item we would do this.
  # %%Ret = @Gadget(CheckMenuItem,%%filemnu_hwnd,0,@Sum(1024,8))
  # So if we want to specify the Menu Item by it's position and remove
  # the check mark by the item we would do this.
  # %%Ret = @Gadget(CheckMenuItem,%%filemnu_hwnd,0,@Sum(1024,0))
  # So now lets make it think for itself and check and uncheck the item on it's
  # own based on it's previous setting using the return value.
  If @Equal(%%OpenChk,@Get(TRUE))
    # The Item must be checked so lets uncheck it
    %%Ret = @Call(CheckMenuItem,%%filemnu_hwnd,0,@Or(MF_BYPOSITION,MF_UNCHECKED))
	%%OpenChk = @Get(FALSE)
  Else
    If @Equal(%%OpenChk,@Get(FALSE))
      # The item must be unchecked so lets check it
      %%Ret = @Call(CheckMenuItem,%%filemnu_hwnd,0,@Or(MF_BYPOSITION,MF_CHECKED))
	  %%OpenChk = @Get(TRUE)
    End
  End
  %F = @filedlg("Icon file (*.ico)|*.ico|Bitmap file *.bmp *.dib|*.bmp;*.dib",Open)
  If %F
    Dialog set,BITMAP1,@windir(T)\blank.bmp
    If @Equal(@ext(%F),ico)
      Set pt.X,@dlgpos(BITMAP1,L)
      Set pt.Y,@dlgpos(BITMAP1,T)
      
      %%Ret = @Call(ClientToScreen,%%Main_hwnd,@AddrOf(pt))
      # %A = @GetLastError()
      while @getlasterror()
      wend
      %%ctrlT = @Get(pt.Y)
      %%ctrlL = @Get(pt.X)
      %%ctrlR = @Sum(%%ctrlL,@dlgpos(BITMAP1,W))
      %%ctrlB = @Sum(%%ctrlT,@dlgpos(BITMAP1,H))
	  #%%Hdc = @Call(GetDC,%%Main_hwnd)	
      %%Hdc = @GetWin(HDC,%%Main_hwnd)
	  PARSE "%%HIcon;%%Hdcico;%%icow;%%icoh", @Getico(%%Hdc,%F,%%ctrlT|%%ctrlL)
      If %%HIcon
	    %%Ret = @Call(MyStretchBlt,%%Hdc,@dlgpos(BITMAP1,L),@dlgpos(BITMAP1,T),@dlgpos(BITMAP1,W),@dlgpos(BITMAP1,H),%%Hdcico,0,0,%%icow,%%icoh,SRCCOPY)
        DelIco %%HIcon
        %%HIcon =
        #%%Hdcico = @Call(Deletedc,%%Hdcico)	
        SetWin HDC,Deleted,%%Hdcico
	    #%%Hdc = @Call(ReleaseDC,%%Main_hwnd,%%Hdc)
        SetWin HDC,Released,%%Main_hwnd,%%Hdc
      
      %%BMP = @GetDesktopBMP(%%ctrlT,%%ctrlL,%%ctrlR,%%ctrlB)
      if %%BMP
        File Delete,@WINDIR(T)\temp.bmp      
        SaveBmp %%BMP,@WINDIR(T)\temp.bmp
        DelDesktopBmp %%BMP
        %%BMP =
      End
      Else
        Warn The file is not a Icon file@CR()or your file is corupted.
      End
      Dialog Set,BITMAP1,@WINDIR(T)\temp.bmp
    ElsIf @Equal(@ext(%F),bmp)@Equal(@ext(%F),dib)
      DIALOG SET,BITMAP1,%F
      wait
      Set pt.X,@dlgpos(BITMAP1,L)
      Set pt.Y,@dlgpos(BITMAP1,T)
      %%Ret = @Call(ClientToScreen,%%Main_hwnd,@AddrOf(pt))
      # %A = @GetLastError()
      while @GetLastError()
      wend
      %%ctrlT = @Get(pt.Y)
      %%ctrlL = @Get(pt.X)
      %%ctrlR = @Sum(%%ctrlL,@dlgpos(BITMAP1,W))
      %%ctrlB = @Sum(%%ctrlT,@dlgpos(BITMAP1,H))
      %%BMP = @GetDesktopBMP(%%ctrlT,%%ctrlL,%%ctrlR,%%ctrlB)
      if %%BMP
        SaveBmp %%BMP,@WINDIR(T)\temp.bmp
        DelDesktopBmp %%BMP
        %%BMP =
      End
    End
  End
  %%BMP =
  %%HDC =
  
Goto Evloop
:SEP1MOVED
goto evloop
:SEP2MOVED
goto evloop
:SAVEMOVED
 Info @ToolBar(Get,Index,TB,Save)
 #if @Not(@Equal(%%OldSaveIDX,@ToolBar(Get,Index,TB,Save))) 
   #if @ToolBar(Get,Index,TB,Save)
   #  ToolBar Remove,TB,Save
   #End
   #ToolBar Insert,Button,TB,Save,"&Save",2,%%OldSaveIDX,Click to Save,@Or(TBSTYLE_AUTOSIZE,TBSTYLE_BUTTON)
   #%%SaveID = @ToolBar(Get,Handle,TB,Save)
 #End
Goto Evloop
:OPENMOVED
 Info @ToolBar(Get,Index,TB,Open)@CR()
 #if @Not(@Equal(%%OldOpenIDX,@ToolBar(Get,Index,TB,Open))) 
   
   #if @ToolBar(Get,Index,TB,Open)
   #  ToolBar Remove,TB,Open
   #End
   #ToolBar Insert,Button,TB,Open,"&Open",1,%%OldOpenIDX,Click to Open,@Or(TBSTYLE_AUTOSIZE,TBSTYLE_DROPDOWN,TBSTYLE_CHECK)
   #%%OpenID = @ToolBar(Get,Handle,TB,Open)
 #End
Goto Evloop

:SAVECLICK
:SAVEMENU
:SAVE TO BITMAPMENU
  %F = @filedlg("Bitmap file *.bmp *.dib|*.bmp;*.dib",Save Bitmap,,SAVE)
  If @Greater(@Len(%F),1)
    Set pt.X,@dlgpos(BITMAP1,L)
    Set pt.Y,@dlgpos(BITMAP1,T)
    %%Ret = @Call(ClientToScreen,%%Main_hwnd,@AddrOf(pt))
    #%A = @GetLastError()
    while @GetLastError()
    wend
    %%ctrlT = @Get(pt.Y)
    %%ctrlL = @Get(pt.X)
    %%ctrlR = @Sum(%%ctrlL,@dlgpos(BITMAP1,W))
    %%ctrlB = @Sum(%%ctrlT,@dlgpos(BITMAP1,H))
    %%BMP = @GetDesktopBMP(%%ctrlT,%%ctrlL,%%ctrlR,%%ctrlB)
    If %%BMP
      SaveBmp %%BMP,%F
      DelDesktopBmp %%BMP
      %%BMP =
    End
  End
  %%IconFile = %F
  DIALOG SET,BITMAP1,%F
Goto Evloop
:INVERTMENU
  # Ok we are going to make these items Radio checked
  # Like all of the examples in this file we set the uFlags parameter
  # to 1024 for MF_BYPOSITION = 1024
  %%Ret = @Call(CheckMenuRadioItem,%%submenu_hwnd,0,2,0,MF_BYPOSITION)
  GoSub INVERT
  Set pt.X,@dlgpos(BITMAP1,L)
  Set pt.Y,@dlgpos(BITMAP1,T)
  %%Ret = @Call(ClientToScreen,%%Main_hwnd,@AddrOf(pt))
  #%A = @GetLastError()
  while @GetLastError()
  wend
  %%ctrlT = @Get(pt.Y)
  %%ctrlL = @Get(pt.X)
  %%ctrlR = @Sum(%%ctrlL,@dlgpos(BITMAP1,W))
  %%ctrlB = @Sum(%%ctrlT,@dlgpos(BITMAP1,H))
  %%BMP = @GetDesktopBMP(%%ctrlT,%%ctrlL,%%ctrlR,%%ctrlB)
  if %%BMP
    SaveBmp %%BMP,@WINDIR(T)\temp.bmp
    DelDesktopBmp %%BMP
    %%BMP = 
  End
  Dialog Set,BITMAP1,@WINDIR(T)\temp.bmp
Goto Evloop
:FLIP VERTICALMENU
  # Ok we are going to make these items Radio checked
  # Like all of the examples in this file we set the uFlags parameter
  # to 1024 for MF_BYPOSITION = 1024
  %%Ret = @Call(CheckMenuRadioItem,%%submenu_hwnd,0,2,1,MF_BYPOSITION)
  GoSub FLIPVERT
  Set pt.X,@dlgpos(BITMAP1,L)
  Set pt.Y,@dlgpos(BITMAP1,T)
  %%Ret = @Call(ClientToScreen,%%Main_hwnd,@AddrOf(pt))
  # %A = @GetLastError()
  while @GetLastError()
  wend
  %%ctrlT = @Get(pt.Y)
  %%ctrlL = @Get(pt.X)
  %%ctrlR = @Sum(%%ctrlL,@dlgpos(BITMAP1,W))
  %%ctrlB = @Sum(%%ctrlT,@dlgpos(BITMAP1,H))
  %%BMP = @GetDesktopBMP(%%ctrlT,%%ctrlL,%%ctrlR,%%ctrlB)
  if %%BMP
     SaveBmp %%BMP,@WINDIR(T)\temp.bmp
     DelDesktopBmp %%BMP
    %%BMP =
  End
  Dialog Set,BITMAP1,@WINDIR(T)\temp.bmp
Goto Evloop
:FLIP HORIZONTALMENU
  # Ok we are going to make these items Radio checked
  # Like all of the examples in this file we set the uFlags parameter
  # to 1024 for MF_BYPOSITION = 1024
  %%Ret = @Call(CheckMenuRadioItem,%%submenu_hwnd,0,2,2,MF_BYPOSITION)
  Gosub FLIPHORZ
  Set pt.X,@dlgpos(BITMAP1,L)
  Set pt.Y,@dlgpos(BITMAP1,T)
  %%Ret = @Call(ClientToScreen,%%Main_hwnd,@AddrOf(pt))
  # %A = @GetLastError()
  while @GetLastError()
  wend
  %%ctrlT = @Get(pt.Y)
  %%ctrlL = @Get(pt.X)
  %%ctrlR = @Sum(%%ctrlL,@dlgpos(BITMAP1,W))
  %%ctrlB = @Sum(%%ctrlT,@dlgpos(BITMAP1,H))
  %%BMP = @GetDesktopBMP(%%ctrlT,%%ctrlL,%%ctrlR,%%ctrlB)
  if %%BMP
     SaveBmp %%BMP,@WINDIR(T)\temp.bmp
     DelDesktopBmp %%BMP
     %%BMP =
  End
  Dialog Set,BITMAP1,@WINDIR(T)\temp.bmp
Goto Evloop
:INVERT
  # Invert the colors of the bitmap
  # %%Hdc = @Call(GetDC,%%Main_hwnd)
  %%Hdc = @GetWin(HDC,%%Main_hwnd)
  %%Ret = @Call(BitBlt,%%Hdc,@dlgpos(BITMAP1,L),@dlgpos(BITMAP1,T),@dlgpos(BITMAP1,W),@dlgpos(BITMAP1,H),%%Hdc,@dlgpos(BITMAP1,T),@dlgpos(BITMAP1,L),DSTINVERT)
  #%%Hdc = @Call(ReleaseDC,%%Main_hwnd,%%Hdc)
  SetWin HDC,Released,%%Main_hwnd,%%Hdc
Exit
:FLIPVERT
  # Flip the bitmap vertically
  %%ctrlT = @Diff(@Sum(@dlgpos(BITMAP1,T),@dlgpos(BITMAP1,H)),1)
  %%ctrlL = @DLGPOS(BITMAP1,L)
  %%ctrlW = @DLGPOS(BITMAP1,W)
  
  %%ctrlH = -@DLGPOS(BITMAP1,H)
  
  #%%Hdc = @Call(GetDC,%%Main_hwnd)
  %%Hdc = @GetWin(HDC,%%Main_hwnd)
  %%Ret = @Call(MyStretchBlt,%%Hdc,@dlgpos(BITMAP1,L),@dlgpos(BITMAP1,T),@dlgpos(BITMAP1,W),@dlgpos(BITMAP1,H),%%Hdc,%%ctrlL,%%ctrlT,%%ctrlW,%%ctrlH,SRCCOPY)
  #%%Hdc = @Call(ReleaseDC,%%Main_hwnd,%%Hdc)	 
  SetWin HDC,Released,%%Main_hwnd,%%Hdc
Exit
:FLIPHORZ
  # Flip the bitmap horizontally
  %%ctrlT = @DLGPOS(BITMAP1,T)
  %%ctrlL = @Diff(@Sum(@DLGPOS(BITMAP1,L),@DLGPOS(BITMAP1,W)),1)
  %%ctrlW = -@DLGPOS(BITMAP1,W)
  %%ctrlH = @DLGPOS(BITMAP1,H)
  #%%Hdc = @Call(GetDC,%%Main_hwnd)
  %%Hdc = @GetWin(HDC,%%Main_hwnd)
  %%Ret = @Call(MyStretchBlt,%%Hdc,@dlgpos(BITMAP1,L),@dlgpos(BITMAP1,T),@dlgpos(BITMAP1,W),@dlgpos(BITMAP1,H),%%Hdc,%%ctrlL,%%ctrlT,%%ctrlW,%%ctrlH,SRCCOPY)
  #%%Hdc = @Call(ReleaseDC,%%Main_hwnd,%%Hdc)
  SetWin HDC,Released,%%Main_hwnd,%%Hdc
Exit
:FLIPSCREENVERT
  # This sub-routine is just a little joke you can play on your friends.
  # Here is how I did it.
  # 1)   lock the desktop window like I did above in the SEMIROTATE
  #      so no other programs cannot update it.
  # 2)  Get the screen cords but vertically fliped
  # 3)   Get the DC of the locked desktop with GetDCEx() API function
  # 4)   Make a compatible bitmap from the desktop's DC
  # 5)   Make a memory DC
  # 6)   Select the previous Bitmap onto the memory DC
  # 7) Copy the color data from the %%Hdc into the %%MemDC
  # 8)  Now copy the fliped %%MemDC onto the %%Hdc
  # 10)   Clean up window.
  # 9)   Call this Sub-Routine again to Flip the desktop back.
  # Easy right?
  %%vertT = @Diff(@Sum(0,@SYSINFO(SCREENHEIGHT)),1)
  %%vertL = 0
  %%vertW = @SYSINFO(SCREENWIDTH)
  %%vertH = -@SYSINFO(SCREENHEIGHT)
  %%Hdc = @Call(GetDCEx,@Call(GetDesktopWindow),NULL,@Or(DCX_CACHE,DCX_LOCKWINDOWUPDATE))
  %%DeskBMP = @Call(CreateCompatibleBitmap,%%Hdc,@SYSINFO(SCREENWIDTH),@SYSINFO(SCREENHEIGHT))
  # %%MemDC = @Call(CreateCompatibleDC,%%Hdc)
  %%MemDC = @GetWin(HDC,MEMORY,%%Hdc)
  %%Ret = @Call(SelectObject,%%MemDC,%%DeskBMP)
  %%Ret = @Call(MyStretchBlt,%%MemDC,0,0,@SYSINFO(SCREENWIDTH),@SYSINFO(SCREENHEIGHT),%%Hdc,0,0,@SYSINFO(SCREENWIDTH),@SYSINFO(SCREENHEIGHT),SRCCOPY)
  %%Ret = @Call(MyStretchBlt,%%Hdc,0,0,@SYSINFO(SCREENWIDTH),@SYSINFO(SCREENHEIGHT),%%MemDC,%%vertL,%%vertT,%%vertW,%%vertH,SRCCOPY)
  # %%MemDC = @Call(DeleteDC,%%MemDC)
  SetWin HDC,Deleted,%%MemDC
  #%%Hdc = @Call(ReleaseDC,@Call(GetDesktopWindow,NULL),%%Hdc)
  SetWin HDC,Released,@Call(GetDesktopWindow),%%Hdc
  %%DeskBMP = @Call(DeleteObject,%%DeskBMP)
  %%DeskBMP =
Exit
:FLIPSCREENHORZ
  # This sub-routine is just a little joke you can play on your friends
  # Here is how I did it.
  # 1)   lock the desktop window so no other program can update it.
  # 2)   Get the screen cords but horizontally fliped
  # 3)   Get the DC of the locked desktop with GetDCEx() API function
  # 4)   Make a compatible bitmap from the desktop's DC
  # 5)   Make a memory DC
  # 6)   Select the previous Bitmap onto the memory DC
  # 7)   Copy the color data from the %%Hdc into the %%MemDC with the StretchBlt API function
  # 8)   Now copy the fliped %%MemDC onto the %%Hdc
  # 9)   Clean up and unlock the Desktop window.
  # 10)  Call this Sub-Routine again to Flip the desktop back.
  # Easy right?
  %%horzT = 0
  %%horzL = @Diff(@Sum(0,@SYSINFO(SCREENWIDTH)),1)
  %%horzW = -@SYSINFO(SCREENWIDTH)
  %%horzH = @SYSINFO(SCREENHEIGHT)
  %%Hdc = @Call(GetDCEx,@Call(GetDesktopWindow),NULL,@Or(DCX_CACHE,DCX_LOCKWINDOWUPDATE))
  %%DeskBMP = @Call(CreateCompatibleBitmap,%%Hdc,@SYSINFO(SCREENWIDTH),@SYSINFO(SCREENHEIGHT))
  # %%MemDC = @Call(CreateCompatibleDC,%%Hdc)
  %%MemDC = @GetWin(HDC,Memory,%%Hdc)
  %%Ret = @Call(SelectObject,%%MemDC,%%DeskBMP)
  %%Ret = @Call(MyStretchBlt,%%MemDC,0,0,@SYSINFO(SCREENWIDTH),@SYSINFO(SCREENHEIGHT),%%Hdc,0,0,@SYSINFO(SCREENWIDTH),@SYSINFO(SCREENHEIGHT),SRCCOPY)
  %%Ret = @Call(MyStretchBlt,%%Hdc,0,0,@SYSINFO(SCREENWIDTH),@SYSINFO(SCREENHEIGHT),%%MemDC,%%horzL,%%horzT,%%horzW,%%horzH,SRCCOPY)
  #%%MemDC = @Call(DeleteDC,%%MemDC)
  SetWin HDC,Deleted,%%MemDC
  #%%Hdc = @Call(ReleaseDC,@Call(GetDesktopWindow,NULL),%%Hdc)
  SetWin HDC,Released,@Call(GetDesktopWindow),%%Hdc
  %%DeskBMP = @Call(DeleteObject,%%DeskBMP)
  %%DeskBMP =
Exit

:GETMENUPOS
  # Get the Item position on the toolbar
  PARSE "%%top;%%left;%%right;%%bottom;%%width;%%height",@ToolBar(Get,Pos,%1,%2,SCREEN)
  # return the left and bottom screen cordinates.
exit %%left@fsep()%%bottom

:ONERROR
 # This is here so if we make a mistake gadget will unhook
	# our windows and not crash your PC...  You must unhook or
	# gadget will kill the pc because it will keep requesting
	# info from these memory addresses
 If @Equal(@error(E),28)
   Warn I could not load the DLL at line @error(N)
 Else
   %%GadgetErr = @GetLastError()
   if %%GadgetErr
    While %%GadgetErr
      Warn %%GadgetErr
      %%GadgetErr = @GetLastError()
    Wend   
   else
     WARN Error: @ERROR(E)@CR()at line number @ERROR(N)
   end
   OPTION ERRORTRAP,
 End
:QUITMENU
:Close
  File delete,@WINDIR(T)\temp.bmp
  File delete,@WINDIR(T)\blank.bmp
  if %%MenuBMP
    # Delete the menu Bitmap from the Menus section
    %%MenuBMP = @Call(DeleteObject,%%MenuBMP) 
    %%MenuBMP =
  End
  # Delete the Bands
  If %%rb
   ReBar Remove,RB,TBBand
   ReBar Remove,RB,Combo1Band
   ReBar Remove,RB,MenuBand

   # Delete the ToolBar Window and release it from memory
   if %%tb
    ToolBar Remove,TB
    ToolBar Remove,MenuTB
   end
   ReBar Remove,RB
  End
  If %%HIcon
     Info %%HIcon@CR()
     DelIco %%HIcon
     if @Ok()
       %%HIcon =      
     end
     SetWin HDC,Deleted,%%Hdcico
     #%%Hdcico = @Call(Deletedc,%%Hdcico)
  End
  
  If @Get(USER32)
  # Free the DLL's that we loaded
  FreeDll USER32
  FreeDll GDI32
  End

Exit	 
:End of 3Bars