189 8069 5689

vb.net制作录屏软件,录制屏幕免费录屏软件

如何用VB.NET写一个简单的屏幕保护程序?

在窗体上建立2个文本框text1和text2,一个按钮command1,text1里面输入你要转换的字符串,text2里面显示结果,代码如下:

在临颍等地区,都构建了全面的区域性战略布局,加强发展的系统性、市场前瞻性、产品创新能力,以专注、极致的服务理念,为客户提供成都网站设计、成都网站建设 网站设计制作定制网站建设,公司网站建设,企业网站建设,成都品牌网站建设,营销型网站建设,外贸营销网站建设,临颍网站建设费用合理。

Dim MyString As String

Dim EveryStr(50) As String

Dim TargetStr As String

Private Sub Command1_Click()

MyString = Text1

For i = 1 To Len(MyString)

EveryStr(i) = Right(Left(MyString, i), 1)

If Asc(EveryStr(i)) 123 And Asc(EveryStr(i)) 96 Then EveryStr(i) = \"_\"

If Asc(EveryStr(i)) 91 And Asc(EveryStr(i)) 64 Then EveryStr(i) = \"_\"

TargetStr = TargetStr EveryStr(i)

Next i

Text2 = TargetStr

TargetStr = \"\"

End Sub

引号前面怎么自动给加了个“\”?用的时候请手动把那几个“\”去掉

简单的播放器用vb.net怎么做啊

右击工具箱/部件/WindowsMediaPlayer

//类模块Mmedia

Option Explicit

'-----------------------------------------------------

' Name : MMedia.cls

' Author : Peter Wright, For BG2VB4 BG2VB5

'

' Notes : A multimedia class, which when turned

' : into an object lets you load and play

' : multimedia files, such as sound and

' : video.

'-----------------------------------------------------

' -=-=-=- PROPERTIES -=-=-=-

' Filename Determines the name of the current file

' Length The length of the file (Read Only)

' Position The current position through the file

' Status The current status of the object (Read Only)

' Wait True/False...tells VB to wait until play done

' -=-=-=- METHODS -=-=-=-=-

' mmOpen Filename Opens the requested filename

' mmClose Closes the current file

' mmPause Pauses playback of the current file

' mmStop Stops playback ready for closedown

' mmSeek Position Seeks to a position in the file

' mmPlay Plays the open file

'-------------------------------------------------------------

' NOTES

' -----

'

' Open a file, then play it. Pause it in response to a request

' from the user. Stop if you intend to seek to the start and

' play again. Close when you no longer want to play the file

'--------------------------------------------------------------

Private sAlias As String ' Used internally to give an alias name to

' the multimedia resource

Private sFilename As String ' Holds the filename internally

Private nLength As Single ' Holds the length of the filename

' internally

Private nPosition As Single ' Holds the current position internally

Private sStatus As String ' Holds the current status as a string

Private bWait As Boolean ' Determines if VB should wait until play

' is complete before returning.

'------------ API DECLARATIONS -------------

'note that this is all one code line:

Private Declare Function mciSendString Lib "winmm.dll" _

Alias "mciSendStringA" (ByVal lpstrCommand As String, _

ByVal lpstrReturnString As String, ByVal uReturnLength As Long, _

ByVal hwndCallback As Long) As Long

Public Sub mmOpen(ByVal sTheFile As String)

' Declare a variable to hold the value returned by mciSendString

Dim nReturn As Long

' Declare a string variable to hold the file type

Dim sType As String

' Opens the specified multimedia file, and closes any

' other that may be open

If sAlias "" Then

mmClose

End If

' Determine the type of file from the file extension

Select Case UCase$(Right$(sTheFile, 3))

Case "WAV"

sType = "Waveaudio"

Case "AVI"

sType = "AviVideo"

Case "MID"

sType = "Sequencer"

Case Else

' If the file extension is not known then exit the subroutine

Exit Sub

End Select

sAlias = Right$(sTheFile, 3) Minute(Now)

' At this point there is no file open, and we have determined the

' file type. Now would be a good time to open the new file.

' Note: if the name contains a space we have to enclose it in quotes

If InStr(sTheFile, " ") Then sTheFile = Chr(34) sTheFile Chr(34)

nReturn = mciSendString("Open " sTheFile " ALIAS " sAlias _

" TYPE " sType " wait", "", 0, 0)

End Sub

Public Sub mmClose()

' Closes the currently opened multimedia file

' Declare a variable to hold the return value from the mciSendString

' command

Dim nReturn As Long

' If there is no file currently open then exit the subroutine

If sAlias = "" Then Exit Sub

nReturn = mciSendString("Close " sAlias, "", 0, 0)

sAlias = ""

sFilename = ""

End Sub

Public Sub mmPause()

' Pause playback of the file

' Declare a variable to hold the return value from the mciSendString

' command

Dim nReturn As Long

' If there is no file currently open then exit the subroutine

If sAlias = "" Then Exit Sub

nReturn = mciSendString("Pause " sAlias, "", 0, 0)

End Sub

Public Sub mmPlay()

' Plays the currently open file, from the current position

' Declare a variable to hold the return value from the mciSendString

' command

Dim nReturn As Long

' If there is no file currently open, then exit the routine

If sAlias = "" Then Exit Sub

' Now play the file

If bWait Then

nReturn = mciSendString("Play " sAlias " wait", "", 0, 0)

Else

nReturn = mciSendString("Play " sAlias, "", 0, 0)

End If

End Sub

Public Sub mmStop()

' Stop using a file totally, be it playing or whatever

' Declare a variable to hold the return value from mciSendString

Dim nReturn As Long

' If there is no file currently open then exit the subroutine

If sAlias = "" Then Exit Sub

nReturn = mciSendString("Stop " sAlias, "", 0, 0)

End Sub

Public Sub mmSeek(ByVal nPosition As Single)

' Seeks to a specific position within the file

' Declare a variable to hold the return value from the mciSendString

' function

Dim nReturn As Long

nReturn = mciSendString("Seek " sAlias " to " nPosition, "", 0, 0)

End Sub

Property Get Filename() As String

' Routine to return a value when the programmer asks the

' object for the value of its Filename property

Filename = sFilename

End Property

Property Let Filename(ByVal sTheFile As String)

' Routine to set the value of the filename property, should the programmer

' wish to do so. This implies that the programmer actually wants to open

' a file as well so control is passed to the mmOpen routine

mmOpen sTheFile

End Property

Property Get Wait() As Boolean

' Routine to return the value of the object's wait property.

Wait = bWait

End Property

Property Let Wait(bWaitValue As Boolean)

' Routine to set the value of the object's wait property

bWait = bWaitValue

End Property

Property Get Length() As Single

' Routine to return the length of the currently opened multimedia file

' Declare a variable to hold the return value from the mciSendString

Dim nReturn As Long, nLength As Integer

' Declare a string to hold the returned length from the mci Status call

Dim sLength As String * 255

' If there is no file open then return 0

If sAlias = "" Then

Length = 0

Exit Property

End If

nReturn = mciSendString("Status " sAlias " length", sLength, 255, 0)

nLength = InStr(sLength, Chr$(0))

Length = Val(Left$(sLength, nLength - 1))

End Property

Property Let Position(ByVal nPosition As Single)

' Sets the Position property effectively by seeking

mmSeek nPosition

End Property

Property Get Position() As Single

' Returns the current position in the file

' Declare a variable to hold the return value from mciSendString

Dim nReturn As Integer, nLength As Integer

' Declare a variable to hold the position returned

' by the mci Status position command

Dim sPosition As String * 255

' If there is no file currently opened then exit the subroutine

If sAlias = "" Then Exit Property

' Get the position and return

nReturn = mciSendString("Status " sAlias " position", sPosition, 255, 0)

nLength = InStr(sPosition, Chr$(0))

Position = Val(Left$(sPosition, nLength - 1))

End Property

Property Get Status() As String

' Returns the playback/record status of the current file

' Declare a variable to hold the return value from mciSendString

Dim nReturn As Integer, nLength As Integer

' Declare a variable to hold the return string from mciSendString

Dim sStatus As String * 255

' If there is no file currently opened, then exit the subroutine

If sAlias = "" Then Exit Property

nReturn = mciSendString("Status " sAlias " mode", sStatus, 255, 0)

nLength = InStr(sStatus, Chr$(0))

Status = Left$(sStatus, nLength - 1)

End Property

//窗体fm

Dim m As New Mmedia

Dim fn

Private Sub Command1_Click()

On Error GoTo r

dlg.ShowOpen

fn = dlg.Filename

m.mmOpen fn

r:

If Err Then MsgBox Err.Description

End Sub

Private Sub Command2_Click()

