-
Does anyone know what the output of a Shell Command is?
Private Sub Command2_Click()
Dim fullstring As String
Dim iShell As String
fullstring = "Z:\NCOPY.EXE"
iShell = Shell(fullstring, vbMaximizedFocus)
MsgBox iShell, vbCritical
End Sub
The output of the MsgBox is -1720537 . Does this tell me anything? Can I use that for anything? What is it? If you have any info, or you have no clue, let me know. Thanks in advance!!
~Brian
-
It's the Task ID of the created process. You can use this with the API functions to get things like the main window, and suchlike.
-
<?>
Using shell you are calling another program.
Private Sub Command2_Click()
Dim fullstring As String
Dim iShell As String
'fullstring is Drive Z and an exe program called NCOPY
fullstring = "Z:\NCOPY.EXE"
iShell = Shell(fullstring, vbMaximizedFocus)
'here it is calling the program to a maximized screen
iShell, vbCritical
End Sub
-
Parksie, can you give me some exaples of what I can do with it?
-
<?>
[code]
'use notepad and make a file and save it as c:\my documents\mytext.txt
'put this in a command button
Dim RetVal
RetVal = Shell("C:\My Documents\notepad.exe C:\WINDOWS\mytext.txt", 1)
-
You can pass it to AppActivate, rather than a window title.
-
<?>
if you have time on your hands..play with this sucker
found it somewhere some time ago..
[code]Use the following snippet to Shell the date/time dialog.
Substitute the codes below for other Control Panel dialogs.
Call Shell("rundll32.exe shell32.dll,Control_RunDLL _ timedate.cpl")
Couldn't be much easier, could it? The only trick is knowing the "secret code" for each dialog.
Now, while the above will bring up the date/time dialog, your VB app will have no way of knowing when that dialog has been dismissed.
For the answer to that, go to my Samples page and download Shell32.zip which shows several methods you can use to "shell and wait."
So, what are the secret codes? Here ya go...
Control Panel (CONTROL.EXE)
Control Panel:
rundll32.exe shell32.dll,Control_RunDLL
Accessability Settings (ACCESS.CPL)
Accessability Properties (Keyboard):
rundll32.exe shell32.dll,Control_RunDLL access.cpl,,1
Accessability Properties (Sound):
rundll32.exe shell32.dll,Control_RunDLL access.cpl,,2
Accessability Properties (Display):
rundll32.exe shell32.dll,Control_RunDLL access.cpl,,3
Accessability Properties (Mouse):
rundll32.exe shell32.dll,Control_RunDLL access.cpl,,4
Accessability Properties (General):
rundll32.exe shell32.dll,Control_RunDLL access.cpl,,5
Add/Remove Programs (APPWIZ.CPL)
Add/Remove Programs Properties (Install/Uninstall):
rundll32.exe shell32.dll,Control_RunDLL appwiz.cpl,,1
Add/Remove Programs Properties (Windows Setup):
rundll32.exe shell32.dll,Control_RunDLL appwiz.cpl,,2
Add/Remove Programs Properties (Startup Disk):
rundll32.exe shell32.dll,Control_RunDLL appwiz.cpl,,3
Display Settings (DESK.CPL)
Display Properties (Background):
rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,0
Display Properties (Screen Saver):
rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,1
Display Properties (Appearance):
rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,2
Display Properties (Settings):
rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,3
--------------------------------------------------------------------------------
Display Properties (Install Screen Saver):
rundll32.exe desk.cpl,InstallScreenSaver %1
(opens .scr at location specified by %1 in preview window)
FindFast Settings (FINDFAST.CPL)
Find Fast Properties (General):
rundll32.exe shell32.dll,Control_RunDLL findfast.cpl
Internet Settings (INETCPL.CPL)
Internet Properties (General):
rundll32.exe shell32.dll,Control_RunDLL inetcpl.cpl,,0
Internet Properties (Security):
rundll32.exe shell32.dll,Control_RunDLL inetcpl.cpl,,1
Internet Properties (Content):
rundll32.exe shell32.dll,Control_RunDLL inetcpl.cpl,,2
Internet Properties (Connection):
rundll32.exe shell32.dll,Control_RunDLL inetcpl.cpl,,3
Internet Properties (Programs):
rundll32.exe shell32.dll,Control_RunDLL inetcpl.cpl,,4
Internet Properties (Advanced):
rundll32.exe shell32.dll,Control_RunDLL inetcpl.cpl,,5
Regional Settings (INTL.CPL)
Regional Settings Properties (Regional Settings):
rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,0
Regional Settings Properties (Number):
rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,1
Regional Settings Properties (Currency):
rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,2
Regional Settings Properties (Time):
rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,3
Regional Settings Properties (Date):
rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,4
Regional Settings Properties (Input Locales):
rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,5
Joystick Settings (JOY.CPL)
Joystick Properties (Joystick):
rundll32.exe shell32.dll,Control_RunDLL joy.cpl
Mouse/Keyboard/Printers/Fonts Settings (MAIN.CPL)
Mouse Properties:
rundll32.exe shell32.dll,Control_RunDLL main.cpl @0
Keyboard Properties:
rundll32.exe shell32.dll,Control_RunDLL main.cpl @1
Printers:
rundll32.exe shell32.dll,Control_RunDLL main.cpl @2
Fonts:
rundll32.exe shell32.dll,Control_RunDLL main.cpl @3
Mail and Fax Settings (MLCFG32.CPL)
Microsoft Exchange/Outlook Properties (General):
rundll32.exe shell32.dll,Control_RunDLL mlcfg32.cpl
Multimedia/Sounds Settings (MMSYS.CPL)
Multimedia Properties (Audio):
rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl,,0
Multimedia Properties (Video):
rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl,,1
Multimedia Properties (MIDI):
rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl,,2
Multimedia Properties (CD Music):
rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl,,3
Multimedia Properties (Advanced/Devices):
rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl,,4
--------------------------------------------------------------------------------
Sounds Properties:
rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl @1
Modem Settings (MODEM.CPL)
Modem Properties (General):
rundll32.exe shell32.dll,Control_RunDLL modem.cpl
Network Settings (NETCPL.CPL / NCPA.DLL)
Network (Configuration):
Win9x: rundll32.exe shell32.dll,Control_RunDLL netcpl.cpl
WinNT: rundll32.exe shell32.dll,Control_RunDLL ncpa.cpl
--------------------------------------------------------------------------------
Dial-up Networking Wizard
Win9x: rundll32.exe rnaui.dll,RnaWizard
--------------------------------------------------------------------------------
Create Share Dialog
WinNT: rundll32.exe ntlanui.dll,ShareCreate
Manage Shares Dialog
WinNT: rundll32.exe ntlanui.dll,ShareManage
ODBC Settings (ODBCCP32.CPL)
ODBC Data Source Administrator (General):
rundll32.exe shell32.dll,Control_RunDLL odbccp32.cpl
Password Settings (PASSWORD.CPL)
Password Properties (Change Passwords):
Win9x: rundll32.exe shell32.dll,Control_RunDLL password.cpl
COM Ports Settings (PORTS.CPL)
COM Ports Properties (General):
WinNT: rundll32.exe shell32.dll,Control_RunDLL ports.cpl
Server Properties (SRVMGR.CPL)
Server Properties (General):
WinNT: rundll32.exe shell32.dll,Control_RunDLL srvmgr.cpl
System Settings (SYSDM.CPL)
System Properties (General):
rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,0
System Properties (Device Manager):
Win9x: rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,1
System Properties (Performance):
Win9x: rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,3
WinNT: rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,1
System Properties (Environment):
WinNT: rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,2
System Properties (Startup/Shutdown):
WinNT: rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,3
System Properties (Hardware Profiles):
Win95: rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,2
WinNT: rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,4
System Properties (User Profiles):
WinNT: rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,5
--------------------------------------------------------------------------------
Add New Hardware Wizard:
Win9x: rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl @1
Add New Printer Wizard:
Win9x: rundll32.exe shell32.dll,SHHelpShortcuts_RunDLL AddPrinter
Telephony Settings (TELEPHON.CPL)
Dialing Properties (My Location / Drivers):
WinNT: rundll32.exe shell32.dll,Control_RunDLL telephon.cpl
Themes Settings (THEMES.CPL)
Themes Properties (General):
rundll32.exe shell32.dll,Control_RunDLL themes.cpl
Time and Date Settings (TIMEDATE.CPL)
Date/Time Properties:
rundll32.exe shell32.dll,Control_RunDLL timedate.cpl
Choose Time Zone:
rundll32.exe shell32.dll,Control_RunDLL timedate.cpl,,/f
TweakUI Settings (TWEAKUI.CPL)
TweakUI Dialog (General):
rundll32.exe shell32.dll,Control_RunDLL tweakui.cpl
UPS Settings (UPS.CPL)
Uninteruptable Power Supply Properties (General):
WinNT: rundll32.exe shell32.dll,Control_RunDLL ups.cpl
Microsoft Mail Postoffice Settings (WGPOCPL.CPL)
Microsoft Workgroup Postoffice Admin:
rundll32.exe shell32.dll,Control_RunDLL wgpocpl.cpl
Miscellaneous File System Dialogs and Wizards
Open With (File Associations):
rundll32.exe shell32.dll,OpenAs_RunDLL d:\path\filename.ext
Run Diskcopy Dialog:
rundll32 diskcopy.dll,DiskCopyRunDll
Create New Shortcut Wizard:
rundll32.exe AppWiz.Cpl,NewLinkHere %1
(creates shortcut at location specified by %1)
Create a Briefcase:
rundll32.exe syncui.dll,Briefcase_Create
View Fonts:
rundll32.exe shell32.dll,SHHelpShortcuts_RunDLL FontsFolder
View Printers:
rundll32.exe shell32.dll,SHHelpShortcuts_RunDLL PrintersFolder
--------------------------------------------------------------------------------
[code]
-
Er, HSJ - not so sure about those [ /code ] tags...
-
I am getting the feeling that those numbers are tough stuff.. :(