Shell statement usage

Source: Internet
Author: User
Shell statement usage tips 1. Are you anxious to call the system "create shortcuts" Wizard to create shortcuts that VB does not support? Although you can call the fcreateshelllink function in vb5stkit. dll,
But it is designed for the installer. The default path of the shortcut always starts from the current user's "/Start Menu/programs", that is,
If your Windows 95 is attached to drive C, you cannot use the fcreateshelllink function to create a shortcut to drive D. Now, we will introduce you to an extremely convenient and clever Method: Using shell statements to call the system "create shortcuts" Wizard. Create a new project, put a button on the form, double-click this button, and add the following code: private sub commandementclick () open app. path & "/temp. lnk "for output as #1 close #1 'the above two statements create a temporary file shell" rundll32.exe appwiz in the directory where the program is located. CPL, newlinkhere "& App. path & "/temp. lnk "End sub (Note: In a shell statement, newlinkhere is followed by a space. Otherwise, an error occurs .) Run the program and click the command button. How can this problem be solved? The "create shortcut" Wizard appears. If the creation is successful, the shortcut will take
The location of the temporary file temp. lnk. If you cancel the file, the temp. lnk will automatically disappear. Of course,
You can create temp. lnk anywhere on the hard disk. Now you can add a new feature to your program. Enjoy! II. The purpose of rundll32.exe we know that using shell statements can only call executable files, that is, EXE, COM, bat, and PIF files,
What if we want to call other system functions? In this case, the rundll32.exe provided by Windows is ready to use.
Let's take a look at these usage, which may surprise you. 1. to open the control panel file (TimeDate. CPL), just run the following code: shell "rundll32.exe shell32.dll, control_rundll TimeDate. cpl "As for opening other Control Panel files, I believe you will be able to put it apart. Try again and change the file name. 2. to run a shortcut (*. you can use the following code: she11 "rundll32.exe URL. DLL, fileprotocolhandler X "(X indicates the file to be run, including the path, the same below .) 3. you can also write it in this way to enable activemovie control: shell "rundll32.exe amovie. OCX, rundll ", 1 and shell" rundll32.exe amovie. OCX, rundll/play X ", 1 will play the media file directly. 4. Shell "rundll32.exe desk. CPL, installscreensaver X", of course, screen protection is installed,
If you write a screen saver, you can write it in the installer, instead of installing it in the system directory.
By the way, isn't VB a self-fishing "application Setup Wizard? Its VB source code is in the installation directory
Put it in "/setupkit/setup1" and study it well. You can make personalized installation programs. 5. Press shift and Right-click a file. The "open mode" option appears in the menu, which may not be a secret. But now,
Use shell "rundll32.exe shell32.dll openas_rundll X" to directly call the "open mode" box. 6. You can even use this sentence to print files (including all the text and image formats supported by HTML): shell "rundll32.exe mshtml. dll, printhtml X", how about 1? Is there a small reward? Now, you will certainly treat rundll32.exe, an ordinary file, with a different eye,
It is an essential part for system operation! In fact, shell + rundll32 can call many other system functions,
For example, NetMeeting and telnet. If you are interested, you can
Go to "my computer/hkey_classes_root/" or "My computer/HKEY_LOCAL_MACHINE/software/classes" in the table,
Most of the content in this article is copied from there. With enough determination, confidence, and patience, you can discover more valuable things. Good luck!
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.