Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Display Windows icon for file extension
Message
De
12/01/2018 16:07:38
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows 10
Network:
Windows Server 2012
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01657149
Message ID:
01657173
Vues:
102
J'aime (1)
Hi Christian
this is an easy solution for your request
*this code plays exactly  the role of windows explorer.its based on internet explorer (vfp browser)
*instead of navigating to web urls its used here to navigate to local files on disc.
*i guess this interface and windows explorer are the same interface.
*very easy to implement.
*warning: the contextuel menu (right click) is the same as explorer.can rename,cut,copy.....

PUBLIC oform
oform=NEWOBJECT("yExplorer")
oform.Show
read events
RETURN
*
DEFINE CLASS yExplorer AS form
	Top = 31
	Left = 217
	Height = 491
	Width = 684
	ShowWindow = 2
	Caption = "A custom vfp explorer with vfp oBrowser"
	Name = "Form1"

	ADD OBJECT obrowser AS olecontrol WITH ;
        oleclass="shell.explorer.2", ;
		Top = 0, ;
		Left = 0, ;
		Height = 408, ;
		Width = 685, ;
		Anchor = 15, ;
		Name = "oBrowser"

	ADD OBJECT ycnt AS ycnt0 WITH ;
		Anchor = 0, ;
		Top = 438, ;
		Left = 70, ;
		Width = 540, ;
		Height = 49, ;
		BackStyle = 0, ;
		BorderWidth = 0, ;
		Name = "yCNT"

	PROCEDURE Destroy
		clea events
	ENDPROC

	PROCEDURE Resize
		with thisform.ycnt
		.left=(thisform.width-.width)/4
		.top=thisform.oBrowser.top+thisform.oBrowser.height+10
		endwith
	ENDPROC

	PROCEDURE Init
		this.resize
	ENDPROC

	PROCEDURE Init
		this.obrowser.navigate(home(1))
		thisform.yCNT.text1.value=home(1)
		with thisform.ycnt
		.combo1.value=6    &&set detail view
		.combo1.click
		endwith
	ENDPROC
ENDDEFINE
*
*-- EndDefine: yexplorer


DEFINE CLASS ycnt0 AS container
	Anchor = 0
	Top = 438
	Left = 70
	Width = 540
	Height = 49
	BackStyle = 0
	BorderWidth = 0
	Name = "yCNT"

	ADD OBJECT command1 AS commandbutton WITH ;
		Top = 15, ;
		Left = 8, ;
		Height = 25, ;
		Width = 72, ;
		Caption = "Any dir ...", ;
		MousePointer = 15, ;
		Name = "Command1"

	ADD OBJECT label1 AS label WITH ;
		AutoSize = .T., ;
		BackStyle = 0, ;
		Caption = "8 Views", ;
		Height = 17, ;
		Left = 404, ;
		Top = 21, ;
		Width = 45, ;
		Name = "Label1"

	ADD OBJECT combo1 AS combobox WITH ;
		Height = 25, ;
		Left = 455, ;
		Top = 16, ;
		Width = 73, ;
		Name = "Combo1"

	ADD OBJECT text1 AS textbox WITH ;
		Height = 25, ;
		Left = 87, ;
		ReadOnly = .T., ;
		Top = 17, ;
		Width = 299, ;
		Name = "Text1"

	PROCEDURE command1.Click
		local m.yrep
		m.yrep=getdir("","","",32)
		if !empty(m.yrep)
		thisform.oBrowser.navigate(m.yrep)
		this.parent.text1.value=m.yrep
		inke(1)
		this.parent.combo1.value=6  &&positioned on details view
		this.parent.combo1.click
		endi
	ENDPROC

	PROCEDURE combo1.Init
		with this
		.additem("View 1")
		.additem("View 2")
		.additem("View 3")
		.additem("View 4")
		.additem("View 5")
		.additem("View 6")
		.additem("View 7")
		.additem("View 8")
		.style=2
		.listindex=1
		.value=1
		endwith
	ENDPROC

	PROCEDURE combo1.Click
		local m.xval,m.o
		m.xval=this.value
		local oshell
		oshell=newObject("wscript.shell")
		thisform.oBrowser.setfocus
		m.o="^"+trans(m.xval)
		oshell.sendkeys(m.o)
		oshell=null
	ENDPROC

ENDDEFINE
*
*-- EndDefine: ycnt0
can see another demo in http://yousfi.over-blog.com/2015/02/the-windows-special-folders.html code *9*
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform