SHELL statement method

zhaozj2021-02-11  204

SHELL statement method

I. Whether the calling system "Create Shortcut" Wizard does not support VB does not support creating shortcuts? Although you can call VB5stkit. The FcreateshellLink function in the DLL, but it is designed for the installer. The default path of the shortcut is always starting from the current user's "\start menu\programs", that is, if your windows95 is put on the C drive, you Unable to create a shortcut to the D disk through the FcreateshellLink function. Now, give you an extremely convenient and clever way: call the system "Create Shortcut" wizard with the shell statement. Create a project, put a button on the form, double click this button, add the following code: private submmand1_click () open app.path & "/temp.lnk" for output as # 1close # 1 'above two sentences in the program Catalog creates a temporary file shell "rundll32.exe appwiz.cpl, newlinkhere" & app.path & "/temp.lnk"end Sub (Note: The backlinkhere in the shell statement is quotation, otherwise it will be wrong.) Run Program, press the command button, how? The "Create Short Square" wizard appears. If you create a success, the shortcut will take the location of the temporary file Temp.Lnk, if the selected cancels, the TEMP.LNK will automatically disappear. Of course, you can build TEMP.LNK at any location of the hard drive. Ok, now you can add a new function to your program. Enjoy! II. Uses of Rundll32.exe We know that using the shell statement can only call the executable file, which is exe, com, bat, and pif files, sometimes we want to call other system functions? At this point, Rundll32.exe provided by Windows can be big. Below let's meet these usage, we will bring you a little surprise. 1. To open the control panel file (TIMEDATE.CPL) of the setting system time, just run the following code: shell "rundll32.exeshell32.dll, control_rundll timedate.cpl" As for the other control panel file, I believe you will be able to raise a non-three, try it, Change the file name. 2. To run a shortcut (* .lnk), you can use the following code: SHE11 "Rundll32.exe Url.dll, FileProtocolhandler X" (x represents the file you want to run, including the path, the same .3. You can also write this way Open 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 "is of course installation screen protection, if you write a screen saver, you can write it in the installer, and don't have to install it under the system directory.

Let's mention it, VB is not a "Application Setup Wizard"? Its VB source code is placed in "/ setupkit / setup1" in the installation directory, study it. You can do a personalized installer. 5. Press and hold the Shift key, right click on a file, and the "Open Mode" option will appear in the menu, which may be no secret. But now, use shell "rundll32.exe shell32.dll opens_rundll x" to directly call the "Open Mode" box. 6. Can even use this to print a file (including all texts supported by HTML): shell "rundll32.exe mshtml.dll, printhtml x", 1 how? Is it a small harvest? This, you will definitely treat Rundll32.exe this usual, which is an essential component of the system run! In fact, shell Rundll32 can also call many other system functions, such as Netmeeting and Telnet. If you are interested, you can go to the book "My Computer \ Key_CLASS_ROOT ot" or "My Computer / HKEY_MACAL_MACHINE / SOFTWARE / CLASSES" to see, this article is mostly "copying" there. As long as there is enough determination, confidence, patience, you will find more value-worth. The above code from: the source code database (SourceDataBase) Current Version: 1.0.445 Author: Shawls profile: Http://Shawls.Yeah.Net E-Mail: ShawFile@163.Net QQ: 9181729

转载请注明原文地址:https://www.9cbs.com/read-4843.html

New Post(0)