bi explorer du Soldat

Partagez votre expérience de PureBasic avec les autres utilisateurs.
Avatar de l’utilisateur
Zorro
Messages : 2185
Inscription : mar. 31/mai/2016 9:06

bi explorer du Soldat

Message par Zorro »

Le soldat nous avait pondu ça :
j'ai changé la disposition pour la mettre horizontal (vertical a l'origine )

2 exploreurs dans la meme fenetre
mais bon, on peut aussi faire 2 fenetres qui seraient collé l'une a l'autre :)
ou utiliser les MDI fenetres
ça ouvre des perspective :)

Code : Tout sélectionner

; Auteur : Le Soldat Inconnu
; Version de PB : 4.50
; version horizontal et mis en Pb5.50 par Zorro

If OpenWindow(0, 0, 0, 1024, 768, "Groupe Exploreur", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget) = 0
		End
EndIf

RunProgram("explorer.exe")
Delay(1000)
id = GetForegroundWindow_()

SetParent_(id, WindowID(0))
; SetWindowLongPtr_(Id2, #GWL_HWNDPARENT, Id)
Style = GetWindowLongPtr_(id, #GWL_STYLE)
SetWindowLongPtr_(id, #GWL_STYLE, (Style | #WS_CHILDWINDOW) & ~#WS_TILEDWINDOW)
SetWindowPos_(id, 0, 0, 0, WindowWidth(0)/2, WindowHeight(0) , 0)

RunProgram("explorer.exe")
Delay(1000)
id2 = GetForegroundWindow_()

SetParent_(id2, WindowID(0))
; SetWindowLongPtr_(Id2, #GWL_HWNDPARENT, Id)
Style = GetWindowLongPtr_(id2, #GWL_STYLE)
SetWindowLongPtr_(id2, #GWL_STYLE, (Style | #WS_CHILDWINDOW) & ~#WS_TILEDWINDOW)
SetWindowPos_(id2, 0, WindowWidth(0)/2, 0, WindowWidth(0)/2, WindowHeight(0) , 0)



Repeat
		Event = WaitWindowEvent()
		
		Select Event
		Case #PB_Event_Menu
				Select EventMenu() ; Menus
						
				EndSelect
				
		Case #PB_Event_Gadget
				Select EventGadget() ; Gadgets
						
				EndSelect
		Case #PB_Event_SizeWindow
				SetWindowPos_(id, 0, 0, 0, WindowWidth(0)/2, WindowHeight(0) , 0)   
				SetWindowPos_(id2, 0, WindowWidth(0)/2, 0, WindowWidth(0)/2, WindowHeight(0) , 0)
		EndSelect
		
Until Event = #PB_Event_CloseWindow

Image
Image
Site: http://michel.dobro.free.fr/
Devise :"dis moi ce dont tu as besoin, je t'expliquerai comment t'en passer"
Avatar de l’utilisateur
Zorro
Messages : 2185
Inscription : mar. 31/mai/2016 9:06

Re: bi explorer du Soldat

Message par Zorro »

version 2 fenetres
on bouge l'ensemble en deplaçant la fenetre de gauche

Code : Tout sélectionner

; Auteur : Le Soldat Inconnu
; Version de PB : 4.50
; version 2 fenetres par Zorro

enumeration
		#Win 
		#Win2
EndEnumeration

Declare windowcallback(windowid,message,wparam,lparam)
Global Largeur=500
Global Hauteur=300
Global ecartement=20

If OpenWindow(#win, 0, 0,Largeur, Hauteur, "Groupe Exploreur1", #PB_Window_SystemMenu |#PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget) = 0
		End
EndIf
If OpenWindow(#win2,Largeur+ecartement, 0, Largeur, Hauteur, "Groupe Exploreur2", #PB_Window_SystemMenu  | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget) = 0
		End
EndIf
SetWindowCallback(@WindowCallback())
RunProgram("explorer.exe","c:\","c:\")
Delay(1000)
global id = GetForegroundWindow_()
SetParent_(id, WindowID(#win))
; SetWindowLongPtr_(Id2, #GWL_HWNDPARENT, Id)
Style = GetWindowLongPtr_(id, #GWL_STYLE)
SetWindowLongPtr_(id, #GWL_STYLE, (Style | #WS_CHILDWINDOW) & ~#WS_TILEDWINDOW)
SetWindowPos_(id, 0, 0, 0, WindowWidth(#win), WindowHeight(#win) , 0)
RunProgram("explorer.exe","c:\","c:\")
Delay(1000)
global id2 = GetForegroundWindow_()
SetParent_(id2, WindowID(#win2))
; SetWindowLongPtr_(Id2, #GWL_HWNDPARENT, Id)
Style = GetWindowLongPtr_(id2, #GWL_STYLE)
SetWindowLongPtr_(id2, #GWL_STYLE, (Style | #WS_CHILDWINDOW) & ~#WS_TILEDWINDOW)
SetWindowPos_(id2, 0, 0, 0, WindowWidth(#win2)+ecartement, WindowHeight(#win2) , 0)
Repeat
		Event = WaitWindowEvent()
		Select Event
		Case #PB_Event_Menu
				Select EventMenu() ; Menus
				EndSelect
		Case #PB_Event_Gadget
				Select EventGadget() ; Gadgets
				EndSelect
		Case #PB_Event_SizeWindow
				SetWindowLongPtr_(id2, #GWL_STYLE, (Style | #WS_CHILDWINDOW) & ~#WS_TILEDWINDOW)
				SetWindowPos_(id2, 0, 0, 0, WindowWidth(#win2)+ecartement, WindowHeight(#win2) , 0)
		EndSelect
Until Event = #PB_Event_CloseWindow

Procedure WindowCallback(WindowID,message,wParam,lParam)
		res=#PB_ProcessPureBasicEvents
		Select message 
		Case #WM_MOVE 
				xx = WindowX(#win)+WindowWidth(#win)+ecartement
				yy = WindowY(#win)
				ResizeWindow(#win2,xx,yy,#PB_Ignore,#PB_Ignore)
				SetWindowPos_(id, 0, 0, 0, WindowWidth(#win), WindowHeight(#win) , 0)
				SetWindowPos_(id2, 0, 0, 0, WindowWidth(#win2)+ecartement, WindowHeight(#win2) , 0)				
				ProcedureReturn #True  
		Case #WM_Size
				xx = WindowX(#win)+WindowWidth(#win)+30
				yy = WindowY(#win)
				ResizeWindow(#win2,xx,yy,WindowWidth(#win),WindowHeight(#win))
				SetWindowPos_(id, 0, 0, 0, WindowWidth(#win), WindowHeight(#win) , 0)
				SetWindowPos_(id2, 0, 0, 0, WindowWidth(#win2)+ecartement, WindowHeight(#win2) , 0)
				
				ProcedureReturn #True  
		EndSelect
		ProcedureReturn res
EndProcedure 
Image
Image
Site: http://michel.dobro.free.fr/
Devise :"dis moi ce dont tu as besoin, je t'expliquerai comment t'en passer"
Avatar de l’utilisateur
Zorro
Messages : 2185
Inscription : mar. 31/mai/2016 9:06

Re: bi explorer du Soldat

Message par Zorro »

modification du dernier code (2 fenetres )

on peut maintenant changer la taille de la fenetre de gauche, ça modifie aussi la fenetre de droite en proportion
et j'ouvre l'explorer dans le lecteur C:\
Image
Image
Site: http://michel.dobro.free.fr/
Devise :"dis moi ce dont tu as besoin, je t'expliquerai comment t'en passer"
Répondre