明天的明天 永远的永远 未知的一切 我与你一起承担 ??

是非成败转头空 青山依旧在 几度夕阳红 。。。
随笔 - 1277, 文章 - 0, 评论 - 214, 阅读 - 320万
  博客园  :: 首页  :: 管理
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
复制代码
代码
Imports System.ComponentModel
Imports IWshRuntimeLibrary  '创建快捷方式所需

Namespace My

    
' 以下事件可用于 MyApplication:
    ' 
    ' Startup: 应用程序启动时在创建启动窗体之前引发。
    ' Shutdown: 在关闭所有应用程序窗体后引发。如果应用程序异常终止,则不会引发此事件。
    ' UnhandledException: 在应用程序遇到未处理的异常时引发。
    ' StartupNextInstance: 在启动单实例应用程序且应用程序已处于活动状态时引发。
    ' NetworkAvailabilityChanged: 在连接或断开网络连接时引发。
    Partial Friend Class MyApplication
        
Private Sub MyApplication_Startup(ByVal sender As ObjectByVal e As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) Handles Me.Startup


            
Dim startpath As String = Environment.GetFolderPath(Environment.SpecialFolder.StartMenu) + "\\程序\\旅游ERP系统\\旅行社机票管理系统.appref-ms"



            
'创建快捷方式
            Dim shell As WshShell = New WshShell()
            
Dim shortcut As IWshShortcut = CType(shell.CreateShortcut(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\旅游ERP系统222.lnk"), IWshShortcut)
            shortcut.TargetPath 
= startpath
            shortcut.WorkingDirectory 
= Environment.GetFolderPath(Environment.SpecialFolder.StartMenu) + "\\程序\\旅游ERP系统"
            shortcut.WindowStyle 
= 2
            
'//shortcut.Arguments = "/p XMAPGL /nologo";  //指向目标运行的参数
            shortcut.Description = "旅游ERP系统"
            shortcut.IconLocation 
= System.Environment.CurrentDirectory + "\\" + "icon.ico" 'System.Environment.SystemDirectory + "\\" + "shell32.dll, 163"; 

            
If Not System.IO.File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\旅游ERP系统222.lnk"Then

                shortcut.Save()
            
Else


            
End If


            
'MsgBox("已经成功更新了该用户资料", MsgBoxStyle.OkOnly + _
            '        MsgBoxStyle.Exclamation, "更新成功")

            
Call SetConnectionStatus(My.Computer.Network.IsAvailable)

        
End Sub

        
Private Sub MyApplication_UnhandledException(ByVal sender As ObjectByVal e As Microsoft.VisualBasic.ApplicationServices.UnhandledExceptionEventArgs) Handles Me.UnhandledException
            
Dim m As New currentMethodInformation(e.Exception.TargetSite)

            
MsgBox(m.ToString, MsgBoxStyle.OkOnly, "try,continue,cancle,exit application:err from")
            e.ExitApplication 
= False
            
'If MsgBox(m.ToString, MsgBoxStyle.RetryCancel, "try,continue,cancle,exit application:err from") = MsgBoxResult.Retry Then
            '    e.ExitApplication = False

            
'Else

            
'End If

        
End Sub

        
Private Sub MyApplication_NetworkAvailabilityChanged(ByVal sender As ObjectByVal e As Microsoft.VisualBasic.Devices.NetworkAvailableEventArgs) Handles Me.NetworkAvailabilityChanged
            
''If e.IsNetworkAvailable Then
            ''    'My.Forms.frmMain.Text = "网络暂时不可用"
            ''Else
            ''    'My.Forms.frmMain.Text = "Explorer(试用版)"


            
''    '.Text = My.Resources.DisconnectedText    '调用资源文件
            ''End If

            
Call SetConnectionStatus(My.Computer.Network.IsAvailable)

        
End Sub

        
Private Sub SetConnectionStatus(ByVal Connected As Boolean)
            
'With My.Forms.Form2.ConnectedStatusLabel

            
'    If Connected Then
            '        .Image = My.Resources.connected.ToBitmap
            '        .Text = My.Resources.ConnectedText
            '    Else
            '        .Image = My.Resources.disconnected.ToBitmap
            '        .Text = My.Resources.DisconnectedText

            
'    End If
            'End With
        End Sub


    
End Class

End Namespace

Public Class currentMethodInformation
    
Private gMethodbase As System.Reflection.MethodBase
    
Sub New(ByVal methodbase As System.Reflection.MethodBase)
        gMethodbase 
= methodbase
    
End Sub

    
Sub New(ByVal stackFrame As System.Diagnostics.StackFrame)
        gMethodbase 
= stackFrame.GetMethod
    
End Sub

    
<Description("程序集名称")> _
    
Public ReadOnly Property AssemblyName() As String
        
Get
            
Return gMethodbase.DeclaringType.Assembly.GetName.Name
        
End Get
    
End Property

    
<Description("程序集版本")> _
    
Public ReadOnly Property AssemblyVersion() As String
        
Get
            
Return gMethodbase.DeclaringType.Assembly.GetName.Version.ToString
        
End Get
    
End Property

    
<Description("类名")> _
    
Public ReadOnly Property TypeName() As String
        
Get
            
Return gMethodbase.DeclaringType.FullName
        
End Get
    
End Property

    
<Description("方法名")> _
    
Public ReadOnly Property Name() As String
        
Get
            
Return gMethodbase.ToString
        
End Get
    
End Property

    
Public Overloads Function ToString() As String
        
Dim b As New System.Text.StringBuilder
        b.Append(System.Environment.NewLine)
        b.AppendFormat(
"  程序集名称 :{0}"Me.AssemblyName)
        b.Append(System.Environment.NewLine)
        b.AppendFormat(
"  程序集版本 :{0}"Me.AssemblyVersion)
        b.Append(System.Environment.NewLine)
        b.AppendFormat(
"        类名 :{0}"Me.TypeName)
        b.Append(System.Environment.NewLine)
        b.AppendFormat(
"      方法名 :{0}"Me.Name)
        b.Append(System.Environment.NewLine)
        
Return b.ToString
    
End Function

End Class
复制代码

 

 

/Files/Fooo/Interop.IWshRuntimeLibrary.rar

编辑推荐:
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
点击右上角即可分享
微信分享提示