On Error GoTo rp

m.mmPlay

rp:

If Err Then MsgBox Err.Description

End Sub

Private Sub Command3_Click()

On Error GoTo rap

m.mmPause

rap:

If Err Then MsgBox Err.Description

End Sub

Private Sub Command4_Click()

On Error GoTo racp

m.mmStop

racp:

If Err Then MsgBox Err.Description

End Sub

vb.net做安装包,安装后自动运行程序

1 新建安装部署项目

打开VS2005,点击新建项目,选择:其他项目类型-安装与部署-安装向导(安装项目),然后点击确定。

2 安装向导

关闭后打开安装向导,点击下一步,或者直接点击完成。

3 开始制作

安装向导完成后即可进入项目文件夹:

双击"应用程序文件夹"在右边的空白处右击,选择添加-文件,将你的做的应用程序的可执行文件和相应的类库和组件添加进来。然后右击你的文件,创建快捷方式,然后把快捷方式分别复制或剪切到左边的"用户的'程序'菜单"和"用户桌面"中。这样安装程序安装完成后会在 "开始-所有程序"和"桌面"上生成程序的快捷方式。也可以直接在"用户的'程序'菜单"和"用户桌面"相应目录下新建快捷方式,然后定位到你的文件。

然后右击左边的"应用程序文件夹"打开属性对话框:将属性中的"DefaultLocation"的路径中的"[Manufacturer]"去掉,不然的话做好的安装程序默认安装目录会是"C:\Program Files\你的用户名\安装解决方案名称";

然后打开解决方案管理器,右击你的解决方案名称,选择属性:打开的属性页中,选择"系统必备", 在打开的系统必备页中,在"指定系统必备安装组件的位置"中选中如下选择项:从与我的应用程序相同的位置下载系统必备组件。选上以后,在生成的安装文件包中包含.NetFramework组件 。好了,这样就完成99%了,然后点击"生成-生成解决方案",生成成功!

我以前参考过的,希望对你有帮助。

安装完成后自动启动程序

1.新建一个空的项目InstallCompenent,步骤为:解决方案-右键添加-新建项目-选择"空项目"-输入名称"InstallCompenent"-确定,完成项目的添加.

2.在InstallCompenent项目中右键-添加-新建项-选择安装程序类-输入名称"Installer",完成installer类的添加.

修改代码为:

/// summary

/// 功能是做安装项目主项目输出

/// 实现安装过程中的一些操作

/// 如:安装完成后启动项目

/// /summary

[RunInstaller(true)]

public partial class Installer : Installer

{

/// summary

/// 应用程序入口

/// /summary

public static void Main()

{

}

/// summary

/// 构造函数

/// /summary

public ECSuitsInstaller()

{

InitializeComponent();

}

/// summary

/// 重写安装完成后函数

/// 实现安装完成后自动启动已安装的程序

/// /summary

/// param name="savedState"/param

protected override void OnAfterInstall(IDictionary savedState)

{

base.OnAfterInstall(savedState);

Assembly asm = Assembly.GetExecutingAssembly();

string path = asm.Location.Remove(asm.Location.LastIndexOf("\\")) + "\\";

System.Diagnostics.Process.Start(path + "\\ECSuits.exe");

}

/// summary

/// 重写安装过程方法

/// /summary

/// param name="stateSaver"/param

public override void Install(IDictionary stateSaver)

{

base.Install(stateSaver);

}

/// summary

/// 重写安装之前方法

/// /summary

/// param name="savedState"/param

protected override void OnBeforeInstall(IDictionary savedState)

{

base.OnBeforeInstall(savedState);

}

/// summary

/// 重写卸载方法

/// /summary

/// param name="savedState"/param

public override void Uninstall(IDictionary savedState)

{

base.Uninstall(savedState);

}

/// summary

/// 重写回滚方法

/// /summary

/// param name="savedState"/param

public override void Rollback(IDictionary savedState)

{

base.Rollback(savedState);

}

}

3.在安装项目中右键-添加项目输出-选择"项目"-InstallCompenent.

完成主输出项目的添加.

4.打开自定义操作编辑器,在安装-右键-添加自定义操作-选择"应用程序文件夹"-选择"主输出来自InstallCompenent",完成添加.


当前文章:vb.net制作录屏软件,录制屏幕免费录屏软件
网站地址:http://cdxtjz.cn/article/dsggosj.html

其他资讯