临时
VERSION 5.00 Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX" Begin VB.Form Form1 BorderStyle = 1 'Fixed Single Caption = "右键助手" ClientHeight = 4710 ClientLeft = 45 ClientTop = 435 ClientWidth = 4470 BeginProperty Font Name = "宋体" Size = 10.5 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Icon = "Form1.frx":0000 KeyPreview = -1 'True LinkTopic = "Form1" MaxButton = 0 'False ScaleHeight = 314 ScaleMode = 3 'Pixel ScaleWidth = 298 StartUpPosition = 2 '屏幕中心 Begin VB.Frame frmAllFile Caption = "文件|文件夹的右键菜单" Height = 1500 Left = 225 TabIndex = 10 Top = 225 Width = 4050 Begin VB.CheckBox chkNotepad Caption = "文件右键显示""记事本编辑""" Height = 255 Left = 240 TabIndex = 13 Top = 960 Width = 3090 End Begin VB.CheckBox chkRegdll Caption = "ocx,dll文件显示""注册/取消注册""" Height = 255 Left = 240 TabIndex = 12 Top = 660 Width = 3585 End Begin VB.CheckBox chkCopyPath Caption = "右键菜单显示""复制路径""" Height = 255 Left = 240 TabIndex = 11 Top = 360 Width = 2700 End End Begin VB.Frame frmOffice Caption = "我的电脑|文件夹|开始按钮的右键菜单" Height = 2700 Left = 225 TabIndex = 0 ToolTipText = "按下F5,同步复选框状态." Top = 1800 Width = 4050 Begin VB.CheckBox chkAddexe Caption = "显示在右键" Height = 255 Left = 2500 TabIndex = 9 Top = 2085 Width = 1360 End Begin VB.TextBox Text1 Height = 330 Left = 240 TabIndex = 6 Top = 2040 Width = 2055 End Begin MSComDlg.CommonDialog CommonDialog1 Left = 3090 Top = 1305 _ExtentX = 847 _ExtentY = 847 _Version = 393216 CancelError = -1 'True DefaultExt = "*.exe" Filter = "可执行文件(*.exe)|*.exe" End Begin VB.CheckBox Outlook Caption = "Outlook" Height = 255 Left = 1500 TabIndex = 5 Top = 1260 Width = 1095 End Begin VB.CheckBox MSAccess Caption = "Access" Height = 255 Left = 240 TabIndex = 4 Top = 1260 Width = 1095 End Begin VB.CheckBox PowerPnt Caption = "PowerPoint" Height = 255 Left = 240 TabIndex = 3 Top = 960 Width = 1400 End Begin VB.CheckBox winWord Caption = "Word" Height = 255 Left = 1500 TabIndex = 2 Top = 660 Width = 1095 End Begin VB.CheckBox Excel Caption = "Excel" Height = 255 Left = 240 TabIndex = 1 Top = 660 Width = 1095 End Begin VB.Label Label1 AutoSize = -1 'True Caption = "双击文本框选择应用程序" Height = 210 Index = 1 Left = 240 TabIndex = 8 Top = 1695 Width = 2310 End Begin VB.Label Label1 AutoSize = -1 'True Caption = "Office常用组件" Height = 210 Index = 0 Left = 240 TabIndex = 7 Top = 360 Width = 1470 End End End Attribute VB_Name = "Form1" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Compare Text Private Const Mainkey_dll As String = "HKEY_CLASSES_ROOT\dllfile\shell" Private Const Mainkey_ocx As String = "HKEY_CLASSES_ROOT\ocxfile\shell" Private Declare Sub SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) Private Const Mainkey As String = "HKEY_CLASSES_ROOT\Folder\shell" Private Const Mainkey_allfile As String = "HKEY_CLASSES_ROOT\AllFilesystemObjects\shell" Private Const Mainkey_star As String = "HKEY_CLASSES_ROOT\*\shell" Dim WSH As New WshShell, FSO As New FileSystemObject '特别注意的是复选框的Click事件,MouseDown事件,对Value的判断是相反的.因此把1改为0 Private Sub chkAddexe_Click() On Error GoTo Err1 Dim Base As String If FSO.FileExists(Me.Text1.Text) = False Then MsgBox "文件不存在,请核对!" Me.Text1.SetFocus Else Base = FSO.GetBaseName(Me.Text1.Text) If Me.chkAddexe.Value = 1 Then WSH.RegWrite Mainkey & "\" & Base & "\command\", Me.Text1.Text & " %1" Else WSH.RegDelete Mainkey & "\" & Base & "\command\" WSH.RegDelete Mainkey & "\" & Base & "\" End If End If Exit Sub Err1: MsgBox Err.Description End Sub Private Sub Update() On Error Resume Next Dim Flag(1 To 15) As String Flag(1) = WSH.RegRead(Mainkey & "\1Excel\command\") Flag(2) = WSH.RegRead(Mainkey & "\2Word\command\") Flag(3) = WSH.RegRead(Mainkey & "\3PowerPnt\command\") Flag(4) = WSH.RegRead(Mainkey & "\4Access\command\") Flag(5) = WSH.RegRead(Mainkey & "\5Outlook\command\") Me.Excel.Value = IIf(Flag(1) = "", 0, 1) Me.winWord.Value = IIf(Flag(2) = "", 0, 1) Me.PowerPnt.Value = IIf(Flag(3) = "", 0, 1) Me.MSAccess.Value = IIf(Flag(4) = "", 0, 1) Me.Outlook.Value = IIf(Flag(5) = "", 0, 1) Flag(6) = WSH.RegRead(Mainkey_allfile & "\CopyPath\command\") Me.chkCopyPath.Value = IIf(Flag(6) = "", 0, 1) Flag(7) = WSH.RegRead(Mainkey_dll & "\Reg\command\") Me.chkRegdll.Value = IIf(Flag(7) = "", 0, 1) Flag(8) = WSH.RegRead(Mainkey_star & "\Notepad\command\") Me.chkNotepad.Value = IIf(Flag(8) = "", 0, 1) End Sub Private Sub chkCopyPath_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) On Error GoTo Err1 If Me.chkCopyPath.Value = 0 Then WSH.RegWrite Mainkey_allfile & "\CopyPath\", "复制路径" WSH.RegWrite Mainkey_allfile & "\CopyPath\command\", App.Path & "\RegWrite.exe" & " %1" Else WSH.RegDelete Mainkey_allfile & "\CopyPath\command\" WSH.RegDelete Mainkey_allfile & "\CopyPath\" End If Exit Sub Err1: MsgBox Err.Description End Sub Private Sub chkNotepad_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) On Error GoTo Err1 If Me.chkNotepad.Value = 0 Then WSH.RegWrite Mainkey_star & "\Notepad\", "记事本编辑" WSH.RegWrite Mainkey_star & "\Notepad\command\", "Notepad.exe %1" Else WSH.RegDelete Mainkey_star & "\Notepad\command\" WSH.RegDelete Mainkey_star & "\Notepad\" End If Exit Sub Err1: MsgBox Err.Description End Sub Private Sub chkRegdll_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) On Error GoTo Err1 If Me.chkRegdll.Value = 0 Then WSH.RegWrite Mainkey_dll & "\Reg\", "注册" WSH.RegWrite Mainkey_dll & "\Reg\command\", "regsvr32.exe %1" WSH.RegWrite Mainkey_ocx & "\Reg\", "注册" WSH.RegWrite Mainkey_ocx & "\Reg\command\", "regsvr32.exe %1" WSH.RegWrite Mainkey_dll & "\UnReg\", "取消注册" WSH.RegWrite Mainkey_dll & "\UnReg\command\", "regsvr32.exe /u %1" WSH.RegWrite Mainkey_ocx & "\UnReg\", "取消注册" WSH.RegWrite Mainkey_ocx & "\UnReg\command\", "regsvr32.exe /u %1" Else WSH.RegDelete Mainkey_dll & "\Reg\command\" WSH.RegDelete Mainkey_dll & "\Reg\" WSH.RegDelete Mainkey_ocx & "\Reg\command\" WSH.RegDelete Mainkey_ocx & "\Reg\" WSH.RegDelete Mainkey_dll & "\Unreg\command\" WSH.RegDelete Mainkey_dll & "\Unreg\" WSH.RegDelete Mainkey_ocx & "\Unreg\command\" WSH.RegDelete Mainkey_ocx & "\Unreg\" End If Exit Sub Err1: MsgBox Err.Description End Sub Private Sub Excel_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) On Error GoTo Err1 If Excel.Value = 0 Then WSH.RegWrite Mainkey & "\1Excel\", "Excel" WSH.RegWrite Mainkey & "\1Excel\command\", "excel" Else WSH.RegDelete Mainkey & "\1Excel\command\" WSH.RegDelete Mainkey & "\1Excel\" End If Exit Sub Err1: MsgBox Err.Description End Sub Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyF5 Then Update End Sub Private Sub Form_Load() On Error GoTo Err1 SetWindowPos Me.hwnd, -1, 0, 0, 0, 0, 3 Update Exit Sub Err1: MsgBox Err.Description End Sub Private Sub Form_Unload(Cancel As Integer) Set WSH = Nothing End Sub Private Sub MSAccess_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) On Error GoTo Err1 If MSAccess.Value = 0 Then WSH.RegWrite Mainkey & "\4Access\", "Access" WSH.RegWrite Mainkey & "\4Access\command\", "MSAccess" Else WSH.RegDelete Mainkey & "\4Access\command\" WSH.RegDelete Mainkey & "\4Access\" End If Exit Sub Err1: MsgBox Err.Description End Sub Private Sub Option1_Click() Me.frmAllFile.ZOrder 0 End Sub Private Sub Option2_Click() Me.frmOffice.ZOrder 0 End Sub Private Sub Outlook_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) On Error GoTo Err1 If Outlook.Value = 0 Then WSH.RegWrite Mainkey & "\5Outlook\", "Outlook" WSH.RegWrite Mainkey & "\5Outlook\command\", "Outlook" Else WSH.RegDelete Mainkey & "\5Outlook\command\" WSH.RegDelete Mainkey & "\5Outlook\" End If Exit Sub Err1: MsgBox Err.Description End Sub Private Sub PowerPnt_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) On Error GoTo Err1 If PowerPnt.Value = 0 Then WSH.RegWrite Mainkey & "\3PowerPnt\", "PowerPoint" WSH.RegWrite Mainkey & "\3PowerPnt\command\", "Powerpnt" Else WSH.RegDelete Mainkey & "\3PowerPnt\command\" WSH.RegDelete Mainkey & "\3PowerPnt\" End If Exit Sub Err1: MsgBox Err.Description End Sub Private Sub Text1_Change() Me.Text1.ToolTipText = Me.Text1.Text End Sub Private Sub Text1_DblClick() On Error GoTo Err1 With Me.CommonDialog1 .ShowOpen If .FileName <> "" Then Me.Text1.Text = .FileName End If End With Exit Sub Err1: MsgBox Err.Description End Sub Private Sub winWord_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) On Error GoTo Err1 If winWord.Value = 0 Then WSH.RegWrite Mainkey & "\2Word\", "Word" WSH.RegWrite Mainkey & "\2Word\command\", "winWord" Else WSH.RegDelete Mainkey & "\2Word\command\" WSH.RegDelete Mainkey & "\2Word\" End If Exit Sub Err1: MsgBox Err.Description End Sub
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WBB
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
this.webBrowser1.Navigate("http://1.1.1.3/ac_portal/default/pc.html?tabs=pwd");
}
private void button2_Click(object sender, EventArgs e)
{
this.webBrowser1.Document.InvokeScript("execScript",new object[]{"alert(document.URL)","javascript"});
}
}
}