/b/oss (06-30-2010),DawgiiStylz (02-05-2013),Jason (06-27-2011),Ninja® (09-12-2011),willrulz188 (07-24-2011)
Move from with noborderstyle BY DRAGGING
Code:#Region " ClientAreaMove Handling " Const WM_NCHITTEST As Integer = &H84 Const HTCLIENT As Integer = &H1 Const HTCAPTION As Integer = &H2 Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message) Select Case m.Msg Case WM_NCHITTEST MyBase.WndProc(m) If m.Result = HTCLIENT Then m.Result = HTCAPTION 'If m.Result.ToInt32 = HTCLIENT Then m.Result = IntPtr.op_Explicit(HTCAPTION) 'Try this in VS.NET 2002/2003 if the latter line of code doesn't do it... thx to Suhas for the tip. Case Else 'Make sure you pass unhandled messages back to the default message handler. MyBase.WndProc(m) End Select End Sub #End Region
/b/oss (06-30-2010),DawgiiStylz (02-05-2013),Jason (06-27-2011),Ninja® (09-12-2011),willrulz188 (07-24-2011)
How to put all the first letters of each word in upper case (I know its easy and that almost nobody uses), just put the way you want it to appears before (like MsgBox, or changing a textbox text or whatever you want):
[php](StrConv("yoUr SENTENCE here", vbProperCase))
[/php]
Example fo changing words inside a textbox:
When your writing:
[php] Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
TextBox1.Text = (StrConv(TextBox1.Text, vbProperCase))
End Sub[/php]
After writing (clicking a button):
[php] Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox1.Text = (StrConv(TextBox1.Text, vbProperCase))
End Sub[/php]
The code it self, I think its standard...(i've seen it somewhere, can't remember exacly where...)
Using it for textboxes~ME
Last edited by TheRealOne; 07-10-2010 at 09:10 AM.
Learning VB and C
[IMG]https://i111.photobucke*****m/albums/n121/golmor/learntoprogram-1.png[/IMG]
Objectives:
1 Post
2 Posts
10 Posts
50 Posts
100 Posts
Making a Tuturial
Make a tool (and releasing it)
Making my own set of tools (and release it)
Ninja® (09-12-2011)
Standard MSDN (Contributed by techial2)
---------------------------------------------------------
Well i cracked the hibernate code to make it on and off.
[php]shell("powercfg /hibernate on")[/php]
[php]shell("powercfg /hibernate off")[/php]
So now use it!
-----------------------------------------------------------
Ninja® (09-12-2011)
Check to see if your OS is 32Bit or 64 Bit
[php]
Imports System.Runtime.InteropServices
Public Class Form1
<DllImport("kernel32.dll", SetLastError:=True, CallingConvention:=CallingConvention.Winapi)> _
'Not needed unless checking for WOWProcess
'Public Shared Function IsWow64Process(<[In]()> ByVal hProcess As IntPtr, <Out()>' ByVal lpSystemInfo As Boolean) As <MarshalAs(UnmanagedType.Bool)> Boolean
'End Function
Private Function Is64Bit() As Boolean
If IntPtr.Size = 8 Then
Return True
Else
Return False
End If
End Function
Private Function Is32Bit() As Boolean
If IntPtr.Size = 4 Then
Return True
Else
Return False
End If
End Function
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
MsgBox(Is64Bit)
If Is64Bit() = True Then
MsgBox("This system is 64 bit")
' Open 64 bit application
'or just use else, but really this depends on WOW64 which can be misunderstood as a 32bit
ElseIf Is32Bit() = True Then
MsgBox("This system is 32 bit")
' Open 64 bit application
End If
End Sub
End Class
[/php]
essentially all you have to do is call
is64bit()
or
is32bit()
it will return true or false value, Simple really
Ninja® (09-12-2011)
Ninja® (09-12-2011)
[COLOR="DeepSkyBlue"][B]Here's a function for extracting variables between strings using both methods (Tags (XML) / Assignment (INI) ). You can use anyone based on your string structure. First add the following Enumeration and Function to the class:
Now read the values by calling the function defined above:Code:Enum SeperationMethod Assignment Tags End Enum Function ExtractVariable(ByVal InputString As String, ByVal variableToExtract As String, Optional ByVal sepMethod As SeperationMethod = SeperationMethod.Assignment) Dim str As String = InputString Dim file As String = My.Computer.FileSystem.GetTempFileName() & Rnd() * 999999 & ".xxx" Dim final As String = "" My.Computer.FileSystem.WriteAllText(file, str, False) Dim reader As New IO.StreamReader(file) While Not reader.EndOfStream Dim curline As String = reader.ReadLine If Not curline.Trim = vbNullString Then If curline.Contains(variableToExtract) Then If sepMethod = SeperationMethod.Assignment Then Dim i1 As Integer = curline.IndexOf("=") final = curline.Substring(i1 + 1) Else Dim i1 As Integer = curline.IndexOf("<" & variableToExtract & ">") + variableToExtract.Length + 3 Dim i2 As Integer = curline.IndexOf("</" & variableToExtract & ">", i1) + 1 final = Mid(curline, i1, i2 - i1) End If End If End If End While reader.Dispose() Return final Try My.Computer.FileSystem.DeleteFile(file, FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.DeletePermanently, FileIO.UICancelOption.DoNothing) Catch ex As Exception 'MsgBox("Error Deleting Temporary File...") End Try End Function
If your structure is based on assignment operator '=', then use the Assignment constant:
If your structure is based on Tags like XML, then use the Tags constant:Code:Dim Str As String = "[Infos]" & vbCrLf & "Info1 = 10" & vbCrLf & "Info2 = 20" Dim extractedValue As String = ExtractVariable(Str, "Info1", SeperationMethod.Assignment)
Code:Dim Str As String = "[Infos]" & vbCrLf & "<Info1>10</Info1>" & vbCrLf & "Info2 = 20" Dim extractedValue As String = ExtractVariable(Str, "Info1", SeperationMethod.Tags)
Here's the explanation (Excluding easy statements):
Create a string to store temp file path.
'Final will store the extracted variable...Code:Dim file As String = My.Computer.FileSystem.GetTempFileName() & Rnd() * 999999 & ".xxx"
'Use WriteAllText method to write the data to the file. We will read the written data using StreamRead class.
'Reader variable defines the new streamreader class and as an input takes the temp file path.
'Loop through the read class until the end of file is reached...Code:Dim final As String = "" My.Computer.FileSystem.WriteAllText(file, str, False) Dim reader As New IO.StreamReader(file)
'curLine stores the Current Line the reader is reading...
'Check if after trimming the current line the string at least contains something...
'If it contains something then check if it contains the variable name to extract...
'If seperation method is Assignment '=', then create an integer i1 that gets and stores the index of assignment operator with in the current Line...
'Final = Curline.substring(i1+1) 'Extracts the substring i.e; starts extracting from the index of assignment operator '=' to the end of the current line...hence the variable value..
'If separation method is tag based then it extracts two indexes.
1: <VariableToExtract> 'Tag's Opening
2: </VariableToExtract>'Closing Tag
When the indexes are stored we finally call the Mid method to extract the values between strings (equivalent to 'Substring' method).
Code:While Not reader.EndOfStream Dim curline As String = reader.ReadLine If Not curline.Trim = vbNullString Then If curline.Contains(variableToExtract) Then If sepMethod = SeperationMethod.Assignment Then Dim i1 As Integer = curline.IndexOf("=") final = curline.Substring(i1 + 1) Else Dim i1 As Integer = curline.IndexOf("<" & variableToExtract & ">") + variableToExtract.Length + 3 Dim i2 As Integer = curline.IndexOf("</" & variableToExtract & ">", i1) + 1 final = Mid(curline, i1, i2 - i1) End If End If End If End While
'As soon the control is outside the loop, dispose the reader from memory so it stops occupying system resources.
'As it is a function, we use the 'Return' keyword to return the variable value...
Code:reader.Dispose() Return final
Jason (09-06-2010),Lolland (08-20-2010),NextGen1 (08-20-2010),Ninja® (09-12-2011),Tunguestenio (03-30-2011)
Converted from VB to .Net. I dont remember the original auther. Its for reading and writing to an INI file.
RC4 EncryptionCode:Module SaveSets Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationname As String, ByVal lpKeyName As String, ByVal lsString As String, ByVal lplFilename As String) As Int32 Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationname As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Int32, ByVal lpFileName As String) As Int32 Public Check As String Public Function Load(ByVal Section As String, ByVal Key As String) As String Dim Result As Int32 Dim strFileName Dim strResult As String = Space(300) strFileName = System.AppDomain.CurrentDomain.BaseDirectory & "\settings.ini" Result = GetPrivateProfileString(Section, Key, strFileName, strResult, Len(strResult), strFileName) Check = System.AppDomain.CurrentDomain.BaseDirectory & "\sets.ini" Load = Trim(strResult) End Function Public Function Save(ByVal Section As String, ByVal Key As String, ByVal Content As String) Dim Result As Int32 Dim strFileName strFileName = System.AppDomain.CurrentDomain.BaseDirectory & "\settings.ini" Result = WritePrivateProfileString(Section, Key, Content, strFileName) End Function End Module
Here are some structures for working with PE32 files(32bit)Code:mports System.Text Public NotInheritable Class Encryption Private Sub New() End Sub Public Shared Function Encrypt(ByVal message As String, ByVal key As String) As String If message Is Nothing OrElse message.Length = 0 Then Throw New ArgumentNullException("message") End If If key Is Nothing OrElse key.Length = 0 Then Throw New ArgumentNullException("key") End If Dim returnValue As String = String.Empty returnValue = EnDeCrypt(message, key) returnValue = StringToHex(returnValue) Return returnValue End Function Public Shared Function Decrypt(ByVal message As String, ByVal key As String) As String If message Is Nothing OrElse message.Length = 0 Then Throw New ArgumentNullException("message") End If If key Is Nothing OrElse key.Length = 0 Then Throw New ArgumentNullException("key") End If Dim returnValue As String = String.Empty returnValue = HexToString(message) returnValue = EnDeCrypt(returnValue, key) Return returnValue End Function Private Shared Function EnDeCrypt(ByVal message As String, ByVal password As String) As String Dim i As Integer = 0 Dim j As Integer = 0 Dim cipher As New StringBuilder Dim returnCipher As String = String.Empty Dim sbox As Integer() = New Integer(256) {} Dim key As Integer() = New Integer(256) {} Dim intLength As Integer = password.Length Dim a As Integer = 0 While a <= 255 Dim ctmp As Char = (password.Substring((a Mod intLength), 1).ToCharArray()(0)) key(a) = Microsoft.VisualBasic.Strings.Asc(ctmp) sbox(a) = a System.Math.Max(System.Threading.Interlocked.Increment(a), a - 1) End While Dim x As Integer = 0 Dim b As Integer = 0 While b <= 255 x = (x + sbox(b) + key(b)) Mod 256 Dim tempSwap As Integer = sbox(b) sbox(b) = sbox(x) sbox(x) = tempSwap System.Math.Max(System.Threading.Interlocked.Increment(b), b - 1) End While a = 1 While a <= message.Length Dim itmp As Integer = 0 i = (i + 1) Mod 256 j = (j + sbox(i)) Mod 256 itmp = sbox(i) sbox(i) = sbox(j) sbox(j) = itmp Dim k As Integer = sbox((sbox(i) + sbox(j)) Mod 256) Dim ctmp As Char = message.Substring(a - 1, 1).ToCharArray()(0) itmp = Asc(ctmp) Dim cipherby As Integer = itmp Xor k cipher.Append(Chr(cipherby)) System.Math.Max(System.Threading.Interlocked.Increment(a), a - 1) End While returnCipher = cipher.ToString cipher.Length = 0 Return returnCipher End Function Private Shared Function StringToHex(ByVal message As String) As String Dim index As Long Dim maxIndex As Long Dim hexSb As New StringBuilder Dim hexOut As String = String.Empty maxIndex = Len(message) For index = 1 To maxIndex hexSb.Append(Right("0" & Hex(Asc(Mid(message, CInt(index), 1))), 2)) Next hexOut = hexSb.ToString hexSb.Length = 0 Return hexOut End Function Private Shared Function HexToString(ByVal hex As String) As String Dim index As Long Dim maxIndex As Long Dim sb As New StringBuilder Dim returnString As String = String.Empty maxIndex = Len(hex) For index = 1 To maxIndex Step 2 sb.Append(Chr(CInt("&h" & Mid(hex, CInt(index), 2)))) Next returnString = sb.ToString sb.Length = 0 Return returnString End Function End Class
A Snippet to clone a files information to another file. Made by Zer0Code:Const intel386 = &H14C Const intel486 = &H14D Const intelp = &H14E Private Enum ImageSignatureTypes Image_Dos_Signature = &H5A4D Image_OS2_Signature = &H454E Image_OS2_Signature_LE = &H5A4D Image_VXD_Signature = &H4C45 Image_NT_Signature = &H4550 End Enum <StructLayout(LayoutKind.Sequential)> _ Public Structure Image_Dos_header Public e_magic As UShort 'magic number Public e_cblp As UShort 'bytes on last page of file Public e_cp As UShort 'Pages in file Public e_crlc As UShort 'Relocations Public e_cparhdr As UShort 'Size of header in Paragraphs Public e_minalloc As UShort 'Min extra paragraphs needed Public e_maxalloc As UShort 'Max extra Paragraphs needed Public e_ss As UShort 'Initial (relative) ss value Public e_sp As UShort 'Initial SP value Public e_csum As UShort 'Checksum Public e_ip As UShort 'Initial IP value Public e_cs As UShort 'Initial (relative) cs value Public e_lfarlc As UShort 'File Address of Relocation Table Public e_ovno As UShort 'Overlay number <MarshalAs(UnmanagedType.ByValArray, ArraySubType:=UnmanagedType.SysUInt, Sizeconst:=3)> _ Public e_res() As UShort 'Reserved Words Public e_oemid As UShort 'Oem Identifier (for e_oeminfo) Public e_oeminfo As UShort 'OEM Info; e_oemid specific <MarshalAs(UnmanagedType.ByValArray, ArraySubType:=UnmanagedType.SysInt, sizeconst:=9)> _ Public e_res2() As UShort 'Reserved Words Public e_lfanew As Int32 'File Address of New Exe header End Structure <StructLayout(LayoutKind.Sequential)> _ Public Structure Image_File_header Dim Machine As UShort Dim NumberOfSections As UShort Dim TimeDateStamp As UInteger Dim PointerToSymbolTable As UInteger Dim NumberofSymbols As UInteger Dim SizeofOptionalHeader As UShort Dim Characteristics As UShort End Structure <StructLayout(LayoutKind.Sequential)> _ Public Structure Image_Data_Directory Dim VirtualAddress As UInteger 'Rva not VA Dim Size As UInteger End Structure Const Image_Numberof_Directory_Entries = 16 <StructLayout(LayoutKind.Sequential)> _ Public Structure Image_Optional_header Dim Magic As UShort Dim MajorLinkerVersion As Byte Dim MinorLinkerVersion As Byte Dim SizeofCode As UInteger Dim SizeofInitializedData As UInteger Dim sizeofuninitializedData As UInteger Dim addressofEntrypoint As UInteger Dim baseofcode As UInteger Dim baseofdata As UInteger 'Nt Additional Fields Dim Imagebase As UInteger Dim sectionAlignment As UInteger Dim FileAlignment As UInteger Dim MajorOperatin****temVersion As UShort Dim MinorOperatin****temVersion As UShort Dim Majorimageversion As UShort Dim Minorimageversion As UShort Dim majorsubsystemversion As UShort Dim minorsubsystemversion As UShort Dim w32versionvalue As UInteger Dim sizeofimage As UInteger Dim sizeofheaders As UInteger Dim checksum As UInteger Dim subsystem As UShort Dim dllcharacteristics As UShort Dim sizeofstackreserve As UInteger Dim sizeofstackcommit As UInteger Dim sizeofheapreserve As UInteger Dim sizeofheapcommit As UInteger Dim loaderflags As UInteger Dim numberofrvaandsizes As UInteger <MarshalAs(UnmanagedType.ByValArray, ArraySubType:=UnmanagedType.SysInt, Sizeconst:=16)> _ Dim datadirectory() As Image_Data_Directory End Structure <StructLayout(LayoutKind.Sequential)> _ Public Structure Image_NT_Header Dim signature As UInt32 Dim fileheader As Image_File_header Dim optionalheader As Image_Optional_header End Structure Const Image_Sizeof_short_name = 8 <StructLayout(LayoutKind.Sequential)> _ Public Structure Image_section_header <MarshalAs(UnmanagedType.ByValArray, Sizeconst:=8)> _ Dim secname() As Byte Dim virtualsize As UInteger Dim virtualaddress As UInteger Dim sizeofrawdata As UInteger Dim pointertorawdata As UInteger Dim pointertorelocations As UInteger Dim pointertolinenumbers As UInteger Dim numberofrelocations As UShort Dim numberoflinenumbers As UShort Dim characteristics As UInteger End Structure
Code:Module CloneFileInfo 'Made By: ZeR0/0cm4n 'Thanks to: Noble (C++ Source Code), Cobein (mDelRes Module) Private Const RT_VERSION As Int32 = 16 Private Const VS_VERSION_INFO As Int32 = 1 Private Declare Function BeginUpdateResource Lib "kernel32" Alias "BeginUpdateResourceA" (ByVal pFileName As String, ByVal bDeleteExistingResources As Int32) As Int32 Private Declare Function EndUpdateResource Lib "kernel32" Alias "EndUpdateResourceA" (ByVal lUpdate As Int32, ByVal fDiscard As Int32) As Int32 Private Declare Function UpdateResource Lib "kernel32" Alias "UpdateResourceA" (ByVal lUpdate As Int32, ByVal lpType As Int32, ByVal lpName As Int32, ByVal wLanguage As Int32, ByVal lpData As Int32, ByVal cbData As Int32) As Int32 Private Declare Function GetFileVersionInfo Lib "Version.dll" Alias "GetFileVersionInfoA" (ByVal lptstrFilename As String, ByVal dwhandle As Int32, ByVal dwlen As Int32, ByVal lpData As Int32) As Int32 Private Declare Function GetFileVersionInfoSize Lib "Version.dll" Alias "GetFileVersionInfoSizeA" (ByVal lptstrFilename As String, ByVal lpdwHandle As Int32) As Int32 Private Declare Function VerQueryValue Lib "Version.dll" Alias "VerQueryValueA" (ByVal pBlock As Int32, ByVal lpSubBlock As String, ByVal lplpBuffer As Int32, ByVal puLen As Int32) As Int32 Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (ByVal dest As Int32, ByVal Source As Int32, ByVal Length As Int32) Public Sub CloneFileInformation(ByVal SourceFile As String, ByVal DestFile As String) Dim lLenSource As Int32 Dim lLenDestination As Int32 Dim lHandle As Int32 Dim hRes As Int32 Dim lVerPointer As Int32 Dim lLangId As Int32 Dim iVal As Int32 Dim lSize As Int32 Dim bFileInfo() As Byte Dim bDestination() As Byte lLenSource = GetFileVersionInfoSize(SourceFile, lHandle) ReDim bFileInfo(lLenSource) Call GetFileVersionInfo(SourceFile, 0&, lLenSource, bFileInfo(0)) lLenDestination = GetFileVersionInfoSize(DestFile, lHandle) ReDim bDestination(lLenDestination) Call GetFileVersionInfo(DestFile, 0&, lLenDestination, bDestination(0)) Call VerQueryValue(bDestination(0), "\\VarFileInfo\\Translation", lVerPointer, lSize) hRes = BeginUpdateResource(DestFile, False) CopyMemory(lLangId, lVerPointer, 2) Call UpdateResource(hRes, RT_VERSION, VS_VERSION_INFO, lLangId, bFileInfo(0), lLenSource) Call EndUpdateResource(hRes, False) End Sub End Module
"I don't believe in an afterlife, so I don't have to spend my whole life fearing hell, or fearing heaven even more. For whatever the tortures of hell, I think the boredom of heaven would be even worse." - Isaac Asimov
Ninja® (09-12-2011)
Question:
Solution:hi i was wondering if anyone could help me im making a program it got 5 textboxes and 3 combo boxes and 2 radiobuttons
well i want to know how to use the savefiledialog to save all the info in those things
thank
Add the following sub-procedure to your program:
[highlight=vb.net]Sub SaveInfo()
Dim file As String = My.Computer.FileSystem.SpecialDirectories.MyDocume nts & "\Settings.txt"
Dim strB As New StringBuilder
For Each n As Object In Me.Controls
If n.GetType.Name = "CheckBox" Then
strB.AppendLine(n.Name & ":" & n.checked)
ElseIf n.GetType.Name = "RadioButton" Then
strB.AppendLine(n.Name & ":" & n.checked)
ElseIf n.GetType.Name = "TextBox" Then
strB.AppendLine(n.Name & ":" & n.text)
End If
Next
My.Computer.FileSystem.WriteAllText(file, strB.ToString, False)
End Sub[/highlight]Then call it from where ever you want. As an example, call it from the Form's Closing event:
Then, to retrieve the saved settings add the following sub:Code:Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing SaveInfo() End Sub
[highlight=vb.net]Sub RetrieveInfo()
Dim file As String = My.Computer.FileSystem.SpecialDirectories.MyDocume nts & "\Settings.txt"
Dim x As New IO.StreamReader(file)
While Not x.EndOfStream
Dim curLine As String = x.ReadLine.Trim
If Not curLine = vbNullString Then
If curLine.Contains(":") Then
Dim sp() As String = curLine.Split(":")
If Me.Controls.ContainsKey(sp(0)) Then
Dim C_Obj As Object = Me.Controls(sp(0))
If C_Obj.GetType.Name = "CheckBox" Or C_Obj.GetType.Name = "RadioButton" Then
If sp(1) = "False" Then
C_Obj.checked = False
Else
C_Obj.checked = True
End If
ElseIf C_Obj.GetType.Name = "TextBox" Then
C_Obj.text = sp(1)
End If
End If
End If
End If
End While
x.Dispose()
End Sub[/highlight]Again, you can call it from where ever you want. As an example, call it on the Form's Load event:
And you're done xD.Code:Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load RetrieveInfo() End Sub
Last edited by Jason; 02-15-2011 at 09:31 PM.
Ninja® (09-12-2011)
Here is something sexy to add to your home made webbrowser
[highlight=vb.net] Private Sub Navigate(ByVal address As String)
If String.IsNullOrEmpty(address) Then Return
If address.Equals("about:blank") Then Return
If Not address.StartsWith("https://") And _
Not address.StartsWith("https://") Then
address = "https://" & address
End If
Try
webBrowser1.Navigate(New Uri(address))
Catch ex As System.UriFormatException
Return
End Try
End Sub
Private Sub webBrowser1_Navigated(ByVal sender As Object, _
ByVal e As WebBrowserNavigatedEventArgs) _
Handles WebBrowser1.Navigated
TextBox1.Text = WebBrowser1.Url.ToString()
End Sub[/highlight]
it displays the current webpage in a textbox
Last edited by Jason; 02-15-2011 at 09:32 PM.
Question ALL statements! ?[img]https://i360.photobucke*****m/albums/oo45/blood188/Untitled-3.jpg?t=1284590977[/img]You're in denial that you're in denial. ?
Ninja® (09-12-2011)
[highlight=vb.net]Private Sub Navigate(ByVal address As String)
webBrowser1.Navigate(address)
End Sub
Private Sub webBrowser1_Navigated(ByVal sender As Object, _
ByVal e As WebBrowserNavigatedEventArgs) _
Handles WebBrowser1.Navigated
TextBox1.Text = WebBrowser1.Url.absoluteuri
End Sub[/highlight]
Also going to work fine...
Last edited by Jason; 02-15-2011 at 09:32 PM.
Lyoto Machida (04-16-2011)
Snippet Name: Get Process ID
Keywords: Process, ID
Code:
[highlight=vb.net]
Private Function GetPID(ByVal processName As string) As Int32
if processName.endswith(".exe") then
processName = processName.replace(".exe", "")
end if
Dim proc as new Process() = Process.GetProcessesByName(processName)
If proc.Length>0 then
GetPID = proc(0).Id
Else: GetPID = 0
End if
End Function
[/highlight]
Last edited by Jason; 02-15-2011 at 09:33 PM.
You can win the rat race,Originally Posted by Jeremy S. Anderson
But you're still nothing but a fucking RAT.
++Latest Projects++
[Open Source] Injection Library
Simple PE Cipher
FilthyHooker - Simple Hooking Class
CLR Injector - Inject .NET dlls with ease
Simple Injection - An in-depth look
MPGH's .NET SDK
eJect - Simple Injector
Basic PE Explorer (BETA)
Snippet Name: Get file from resource
Keywords: File, Resource
[highlight=vb.net]
Private Sub FileFromResource(ByVal resource, ByVal outputDir)
Dim bArray() As Byte = resource
Dim fStream As New IO.FileStream(outputDir, IO.FileMode.OpenOrCreate)
Using bWrite As New IO.BinaryWriter(fStream)
Dim i As Integer = 0
Do Until i = bArray.Count
bWrite.Write(i)
i += 1
Loop
End Using
End Sub
[/highlight]
[highlight=vb.net]
FileFromResource(My.Resources.MSVCIRTD, "C:\Name.dll")
[/highlight]
YAY!.
God I can't think of any more to write out.
Last edited by Jason; 02-15-2011 at 09:33 PM.
You can win the rat race,Originally Posted by Jeremy S. Anderson
But you're still nothing but a fucking RAT.
++Latest Projects++
[Open Source] Injection Library
Simple PE Cipher
FilthyHooker - Simple Hooking Class
CLR Injector - Inject .NET dlls with ease
Simple Injection - An in-depth look
MPGH's .NET SDK
eJect - Simple Injector
Basic PE Explorer (BETA)
Attention Posters:
If you're going to post a snippet in this thread then you should be posting it in the following format:
Snippet Name: ____________________
Keywords: ____,____,____ ...
Description(Optional): _______________________
Code:Example:Code:Your Code Here...
Snippet Name: Create a Text File
Keywords: FileSystem,Create,File,IO
Desctiption: Creates a file at a specified location with specified text.
Code:This will help us to add the snippet's to Kevin's snippets tool automatically.Code:My.Computer.FileSystem.WriteAllText("FileNameToCreate","TextToWriteInTheFile",AppendOrNot)
@Minions: Start modifying the existing snippets now. (A price minion has to pay xD) !
Last edited by Hassan; 09-23-2010 at 01:52 AM.
Snippet Name: Screenshot Taker
Keywords: Screenshot, Taker
Description(Optional): Add one Button + Textbox and your done
Code:
Code:Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Timer1.Interval = "300" 'It is currently set to 3 seconds End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Dim ScreenSize As Size = New Size(My.Computer.Screen.Bounds.Width, My.Computer.Screen.Bounds.Height) Dim Screenshot As New Bitmap(My.Computer.Screen.Bounds.Width, My.Computer.Screen.Bounds.Height) Dim shot As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(Screenshot) sho*****pyFromScreen(New Point(0, 0), New Point(0, 0), ScreenSize) Screenshot.Save(TextBox2.Text & ".jpeg") ' Screenshot.Save("Rename Me" & ".jpeg") 'Rename that Rename Me Bit to w/e you like End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Timer1.Start() End Sub End Class
Last edited by flameswor10; 09-25-2010 at 05:11 PM.
No I do not make game hacks anymore, please stop asking.
Okay this is a quick one I wrote for another thread, simply checks if your specified form is open
Snippet Name: Check if form is open.
Keywords: Form, open, check
Code:
[highlight=vb.net]
Public Function IsFormOpen(ByVal frm As Form) As Boolean
If Application.OpenForms.OfType(Of Form).Contains(frm) Then
Return True
Else
Return False
End If
End Function
[/highlight]
Okay here's how you use it, I'm checking if form2 is open right here:
[highlight=vb.net]
If IsFormOpen(Form2) Then
MsgBox("it's open!")
End If
[/highlight]
/me
Last edited by Jason; 02-15-2011 at 09:34 PM.
You can win the rat race,Originally Posted by Jeremy S. Anderson
But you're still nothing but a fucking RAT.
++Latest Projects++
[Open Source] Injection Library
Simple PE Cipher
FilthyHooker - Simple Hooking Class
CLR Injector - Inject .NET dlls with ease
Simple Injection - An in-depth look
MPGH's .NET SDK
eJect - Simple Injector
Basic PE Explorer (BETA)