මෘදුකාංගයක් සෑදීමට උපකාරයක් දෙන්න.

Amith0424

Well-known member
  • Oct 27, 2010
    14,297
    24,487
    113
    ℒ𝓸𝓬𝓪𝓽𝓲𝓸𝓷
    .EXE ඇයි මේක ඉංග්‍රරිසියෙන් සිංහලෙන් දහන් "ක්‍රියාත්මක කල හැකි ගොනුවක්" කියල.

    කවදහරි වැඩට ගියාම මූව ගහල පන්නනව ශුවර්.. file එකක් search කරන්න ඉනිමං බඳින්න වෙනව.
    image.png
     
    Last edited:
    • Like
    Reactions: kinkon

    S_M_S

    Well-known member
  • Sep 28, 2017
    3,343
    7,858
    113
    නිකං දුවනයක් (autorun.inf) හැදුවොත් හරියයිද?
    * මං නම් දන්නෑ ඉතිං ඕවා

    Bump තමයි
     

    Hasistranger

    Well-known member
  • Oct 21, 2010
    13,468
    7,142
    113
    Western Province, SL
    www.myjournalview.com
    වැඩ තලය මත ඇති ෆෝල්ඩරයක් දෙක්ලික් කල විට එම ෆෝල්ඩරය වෙනුවට එය තුල ඇති .EXE ගොනුවක් ක්‍රියා කරවන ලෙස සැකසුම් සාදන අන්නදම කියා දෙන්න.
    මෙය ඉතා වැදගත් මෘදුකාංගයක් දියුණු කිරීමේදී හමුවූ එක අදියරකි.
    මෘදුකාංගය නිමකල පසු ෑඹලාට නොමිලයේ දෙමි.

    Thawa ekekta ukawala apitath ukawanna kalpanawa
     

    hasithayad

    Well-known member
  • Sep 28, 2011
    30,793
    1
    45,001
    113
    වැඩ තලය මත ඇති ෆෝල්ඩරයක් දෙක්ලික් කල විට එම ෆෝල්ඩරය වෙනුවට එය තුල ඇති .EXE ගොනුවක් ක්‍රියා කරවන ලෙස සැකසුම් සාදන අන්නදම කියා දෙන්න.
    මෙය ඉතා වැදගත් මෘදුකාංගයක් දියුණු කිරීමේදී හමුවූ එක අදියරකි.
    මෘදුකාංගය නිමකල පසු ෑඹලාට නොමිලයේ දෙමි.
    වෛරස් හෝ පරිශීලකයා නොමඟ යැවීමට මෘදුකාංග සෑදීමට උපකාර නොකරන්න
     

    visula kavinda

    Well-known member
  • Jun 18, 2021
    662
    452
    63
    කෝ හැදුවද... :baffled:
    මෙන්න කේතය
    Imports System.Diagnostics
    Imports System.Drawing
    Imports System.Windows.Forms

    'Imports Microsoft.VisualBasic.FileIO
    Module Module1
    Function GetShortcutIcon(ByVal shortcutPath As String) As Icon
    Try
    ' Get the target path of the shortcut
    Dim targetPath As String = GetShortcutTarget(shortcutPath)

    ' Extract the icon associated with the target file
    If targetPath IsNot Nothing AndAlso IO.File.Exists(targetPath) Then
    Return Icon.ExtractAssociatedIcon(targetPath)
    Else
    Return Nothing
    End If
    Catch ex As Exception
    ' Handle exceptions here
    Return Nothing
    End Try
    End Function


    Function GetShortcutTarget(ByVal shortcutPath As String) As String
    Try
    Dim shortcut As Shell32.Shell = New Shell32.Shell()
    Dim folder As Shell32.Folder = shortcut.NameSpace(System.IO.Path.GetDirectoryName(shortcutPath))
    Dim folderItem As Shell32.FolderItem = folder.ParseName(System.IO.Path.GetFileName(shortcutPath))
    If folderItem IsNot Nothing Then
    Dim link As Shell32.ShellLinkObject = CType(folderItem.GetLink, Shell32.ShellLinkObject)
    Return link.Path
    Else
    Return Nothing
    End If
    Catch ex As Exception
    Return Nothing
    End Try
    End Function


    '' Structure for the WIN32_FIND_DATA structure returned by FindFirstFile and others
    '<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Auto)>
    'Structure WIN32_FIND_DATA
    ' Public dwFileAttributes As Integer
    ' Public ftCreationTime As Long
    ' Public ftLastAccessTime As Long
    ' Public ftLastWriteTime As Long
    ' Public nFileSizeHigh As Integer
    ' Public nFileSizeLow As Integer
    ' Public dwReserved0 As Integer
    ' Public dwReserved1 As Integer
    ' <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=260)> Public cFileName As String
    ' <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=14)> Public cAlternateFileName As String
    'End Structure

    '' Function declarations
    'Declare Function FindFirstFile Lib "kernel32.dll" Alias "FindFirstFileA" (ByVal lpFileName As String, ByRef lpFindFileData As WIN32_FIND_DATA) As IntPtr
    'Declare Function FindClose Lib "kernel32.dll" (ByVal hFindFile As IntPtr) As Boolean
    'Declare Unicode Function PathCombine Lib "shlwapi.dll" Alias "PathCombineW" (ByVal pszDest As System.Text.StringBuilder, ByVal pszDir As String, ByVal pszFile As String) As IntPtr

    '' Function to retrieve target path of a shortcut
    'Function GetShortcutTarget(ByVal shortcutPath As String) As String
    ' Dim WIN32_FILE_ATTRIBUTE_DIRECTORY As Integer = &H10
    ' Dim FILE_ATTRIBUTE_REPARSE_POINT As Integer = &H400

    ' Try
    ' Dim findData As New WIN32_FIND_DATA()
    ' Dim handle As IntPtr = FindFirstFile(shortcutPath, findData)

    ' If handle.ToInt64() <> -1 Then
    ' If (findData.dwFileAttributes And WIN32_FILE_ATTRIBUTE_DIRECTORY) <> 0 AndAlso (findData.dwFileAttributes And FILE_ATTRIBUTE_REPARSE_POINT) <> 0 Then
    ' Dim targetPathBuilder As New System.Text.StringBuilder(260)
    ' PathCombine(targetPathBuilder, shortcutPath, findData.cFileName)
    ' Return targetPathBuilder.ToString()
    ' End If
    ' End If

    ' FindClose(handle)
    ' Catch ex As Exception
    ' ' Handle exceptions here
    ' Return Nothing
    ' End Try

    ' Return Nothing
    'End Function


    Class ToolStripMenuItemEX
    Inherits ToolStripMenuItem
    Friend ID As Integer
    End Class
    Dim ls() As String
    Function make_ITEM(ByRef s As String, i As Integer) As ToolStripMenuItemEX
    Dim targetPath As String = GetShortcutTarget(ls(i))


    Dim cx As New ToolStripMenuItemEX()
    cx.Text = s
    cx.ID = i

    If IO.File.Exists(targetPath) = True Then
    cx.Image = Icon.ExtractAssociatedIcon(targetPath).ToBitmap
    ls(i) = targetPath
    Else
    ' MsgBox("|" + targetPath + "|")
    If targetPath.Contains("\Program Files (x86)\") Then
    targetPath = targetPath.Replace("\Program Files (x86)\", "\Program Files\")
    If IO.File.Exists(targetPath) Then
    cx.Image = Icon.ExtractAssociatedIcon(targetPath).ToBitmap
    ls(i) = targetPath
    Else
    cx.Enabled = False
    End If
    Else
    cx.Enabled = False
    End If
    End If

    AddHandler cx.Click, AddressOf OnClickEX
    Return cx
    End Function
    Sub Main()
    ' Create a new ContextMenuStrip
    Dim contextMenu As New ContextMenuStrip()
    contextMenu.Items.Add("වසන්න X ", Nothing, AddressOf Close_OnClick)


    If IO.Directory.Exists(Application.StartupPath + "\කෙටි මං") Then
    ls = IO.Directory.GetFiles(Application.StartupPath + "\කෙටි මං", "*.lnk", IO.SearchOption.TopDirectoryOnly)
    Else
    ls = IO.Directory.GetFiles(Application.StartupPath, "*.lnk", IO.SearchOption.TopDirectoryOnly)
    End If


    ' Array.Sort(ls)

    Dim i As Integer
    Dim Fc As Char = Chr(0)
    Dim fcc As Char = Chr(0)
    Dim s As String
    Dim cI As ToolStripMenuItem

    Dim cX As ToolStripMenuItemEX
    For i = 0 To ls.Length - 1
    s = IO.Path.GetFileNameWithoutExtension(ls(i))
    fcc = Char.ToLower(s(0))
    If Fc = fcc Then
    cX = make_ITEM(s, i)

    cI.DropDownItems.Add(cX)
    Else
    If i = ls.Length - 1 Then
    cX = make_ITEM(s, i)

    contextMenu.Items.Add(cX)
    ' Fc = s(0)

    ElseIf Char.ToLower(ls(i + 1)(0)) = Fc Then
    ' MsgBox(Fc + vbCrLf + s)
    cX = make_ITEM(s, i)

    cI.DropDownItems.Add(cX)
    ' Fc = s(0)
    Else
    cI = New ToolStripMenuItem(Char.ToUpper(s(0)))
    contextMenu.Items.Add(cI)

    cX = make_ITEM(s, i)

    cI.DropDownItems.Add(cX)
    ' Fc = s(0)
    End If
    End If
    Fc = fcc
    ' contextMenu.Items.Add(IO.Path.GetFileNameWithoutExtension(s))
    Next

    contextMenu.Items.Add(" ⚙️ ", Nothing, AddressOf Settings_OnClick)



    '=======================================================================================
    ' Handle the LostFocus event to close the application when focus is lost

    AddHandler contextMenu.LostFocus, Sub(sender, e) Application.Exit()

    ' Show the context menu
    contextMenu.Show(Control.MousePosition)
    ' Run the application message loop manually to prevent premature exit
    Application.Run()
    End Sub

    Friend Sub OnClickEX(sender As ToolStripMenuItemEX, e As EventArgs)
    '' This event handler does nothing
    '' MsgBox(ls(sender.ID))
    ''MsgBox(ls(sender.ID) + vbCrLf + GetShortcutTarget(ls(sender.ID)))
    'Dim exe_ As String = GetShortcutTarget(ls(sender.ID))
    'If IO.File.Exists(exe_) = True Then
    ' Dim processInfo As New ProcessStartInfo(exe_)
    ' Process.Start(processInfo)
    ' Application.Exit()
    'Else
    ' sender.Enabled = False
    'End If


    Dim processInfo As New ProcessStartInfo(ls(sender.ID))
    Process.Start(processInfo)
    Application.Exit()
    End Sub
    Sub Close_OnClick(sender As Object, e As EventArgs)
    ' This event handler does nothing
    ' MsgBox("sadfdsad")
    Application.Exit()
    End Sub
    Sub Settings_OnClick(sender As Object, e As EventArgs)
    ' This event handler does nothing
    ' MsgBox("sadfdsad")
    Application.Exit()
    End Sub
    End Module
     
    • Like
    Reactions: yasi96

    yasi96

    Well-known member
  • Apr 9, 2017
    4,885
    1,317
    113
    මෙන්න කේතය
    Imports System.Diagnostics
    Imports System.Drawing
    Imports System.Windows.Forms

    'Imports Microsoft.VisualBasic.FileIO
    Module Module1
    Function GetShortcutIcon(ByVal shortcutPath As String) As Icon
    Try
    ' Get the target path of the shortcut
    Dim targetPath As String = GetShortcutTarget(shortcutPath)

    ' Extract the icon associated with the target file
    If targetPath IsNot Nothing AndAlso IO.File.Exists(targetPath) Then
    Return Icon.ExtractAssociatedIcon(targetPath)
    Else
    Return Nothing
    End If
    Catch ex As Exception
    ' Handle exceptions here
    Return Nothing
    End Try
    End Function


    Function GetShortcutTarget(ByVal shortcutPath As String) As String
    Try
    Dim shortcut As Shell32.Shell = New Shell32.Shell()
    Dim folder As Shell32.Folder = shortcut.NameSpace(System.IO.Path.GetDirectoryName(shortcutPath))
    Dim folderItem As Shell32.FolderItem = folder.ParseName(System.IO.Path.GetFileName(shortcutPath))
    If folderItem IsNot Nothing Then
    Dim link As Shell32.ShellLinkObject = CType(folderItem.GetLink, Shell32.ShellLinkObject)
    Return link.Path
    Else
    Return Nothing
    End If
    Catch ex As Exception
    Return Nothing
    End Try
    End Function


    '' Structure for the WIN32_FIND_DATA structure returned by FindFirstFile and others
    '<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Auto)>
    'Structure WIN32_FIND_DATA
    ' Public dwFileAttributes As Integer
    ' Public ftCreationTime As Long
    ' Public ftLastAccessTime As Long
    ' Public ftLastWriteTime As Long
    ' Public nFileSizeHigh As Integer
    ' Public nFileSizeLow As Integer
    ' Public dwReserved0 As Integer
    ' Public dwReserved1 As Integer
    ' <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=260)> Public cFileName As String
    ' <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=14)> Public cAlternateFileName As String
    'End Structure

    '' Function declarations
    'Declare Function FindFirstFile Lib "kernel32.dll" Alias "FindFirstFileA" (ByVal lpFileName As String, ByRef lpFindFileData As WIN32_FIND_DATA) As IntPtr
    'Declare Function FindClose Lib "kernel32.dll" (ByVal hFindFile As IntPtr) As Boolean
    'Declare Unicode Function PathCombine Lib "shlwapi.dll" Alias "PathCombineW" (ByVal pszDest As System.Text.StringBuilder, ByVal pszDir As String, ByVal pszFile As String) As IntPtr

    '' Function to retrieve target path of a shortcut
    'Function GetShortcutTarget(ByVal shortcutPath As String) As String
    ' Dim WIN32_FILE_ATTRIBUTE_DIRECTORY As Integer = &H10
    ' Dim FILE_ATTRIBUTE_REPARSE_POINT As Integer = &H400

    ' Try
    ' Dim findData As New WIN32_FIND_DATA()
    ' Dim handle As IntPtr = FindFirstFile(shortcutPath, findData)

    ' If handle.ToInt64() <> -1 Then
    ' If (findData.dwFileAttributes And WIN32_FILE_ATTRIBUTE_DIRECTORY) <> 0 AndAlso (findData.dwFileAttributes And FILE_ATTRIBUTE_REPARSE_POINT) <> 0 Then
    ' Dim targetPathBuilder As New System.Text.StringBuilder(260)
    ' PathCombine(targetPathBuilder, shortcutPath, findData.cFileName)
    ' Return targetPathBuilder.ToString()
    ' End If
    ' End If

    ' FindClose(handle)
    ' Catch ex As Exception
    ' ' Handle exceptions here
    ' Return Nothing
    ' End Try

    ' Return Nothing
    'End Function


    Class ToolStripMenuItemEX
    Inherits ToolStripMenuItem
    Friend ID As Integer
    End Class
    Dim ls() As String
    Function make_ITEM(ByRef s As String, i As Integer) As ToolStripMenuItemEX
    Dim targetPath As String = GetShortcutTarget(ls(i))


    Dim cx As New ToolStripMenuItemEX()
    cx.Text = s
    cx.ID = i

    If IO.File.Exists(targetPath) = True Then
    cx.Image = Icon.ExtractAssociatedIcon(targetPath).ToBitmap
    ls(i) = targetPath
    Else
    ' MsgBox("|" + targetPath + "|")
    If targetPath.Contains("\Program Files (x86)\") Then
    targetPath = targetPath.Replace("\Program Files (x86)\", "\Program Files\")
    If IO.File.Exists(targetPath) Then
    cx.Image = Icon.ExtractAssociatedIcon(targetPath).ToBitmap
    ls(i) = targetPath
    Else
    cx.Enabled = False
    End If
    Else
    cx.Enabled = False
    End If
    End If

    AddHandler cx.Click, AddressOf OnClickEX
    Return cx
    End Function
    Sub Main()
    ' Create a new ContextMenuStrip
    Dim contextMenu As New ContextMenuStrip()
    contextMenu.Items.Add("වසන්න X ", Nothing, AddressOf Close_OnClick)


    If IO.Directory.Exists(Application.StartupPath + "\කෙටි මං") Then
    ls = IO.Directory.GetFiles(Application.StartupPath + "\කෙටි මං", "*.lnk", IO.SearchOption.TopDirectoryOnly)
    Else
    ls = IO.Directory.GetFiles(Application.StartupPath, "*.lnk", IO.SearchOption.TopDirectoryOnly)
    End If


    ' Array.Sort(ls)

    Dim i As Integer
    Dim Fc As Char = Chr(0)
    Dim fcc As Char = Chr(0)
    Dim s As String
    Dim cI As ToolStripMenuItem

    Dim cX As ToolStripMenuItemEX
    For i = 0 To ls.Length - 1
    s = IO.Path.GetFileNameWithoutExtension(ls(i))
    fcc = Char.ToLower(s(0))
    If Fc = fcc Then
    cX = make_ITEM(s, i)

    cI.DropDownItems.Add(cX)
    Else
    If i = ls.Length - 1 Then
    cX = make_ITEM(s, i)

    contextMenu.Items.Add(cX)
    ' Fc = s(0)

    ElseIf Char.ToLower(ls(i + 1)(0)) = Fc Then
    ' MsgBox(Fc + vbCrLf + s)
    cX = make_ITEM(s, i)

    cI.DropDownItems.Add(cX)
    ' Fc = s(0)
    Else
    cI = New ToolStripMenuItem(Char.ToUpper(s(0)))
    contextMenu.Items.Add(cI)

    cX = make_ITEM(s, i)

    cI.DropDownItems.Add(cX)
    ' Fc = s(0)
    End If
    End If
    Fc = fcc
    ' contextMenu.Items.Add(IO.Path.GetFileNameWithoutExtension(s))
    Next

    contextMenu.Items.Add(" ⚙️ ", Nothing, AddressOf Settings_OnClick)



    '=======================================================================================
    ' Handle the LostFocus event to close the application when focus is lost

    AddHandler contextMenu.LostFocus, Sub(sender, e) Application.Exit()

    ' Show the context menu
    contextMenu.Show(Control.MousePosition)
    ' Run the application message loop manually to prevent premature exit
    Application.Run()
    End Sub

    Friend Sub OnClickEX(sender As ToolStripMenuItemEX, e As EventArgs)
    '' This event handler does nothing
    '' MsgBox(ls(sender.ID))
    ''MsgBox(ls(sender.ID) + vbCrLf + GetShortcutTarget(ls(sender.ID)))
    'Dim exe_ As String = GetShortcutTarget(ls(sender.ID))
    'If IO.File.Exists(exe_) = True Then
    ' Dim processInfo As New ProcessStartInfo(exe_)
    ' Process.Start(processInfo)
    ' Application.Exit()
    'Else
    ' sender.Enabled = False
    'End If


    Dim processInfo As New ProcessStartInfo(ls(sender.ID))
    Process.Start(processInfo)
    Application.Exit()
    End Sub
    Sub Close_OnClick(sender As Object, e As EventArgs)
    ' This event handler does nothing
    ' MsgBox("sadfdsad")
    Application.Exit()
    End Sub
    Sub Settings_OnClick(sender As Object, e As EventArgs)
    ' This event handler does nothing
    ' MsgBox("sadfdsad")
    Application.Exit()
    End Sub
    End Module

    අඩෙහ් .. මෙන්න මූ ඉන්නව.. මම හිතුවෙ මූත් වයිරස් ගාඩ් එකෙන් ඩිලිට් කරල දාන්න ඇති කියල... ඇත්තටම කියපන් ඔ්ක හැදුවෙ මොන අරමුණකට ද කියල :lol: