Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Windows explorer
Message
 
À
22/03/2007 17:34:15
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01207378
Message ID:
01207396
Vues:
19
If all you want to do is open an Explorer window I would use ShellExecute() in the Windows API. This will be a lot quicker and less resource intensive than using IE or the shell objects.

There's a bunch of different ways you can accomplish this here:
http://www.west-wind.com/presentations/shellapi/shellapi.asp

GoUrl("c:\temp")
****************************************************
FUNCTION GoUrl
******************
***    Author: Rick Strahl
***            (c) West Wind Technologies, 1996
***   Contact: rstrahl@west-wind.com
***  Modified: 03/14/96
***  Function: Starts associated Web Browser
***            and goes to the specified URL.
***            If Browser is already open it
***            reloads the page.
***    Assume: Works only on Win95 and NT 4.0
***      Pass: tcUrl  - The URL of the site or
***                     HTML page to bring up
***                     in the Browser
***    Return: 2  - Bad Association (invalid URL)
***            31 - No application association
***            29 - Failure to load application
***            30 - Application is busy 
***
***            Values over 32 indicate success
***            and return an instance handle for
***            the application started (the browser) 
****************************************************
LPARAMETERS tcUrl, tcAction, tcDirectory, tcParms

IF EMPTY(tcUrl)
   RETURN -1
ENDIF
IF EMPTY(tcAction)
   tcAction = "OPEN"
ENDIF
IF EMPTY(tcDirectory)
   tcDirectory = SYS(2023) 
ENDIF

DECLARE INTEGER ShellExecute ;
    IN SHELL32.dll ;
    INTEGER nWinHandle,;
    STRING cOperation,;
    STRING cFileName,;
    STRING cParameters,;
    STRING cDirectory,;
    INTEGER nShowWindow
IF EMPTY(tcParms)
   tcParms = ""
ENDIF

DECLARE INTEGER FindWindow ;
   IN WIN32API ;
   STRING cNull,STRING cWinName

RETURN ShellExecute(0,;
                    tcAction,tcUrl,;
                    tcParms,tcDirectory,1)
Hope this helps,

This also works for URLs and opening any documents like:
GoUrl("http://www.west-wind.com/")

*** Opens files in appropriate application
GoUrl("c:\temp\worddoc.doc")
GoUrl("c:\temp\worddoc.pdf")
+++ Rick ---

>I want to open a windows explorer in it's own window and navigate to a given directory.
>
>If this were internet explorer I would
>
>oIE = CREATEOBJECT("InternetExplorer.Application")
>
>oIE.Navigate("http://some web site/")
>oIE.Visible = .t.
>
>
>I want to do the same thing with internet explorer but can't find the class name to even experiment.
>
>TIA
>
>Mike
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform