Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Shellexecute and dos (CMD) window
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00140918
Message ID:
00140941
Vues:
34
>The following code (borrowed from David Frankenbach and modified) will map a drive, but it pulls up a dos window momentarily. Is there anyway to stop this or minimize the window while it is executing?
>
>
>declare long ShellExecute in "shell32.dll" long hwnd, string lpszOp, ;
>string lpszFile, string lpszParams, ;
>string lpszDir, long nShowCmd
>declare long GetDesktopWindow in "win32api"
>local hDCScreen
>hDCScreen = GetDesktopWindow()
>mcommand=" use * \\myserver\c$"
>ShellExecute(hDCScreen, "open", "c:\winnt\system32\net.exe", mcommand, "c:\", 1 )

Several. You can use the LaunchAppAndWait() function that I recently put up in the FAQ to use CreateProcess() to run the NET command completely hidden or minimized. You can use WNetAddConnection() (a Win32API call) to map the drive. You can use ShellExecuteEx (a more complex form of ShellExecute()) and populate the nShow member of the SHELLEXECUTEINFO structure with the correct code for the ShowWindow mode mode that you want (use the value I use in my CreateProcess() example in launchAppAndWait().) You can also use the ShellExecute() call and correctly populate the nShowCmd property (again, it uses the same SW_ values as CreateProcess() in the PROCESSINFO structure, or the nShow member of SHELLEXECUTEINFO).
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform