Source wurde am 15.07.2007 aus der MMJ-Quellcodesammlung (Dietmar Horn) in die Babyklappe auf XProfan.Com abgelegt:
SideBar mit Profan
Sidebar ähnlich wie zum Beispiel in Spybot-Search & Destroy, die Buttons sind noch nicht so gelungen
bei Verwendung von getmessage anstatt waitinput kann man schon Hoover-Effekte erzielen.
Unter Xprofan 8.0 geschrieben müsste aber unter anderen Versionen laufen
habe deshalb die Tooltips von Xprofan ausgelassen.
getestet unter W Me und W XP prof.
Die Icons kommen aus der Shell32.dll, deshalb kann es sein, dass in einigen Windowsversionen
Icons fehlen.
Autor 2004 Dieter Zornow
zur freien Verwendung oder Weiterentwicklung
DEF ExtractIcon(3) ! SHELL32,ExtractIconA
Declare static&,menu1&,menu2&,menu3&,menu4&,menue%
Declare icon1&,icon2&,icon3&,icon4&,icon5&,icon6&,icon7&,icon8&,icon9&
Declare icon10&,icon11&,icon12&,icon13&,icon14&,icon15&,icon16&,icon17&,icon18&,icon19&
SETTRUECOLOR 1
menue% = 1
PROC CreateIconButton
Parameters hndl&,icoInd&,Res$,x%,y%,x1%,y1%
Declare ico#,icohndl&,Bhndl&
Dim ico#,Add(Len(Res$),1)
String ico#,0 = Res$
Let icohndl& = ExtractIcon(%Hinstance,ico#,icoInd&)
Bhndl&=Control(BUTTON,,$5400C340,x%,y%,x1%,y1%,hndl&,0,%hinstance,$0)
Bhndl&=Control(BUTTON,,$5400C040,x%,y%,x1%,y1%,hndl&,0,%hinstance,$020)
Sendmessage(Bhndl&,$00F7,1,icohndl&)
Dispose ico#
Return Bhndl&
ENDPROC
proc Make1
CreateICONBUTTON static&,4,SHELL32.DLL,0,0,0,0
ICON1&=@&(0)
CreateICONBUTTON static&,1,SHELL32.DLL,0,0,0,0
ICON2&=@&(0)
CreateICONBUTTON static&,5,SHELL32.DLL,0,0,0,0
ICON3&=@&(0)
CreateICONBUTTON static&,13,SHELL32.DLL,0,0,0,0
ICON4&=@&(0)
CreateICONBUTTON static&,17,SHELL32.DLL,0,0,0,0
ICON5&=@&(0)
CreateICONBUTTON static&,21,SHELL32.DLL,0,0,0,0
ICON6&=@&(0)
CreateICONBUTTON static&,27,SHELL32.DLL,0,0,0,0
ICON7&=@&(0)
endproc
proc Make2
CreateICONBUTTON static&,22,SHELL32.DLL,0,0,0,0
ICON8&=@&(0)
CreateICONBUTTON static&,23,SHELL32.DLL,0,0,0,0
ICON9&=@&(0)
CreateICONBUTTON static&,31,SHELL32.DLL,0,0,0,0
ICON10&=@&(0)
CreateICONBUTTON static&,41,SHELL32.DLL,0,0,0,0
ICON11&=@&(0)
endproc
proc Make3
CreateICONBUTTON static&,53,SHELL32.DLL,0,0,0,0
ICON12&=@&(0)
CreateICONBUTTON static&,70,SHELL32.DLL,0,0,0,0
ICON13&=@&(0)
CreateICONBUTTON static&,68,SHELL32.DLL,0,0,0,0
ICON14&=@&(0)
CreateICONBUTTON static&,88,SHELL32.DLL,0,0,0,0
ICON15&=@&(0)
endproc
proc Make4
CreateICONBUTTON static&,104,SHELL32.DLL,0,0,0,0
ICON16&=@&(0)
CreateICONBUTTON static&,102,SHELL32.DLL,0,0,0,0
ICON17&=@&(0)
CreateICONBUTTON static&,90,SHELL32.DLL,0,0,0,0
ICON18&=@&(0)
CreateICONBUTTON static&,95,SHELL32.DLL,0,0,0,0
ICON19&=@&(0)
endproc
proc show1
SetWindowPos icon1&=40,40-32,32;0
SetWindowPos icon2&=40,80-32,32;0
SetWindowPos icon3&=40,120-32,32;0
SetWindowPos icon4&=40,160-32,32;0
SetWindowPos icon5&=40,200-32,32;0
SetWindowPos icon6&=40,240-32,32;0
SetWindowPos icon7&=40,280-32,32;0
endproc
proc hide1
SetWindowPos icon1&=0,0-0,0;1
SetWindowPos icon2&=0,0-0,0;1
SetWindowPos icon3&=0,0-0,0;1
SetWindowPos icon4&=0,0-0,0;1
SetWindowPos icon5&=0,0-0,0;1
SetWindowPos icon6&=0,0-0,0;1
SetWindowPos icon7&=0,0-0,0;1
endproc
proc show2
SetWindowPos icon8&=40,60-32,32;0
SetWindowPos icon9&=40,100-32,32;0
SetWindowPos icon10&=40,140-32,32;0
SetWindowPos icon11&=40,180-32,32;0
endproc
proc hide2
SetWindowPos icon8&=0,0-0,0;1
SetWindowPos icon9&=0,0-0,0;1
SetWindowPos icon10&=0,0-0,0;1
SetWindowPos icon11&=0,0-0,0;1
endproc
proc show3
SetWindowPos icon12&=40,80-32,32;0
SetWindowPos icon13&=40,120-32,32;0
SetWindowPos icon14&=40,160-32,32;0
SetWindowPos icon15&=40,200-32,32;0
endproc
proc hide3
SetWindowPos icon12&=0,0-0,0;1
SetWindowPos icon13&=0,0-0,0;1
SetWindowPos icon14&=0,0-0,0;1
SetWindowPos icon15&=0,0-0,0;1
endproc
proc show4
SetWindowPos icon16&=40,100-32,32;0
SetWindowPos icon17&=40,140-32,32;0
SetWindowPos icon18&=40,180-32,32;0
SetWindowPos icon19&=40,220-32,32;0
endproc
proc hide4
SetWindowPos icon16&=0,0-0,0;1
SetWindowPos icon17&=0,0-0,0;1
SetWindowPos icon18&=0,0-0,0;1
SetWindowPos icon19&=0,0-0,0;1
endproc
Proc setmenue
SetWindowPos static&=0,0-125,@Height(%Hwnd);0
if menue% = 1
SetWindowPos menu1&=0,0-119,25;0
case @Height(%Hwnd) > 79:SetWindowPos menu2&=0,(@Height(%Hwnd)-79) - 119,25;0
case @Height(%Hwnd) > 55:SetWindowPos menu3&=0,(@Height(%Hwnd)-55) - 119,25;0
case @Height(%Hwnd) > 31:SetWindowPos menu4&=0,(@Height(%Hwnd)-31) - 119,25;0
elseif menue% = 2
SetWindowPos menu1&=0,0 - 119,25;0
SetWindowPos menu2&=0,24 - 119,25;0
case @Height(%Hwnd) > 55:SetWindowPos menu3&=0,(@Height(%Hwnd)-55) - 119,25;0
case @Height(%Hwnd) > 31:SetWindowPos menu4&=0,(@Height(%Hwnd)-31) - 119,25;0
elseif menue% = 3
SetWindowPos menu1&=0,0 - 119,25;0
SetWindowPos menu2&=0,24 - 119,25;0
SetWindowPos menu3&=0,48 - 119,25;0
case @Height(%Hwnd) > 31:SetWindowPos menu4&=0,(@Height(%Hwnd)-31) - 119,25;0
elseif menue% = 4
SetWindowPos menu1&=0,0 - 119,25;0
SetWindowPos menu2&=0,24 - 119,25;0
SetWindowPos menu3&=0,48 - 119,25;0
SetWindowPos menu4&=0,72 - 119,25;0
endif
setfocus(%Hwnd)
endproc
proc createSideBar
static& = Control(STATIC,,$54000105,0,0,125,@Height(%Hwnd),%hwnd,0,%hinstance,$020200)
menu1&=@Create(Button,static&,Menue 1,0,0,0,0)
menu2&=@Create(Button,static&,Menue 2,0,0,0,0)
menu3&=@Create(Button,static&,Menue 3,0,0,0,0)
menu4&=@Create(Button,static&,Menue 4,0,0,0,0)
menue%=1
setmenue
make1
show1
make2
make3
make4
endproc
###########################################################################
DEF GETSYSCOLOR(1) !USER32,GetSysColor
DECLARE ENDE%
Proc GoEvent
parameters text$
Messagebox(Das wäre Ihr Preis gewesen,Ich komme von: +text$,64)
endproc
WINDOWSTYLE 63
WINDOWTITLE 1 Versuch einer Side bar
WINDOW SUB(DIV(%MAXX,2),DIV(800,2)),SUB(DIV(%MAXY,2),DIV(600,2))-800,600
CLS GETSYSCOLOR(15)
USEFONT MS Sans Serif,13,0,0,0,0
SETDIALOGFONT 1
createSideBar
WHILENOT ENDE%
waitinput
If @EQU(%KEY,2)
LET ENDE%= 1
elseIf @EQU(%KEY,4)
setmenue
elseif getfocus(menu1&)
menue%=1
hide2
hide3
hide4
setmenue
show1
setfocus(%hwnd)
elseif getfocus(menu2&)
menue%=2
hide1
hide3
hide4
setmenue
show2
setfocus(%hwnd)
elseif getfocus(menu3&)
menue%=3
hide1
hide2
hide4
setmenue
show3
setfocus(%hwnd)
elseif getfocus(menu4&)
menue%=4
hide1
hide2
hide3
setmenue
show4
setfocus(%hwnd)
ENDIF
Iconcontrol
if getfocus(Icon1&) Menue 1
goevent Icon 1
elseif getfocus(Icon2&)
goevent Icon 2
elseif getfocus(Icon3&)
goevent Icon 3
elseif getfocus(Icon4&)
goevent Icon 4
elseif getfocus(Icon5&)
goevent Icon 5
elseif getfocus(Icon6&)
goevent Icon 6
elseif getfocus(Icon7&)
ende%=1
elseif getfocus(Icon8&) Menue2
goevent Icon 8
elseif getfocus(Icon9&)
goevent Icon 9
elseif getfocus(Icon10&)
goevent Icon 10
elseif getfocus(Icon11&)
goevent Icon 11
elseif getfocus(Icon12&) Menue 3
goevent Icon 12
elseif getfocus(Icon13&)
goevent Icon 13
elseif getfocus(Icon14&)
goevent Icon 14
elseif getfocus(Icon15&)
goevent Icon 15
elseif getfocus(Icon16&) Menue 4
goevent Icon 16
elseif getfocus(Icon17&)
goevent Icon 17
elseif getfocus(Icon18&)
goevent Icon 18
elseif getfocus(Icon19&)
goevent Icon 19
endif
WEND