Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Shellexecute and dos (CMD) window
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00140918
Message ID:
00140946
Views:
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).


Thanks for the help, I'll check out the FAQ.
John Harvey
Shelbynet.com

"I'm addicted to placebos. I could quit, but it wouldn't matter." Stephen Wright
Previous
Reply
Map
View

Click here to load this message in the networking platform