Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
toolbar fun prob
#11
That thread disappeared. Here are the functions we talked about.

On Win 2000 and above, we can make a toolbar transparent. We also can set backbround bitmap. We can combine those two things and have a simple skin. In the first line of the toolbar, specify appropriate hook function, like in this example:

Code:
Copy      Help
;/hook ToolbarExProc25

Hook function that makes a toolbar transparent:

Code:
Copy      Help
function# hWnd message wParam lParam

sel message
,case WM_CREATE
,Transparent hWnd 254 GetSysColor(COLOR_BTNFACE) ;;background transparent, for mouse too
,;Transparent hWnd 150 ;;all colors partally transparent

Hook function that sets background bitmap:

Code:
Copy      Help
function# hWnd message wParam lParam

type MEMORYBITMAP dc bm oldbm
MEMORYBITMAP* m

sel message
,case WM_CREATE
,
,lpstr bitmapfile="$desktop$\test.bmp" ;;change this
,
,m._new
,m.bm=LoadImage(0 _s.expandpath(bitmapfile) IMAGE_BITMAP 0 0 LR_LOADFROMFILE)
,if(m.bm)
,,m.dc=CreateCompatibleDC(0)
,,m.oldbm=SelectObject(m.dc m.bm)
,,SetProp hWnd "bitmap" m
,
,case WM_ERASEBKGND
,m=+GetProp(hWnd "bitmap")
,if(m)
,,RECT r; GetClientRect hWnd &r
,,FillRect wParam &r COLOR_BTNFACE+1
,,BitBlt wParam 0 0 r.right r.bottom m.dc 0 0 SRCCOPY
,,ret 1
,
,case WM_DESTROY
,m=+GetProp(hWnd "bitmap")
,if(m)
,,RemoveProp hWnd "bitmap"
,,DeleteObject(SelectObject(m.dc m.oldbm))
,,DeleteDC m.dc
,,m._delete

Hook function that sets background bitmap and a transparent color. Parts of the bitmap that match the color will be transparent:

Code:
Copy      Help
function# hWnd message wParam lParam

type MEMORYBITMAP2 dc bm oldbm br
MEMORYBITMAP2* m

sel message
,case WM_CREATE
,
,lpstr bitmap_file="$desktop$\test2.bmp" ;;change this
,int transparent_color=0xff00ff ;;magenta will be transparent, for mouse too
,;Fill transparent areas of the bitmap with the transparent color, remove
,;border, and toolbar will look and behave like with a simple skin.
,
,Transparent hWnd 254 transparent_color
,
,m._new
,m.bm=LoadImage(0 _s.expandpath(bitmap_file) IMAGE_BITMAP 0 0 LR_LOADFROMFILE)
,if(m.bm)
,,m.dc=CreateCompatibleDC(0)
,,m.oldbm=SelectObject(m.dc m.bm)
,,SetProp hWnd "bitmap" m
,,
,,m.br=CreateSolidBrush(transparent_color)
,
,case WM_ERASEBKGND
,m=+GetProp(hWnd "bitmap")
,if(m)
,,RECT r; GetClientRect hWnd &r
,,FillRect wParam &r m.br
,,BitBlt wParam 0 0 r.right r.bottom m.dc 0 0 SRCCOPY
,,ret 1
,
,case WM_DESTROY
,m=+GetProp(hWnd "bitmap")
,if(m)
,,RemoveProp hWnd "bitmap"
,,DeleteObject(SelectObject(m.dc m.oldbm))
,,DeleteDC m.dc
,,DeleteObject m.br
,,m._delete


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)