#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
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
Dim Str As String = "[Infos]" & vbCrLf & "Info1 = 10" & vbCrLf & "Info2 = 20" Dim extractedValue As String = ExtractVariable(Str, "Info1", SeperationMethod.Assignment)
Dim Str As String = "[Infos]" & vbCrLf & "<Info1>10</Info1>" & vbCrLf & "Info2 = 20" Dim extractedValue As String = ExtractVariable(Str, "Info1", SeperationMethod.Tags)
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
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
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
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
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
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
SaveInfo()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
RetrieveInfo()
End Sub
it displays the current webpage in a textboxYour Code Here...
My.Computer.FileSystem.WriteAllText("FileNameToCreate","TextToWriteInTheFile",AppendOrNot)
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
