用VB.net编写一个加密解密软件
"采用DES算法"这个说法不明确,首先是使用多少位的DES进行加密,通常是128位或192位,其次是,要先把主密钥转化成散列,才能供DES进行加密,转化的方法是什么没有明确,通常是md5,所以有的银行卡说是128位md5 3DS就是指用md5转换主密钥散列,用DES进行加密,但是DES本身是64位(包含校验码),2DES是128位,3DES是192位,但是没有2DES的叫法,所以128位、192位统称3DES要完整的md5+3DS实例,需要100分以上,要不到我的空间中查找相关的文章
vb net只运行一个程序
方法一:通过Diagnostics.Process.GetProcessesByName函数来检测程序是否已经启动Imports System.Windows.FormsModule Module1 Sub Main() '检测多重启动 If Diagnostics.Process.GetProcessesByName( _ Diagnostics.Process.GetCurrentProcess.ProcessName).Length > 1 Then MessageBox.Show("已经一个实例的本程序正在运行。
") Return End If Application.Run(New Form()) End SubEnd Module不过这个方法有个缺点,如果用户改了下exe的名字就检测不到了,所以更好的方法如下方法2:使用MutexImports System.Windows.FormsModule Module1 Sub Main() Dim createdNew As Boolean ' 创建mutex Dim mutex As System.Threading.Mutex = _ New System.Threading.Mutex(True, "YourAppName", createdNew) If createdNew = False Then MessageBox.Show("已经一个实例的本程序正在运行。
") Return End If Application.Run(New Form()) ' 释放mutex mutex.ReleaseMutex() End SubEnd Module...
我用vb写了一个软件,我要一打开那个软件,软件就会开机自行启动.......
1、注册表方式模块代码OptionExplicitPublic Declare FunctionRegSetValueExLib"advapi32.dll"Alias"RegSetValueExA"(ByValhKeyAs Long,ByVallpValueNameAs String,ByValReservedAs Long,ByValdwTypeAs Long, lpDataAsAny,ByValcbDataAs Long)As LongPublic Declare FunctionRegCreateKeyLib"advapi32.dll"Alias"RegCreateKeyA"(ByValhKeyAs Long,ByVallpSubKeyAs String, phkResultAs Long)As LongPublic Declare FunctionRegCloseKeyLib"advapi32.dll"(ByValhKeyAs Long)As LongPublic Declare FunctionRegDeleteValueLib"advapi32.dll"Alias"RegDeleteValueA"(ByValhKeyAs Long,ByVallpValueNameAs String)As LongPublic ConstREG_SZ=1Public ConstHKEY_LOCAL_MACHINE=&H80000002'**************************************************************************************'**函 数 名: SetAutoRun'**输 入: ByVal Autorun(Boolean)'**功能描述: 随WINDOWS自动启动/取消启动模块'**调用方法: Call SetAutoRun(True/False)'*************************************************************************Public SubSetAutoRun(ByValAutorunAs Boolean)DimKeyIdAs LongDimMyexePathAs StringDimregkeyAs StringMyexePath=App.Path&"\"&App.EXEName&".exe"'获取程序位置regkey="Software\Microsoft\Windows\CurrentVersion\Run"'键值位置变量CallRegCreateKey(HKEY_LOCAL_MACHINE, regkey, KeyId)'建立IfAutorunThenRegSetValueEx KeyId,"MySoftware",0&, REG_SZ,ByValMyexePath, LenB(MyexePath)ElseRegDeleteValue KeyId,"MySoftware"End IfRegCloseKey KeyIdEnd Sub调用方法SetAutoRun(ByValAutorunAs Boolean)-----------------------------------------------------------------------------------------------2、引用系统里面都有的WSHom.OcxOptionExplicit'*************************************************************************'**函 数 名: SetAutoRun'**输 入: ByVal Autorun(Boolean)'**功能描述: 随WINDOWS自动启动/取消启动模块'**调用方法: Call SetAutoRun(True/False)'*************************************************************************Public SubSetAutoRun(ByValAutorunAs Boolean)'WshShell 对象'ProgId Wscript.Shell'文件名 WSHom.OcxDimWshShellAsWshShellSetWshShell=CreateObject("Wscript.Shell")IfAutorunThenWshShell.RegWrite"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\"&App.EXEName, App.Path&"\"&App.EXEName&".exe"ElseWshShell.RegDelete"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\"&App.EXENameEnd IfSetWshShell=NothingEnd Sub
vb和vb.net写大型软件哪个好用?
Imports System.IOImports System.IO.Directory' ======================================================' 实现一个静态方法将指定文件夹下面的所有内容del' 如果目标文件夹为只读属性就会报错。
' ======================================================Public Shared Sub DelDir(ByVal srcPath As String, ByVal aimPath As String)Try' 检查目标目录是否以目录分割字符\结束,如果不是则添加之If aimPath(aimPath.Length - 1) <> Path.DirectorySeparatorChar ThenaimPath += Path.DirectorySeparatorCharEnd If'判断源目录是否存在,不存在则退出.If (Not Directory.Exists(srcPath)) Then Exit Sub' 判断目标目录是否存在如果不存在则新建之If (Not Directory.Exists(aimPath)) Then Directory.CreateDirectory(aimPath)' 得到源目录的文件列表,该里面是包含文件以及目录路径的一个数组Dim fileList() As String = Directory.GetFileSystemEntries(srcPath)' 遍历所有的文件和目录For Each FileName As String In fileList' 先当作目录处理如果存在这个目录就递归Copy该目录下面的文件If Directory.Exists(FileName) Then' 直接Delete文件File.Delete(aimPath + Path.GetFileName(FileName))end ifNextCatch ex As ExceptionMessageBox.Show(ex.ToString())End TryEnd Sub然后你定义一个timer设定循环时间,时间到则调用这个即可
用VB.NET编写一个程序 :编一求阶乘的函数f(n),主调程序求组合数...
展开全部 首先添加一个系统的语音COM组件的引用microsoft speech object library然后在程序中声明一个语音类dim RC As SpeechLib.SpSharedRecoContext这个类有一些事件,如果你要处理它的一些事件,可以用withevent来声明然后在窗体LOAD事件或你需要的地方先创建一个实例RC = New SpeechLib.SpSharedRecoContext当一个RC被实例化后,系统就会运行语音识别程序.前提是你的系统已经正确安装这个功能.一般默认就已经安装好的.其次提醒一下,WIN7的语音识别比XP的好N倍.从阅读到侦听都好很多.然后就可以在你需要阅读的地方使用RC.Voice.Speak("hello 我", 11)11那里是一些枚举,用来标识系统用前台还是后台或其他方式来阅读文字,简单的来说就是阅读的时候不会卡住你的程序.你可以选其他的枚举来试试作用.以上为阅读部分.如果需要程序听你说话,则需要声明一个侦听类dim RG As SpeechLib.ISpeechRecoGrammar在初始化时将之与上面的RC建立关系,此时则必须要用withevent来声明上面的RC,因为涉及电脑听到你的语音后,会触发一个事件,并将听到的内容传递到该事件.其次,要让系统听到的解析为命令,就必须准备一个XML结构的文件来保存那些固定的命令.如果电脑在XML文件中找不到那些固定命令或同时不属于系统命令,电脑将会将其解释为听写.RG = RC.CreateGrammar '(0)RG.CmdLoadFromFile("听到.xml", SpeechLib.SpeechLoadOption.SLODynamic)RG.CmdSetRuleIdState(0, SpeechLib.SpeechRuleState.SGDSActive)然后写一个过程来处理听到的事件Private Sub 听到命令(ByVal StreamNumber As Integer, ByVal StreamPosition As Object, ByVal RecognitionType As SpeechLib.SpeechRecognitionType, ByVal 话语 As SpeechLib.ISpeechRecoResult) Handles RC.Recognition RC.Voice.Speak("我听到了" & 话语.PhraseInfo.GetText, 11)End Sub以上为侦听部分.下面列一个XML的例文打开播放器上我的QQ关闭你自己 要让系统正确地侦听到你说的话,前提你必须运行语音识别程序并让其激活到"正在聆听"状态.并且你必须有一个能正常使用的话筒而且保证话筒已经打开.(废话-_-|||)以上就是用VB.NET语音识别的最基本的一些操作.希望对你有帮助.更深入的内容有兴趣的话可以和我一起研究.
如何用vb.net做鼠标输入软件
方法一:调用api在Visual Baisc.net中的声明: Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)Public Const MOUSEEVENTF_LEFTDOWN = &H2 '模拟鼠标左键按下Public Const MOUSEEVENTF_LEFTUP = &H4 '模拟鼠标左键释放Public Const MOUSEEVENTF_MIDDLEDOWN = &H20 '模拟鼠标中间键按下Public Const MOUSEEVENTF_MIDDLEUP = &H40 '模拟鼠标中间键释放Public Const MOUSEEVENTF_RIGHTDOWN = &H8 '模拟鼠标右键按下Public Const MOUSEEVENTF_RIGHTUP = &H10 '模拟鼠标右键释放Public Const MOUSEEVENTF_MOVE = &H1 '模拟鼠标指针移动例:mouse_event MOUSEEVENTF_LEFTDOWN,10,10,0,0 '在(10,10)模拟鼠标左键按下方法二:namespace ClassLibrary.Hardware { public class Mouse { internal const byte SM_MOUSEPRESENT = 19; internal const byte SM_CMOUSEBUTTONS = 43; internal const byte SM_MOUSEWHEELPRESENT = 75; internal struct POINTAPI { internal int x; internal int y; } internal struct RECT { internal int left ; internal int top ; internal int right ; internal int bottom ; } [System.Runtime.InteropServices.DllImport("user32.dll" , EntryPoint="SwapMouseButton")] internal extern static int SwapMouseButton ( int bSwap ); [System.Runtime.InteropServices.DllImport("user32" , EntryPoint="ClipCursor")] internal extern static int ClipCursor(ref RECT lpRect); [System.Runtime.InteropServices.DllImport( "user32.dll" , EntryPoint="GetCursorPos" )] internal extern static int GetCursorPos( ref POINTAPI lpPoint ); [System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint="ShowCursor")] internal extern static bool ShowCursor ( bool bShow ) ; [System.Runtime.InteropServices.DllImport( "user32.dll" , EntryPoint = "EnableWindow" )] internal extern static int EnableWindow( int hwnd , int fEnable ); [System.Runtime.InteropServices.DllImport("user32.dll" , EntryPoint="GetWindowRect")] internal extern static int GetWindowRect( int hwnd , ref RECT lpRect ) ; [System.Runtime.InteropServices.DllImport("user32.dll" , EntryPoint="SetCursorPos")] internal extern static int SetCursorPos ( int x , int y ) ; [System.Runtime.InteropServices.DllImport("user32.dll" , EntryPoint="GetSystemMetrics")] internal extern static int GetSystemMetrics( int nIndex ); [System.Runtime.InteropServices.DllImport("user32.dll" , EntryPoint="SetDoubleClickTime")] internal extern static int SetDoubleClickTime ( int wCount ); [System.Runtime.InteropServices.DllImport("user32.dll" , EntryPoint="GetDoubleClickTime")] internal extern static int GetDoubleClickTime() ; [System.Runtime.InteropServices.DllImport("kernel32.DLL", EntryPoint="Sleep")] internal extern static void Sleep ( int dwMilliseconds ) ; //得到鼠标相对与全屏的坐标,不是相对与你的Form的,且与你的分辨率有关系 public static int FullScreenPosition_X { get { POINTAPI _POINTAPI = new POINTAPI(); GetCursorPos ( ref _POINTAPI ); return _POINTAPI.x; } } public static int FullScreenPosition_Y { get { POINTAPI _POINTAPI = new POINTAPI(); GetCursorPos ( ref _POINTAPI ); return _POINTAPI.y; } } // 隐藏 显示 鼠标 public static void Hide() { ShowCursor( false ) ; } public static void Show() { ShowCursor( true ) ; } // 将鼠标锁定在你的Form里 不过你得将你的Form先锁了,Form Resize 就失效了 public static void Lock( System.Windows.Forms.Form ObjectForm ) { RECT _FormRect = new RECT (); GetWindowRect( ObjectForm.Handle.ToInt32() , ref _FormRect ); ClipCursor( ref _FormRect ); } public static void UnLock() { RECT _ScreenRect = new RECT (); _ScreenRect.top = 0; _ScreenRect.left = 0; _ScreenRect.bottom = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Bottom; _ScreenRect.right = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Right; ClipCursor( ref _ScreenRect ); } // 鼠标失效,不过失效的好像不只是鼠标,小心哦 public static void Disable( System.Windows.Forms.Form ObjectForm ) { EnableWindow( ObjectForm.Handle.ToInt32() , 0 ) ; } public static void Enable( System.Windows.Forms.Form ObjectForm ) { EnableWindow( ObjectForm.Handle.ToInt32() , 1 ) ; } // 鼠标自己移动 很想动画哦 参数是2个控件的handle // 看这个方法前,先用凉水擦把脸。
。
。
反正我写的时候 头晕 public static void Move ( int From_Handle_ToInt32 , int To_Handle_ToInt32 ) { RECT rectFrom = new RECT () ; RECT rectTo = new RECT () ; int i ; GetWindowRect( From_Handle_ToInt32 , ref rectFrom ...
转载请注明出处51数据库 » vb.net 写一个软件