Codes are here:
Code: Select all
; PureBasic Visual Designer v3.90 build 1360
;- Window Constants
;
Enumeration
#Window_main
EndEnumeration
;- Gadget Constants
;
Enumeration
#ButtonImage_TileV
#Container_main
#ButtonImage_TileH
#ButtonImage_Refresh
#ButtonImage_NewFolder
#String_0
#Button_RunDos
EndEnumeration
Procedure Open_Window_main()
If OpenWindow(#Window_main, 225, 67, 640, 480, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #PB_Window_TitleBar | #PB_Window_ScreenCentered , "2Explorers 曾劲松 2005/4/17 http://goomoo.yeah.net")
If CreateGadgetList(WindowID())
ButtonGadget(#ButtonImage_TileV, 3, 3, 36, 36, "TileV")
ButtonGadget(#ButtonImage_TileH, 40, 3, 36, 36, "TileH")
ButtonGadget(#ButtonImage_Refresh, 77, 3, 36, 36, "Refresh")
ButtonGadget(#ButtonImage_NewFolder, 130, 3, 36, 36, "NewFldr")
StringGadget(#String_0, 180, 10, 285, 20, "")
ButtonGadget(#Button_RunDos, 470, 4, 90, 30, "执行DOS命令")
;-
ContainerGadget(#Container_main, 0, 40, 639, 439, #PB_Container_Single)
CloseGadgetList()
EndIf
EndIf
EndProcedure
Enumeration
#TileV
#TileH
EndEnumeration
Dim hExplorer.l(2)
currentStyle=#TileV
Procedure updateWindows()
InvalidateRect_(hContainer,#Null,true)
;Delay(10)
;InvalidateRect_(hExplorer(0),#Null,true)
;InvalidateRect_(hExplorer(1),#Null,true)
;UpdateWindow_(hContainer)
;UpdateWindow_(hExplorer(0))
;UpdateWindow_(hExplorer(1))
ShowWindow_(hExplorer(0),#sw_show)
ShowWindow_(hExplorer(1),#sw_show)
; RedrawWindow_(hExplorer(0),#Null,#Null,#RDW_INVALIDATE)
; RedrawWindow_(hExplorer(1),#Null,#Null,#RDW_INVALIDATE)
; SendMessage_(hExplorer(0),#wm_paint,GetDC_(hExplorer(0)),0)
; SendMessage_(hExplorer(1),#wm_paint,GetDC_(hExplorer(1)),0)
EndProcedure
Procedure wndCallBAck(WindowId.l,Message.l,wParam.l,lParam.l)
Result=#PB_ProcessPureBasicEvents
Result=PureRESIZE_CallBack(WindowId,Message,wParam,lParam,Result)
Select Message
Case #wm_size
If IsWindowVisible_(WindowID())
If currentStyle=#TileV
;TileWindows_(hContainer,#MDITILE_VERTICAL,#Null,#Null,#Null)
Else
;TileWindows_(hContainer,#MDITILE_HORIZONTAL,#Null,#Null,#Null)
EndIf
EndIf
Case #wm_activate
updateWindows()
Case #WM_ACTIVATEAPP
;updateWindows()
EndSelect
ProcedureReturn Result
EndProcedure
RunProgram("explorer.exe")
RunProgram("explorer.exe")
Delay(1000)
Open_Window_main()
hContainer=GadgetID(#Container_main)
containerWindowStyle=GetWindowLong_(hContainer,#gwl_style)
SetWindowLong_(hContainer,#gwl_style,containerWindowStyle|#MDIS_ALLCHILDSTYLES)
PureRESIZE_SetGadgetResize(#Container_main,1,1,1,1)
SetWindowCallback(@wndCallBAck())
Repeat
hExplorer(0)=FindWindow_("ExploreWClass",#Null)
Delay(100)
Until hExplorer(0)
;SetParent_(hExplorer(0),hContainer)
wndClass.l=GetWindowLong_(hExplorer(0),#gwl_style)
wndClass=wndClass!#ws_popup
wndClass=wndClass!#ws_popupwindow
;When use style WS_CHILDWINDOW ,the explore's menu not available
wndClass=wndClass|#WS_CHILDWINDOW|#ws_tiledwindow|#ws_child
;SetWindowLong_(hExplorer(0),#gwl_style,wndClass)
wndClassEx=#WS_EX_WINDOWEDGE|#WS_EX_MDICHILD
;SetWindowLong_(hExplorer(0),#gwl_exstyle,wndClassEx)
SetParent_(hExplorer(0),hContainer)
HInstance=GetWindowLong_(WindowID(),#gwl_hInstance)
SetWindowLong_(hExplorer(0),#gwl_hInstance,HInstance)
Repeat
hExplorer(1)=FindWindow_("ExploreWClass",#Null)
Delay(100)
Until hExplorer(1) And hExplorer(0)<>hExplorer(1)
;SetParent_(hExplorer(1),hContainer)
;SetWindowLong_(hExplorer(1),#gwl_style,wndClass)
SetWindowLong_(hExplorer(1),#gwl_hInstance,HInstance)
;SetWindowLong_(hExplorer(1),#gwl_exstyle,wndClassEx)
SetParent_(hExplorer(1),hContainer)
ShowWindow_(WindowID(),#sw_maximize)
TileWindows_(hContainer,#MDITILE_VERTICAL,#Null,#Null,#Null)
Repeat
event = WaitWindowEvent()
If event = #PB_EventGadget
;updateWindows()
;Debug "WindowID: " + Str(EventWindowID())
GadgetID = EventGadgetID()
If GadgetID = #ButtonImage_TileV
TileWindows_(hContainer,#MDITILE_VERTICAL,#Null,#Null,#Null)
currentStyle=#TileV
ElseIf GadgetID = #Container_main
ElseIf GadgetID = #ButtonImage_TileH
TileWindows_(hContainer,#MDITILE_HORIZONTAL,#Null,#Null,#Null)
currentStyle=#TileH
ElseIf GadgetID = #ButtonImage_Refresh
updateWindows()
ElseIf GadgetID = #ButtonImage_NewFolder
Debug "GadgetID: #ButtonImage_NewFolder"
ElseIf GadgetID = #String_0
Debug "GadgetID: #String_0"
ElseIf GadgetID = #Button_RunDos
Debug "GadgetID: #Button_RunDos"
EndIf
EndIf
Until event = #PB_EventCloseWindow
End