PDA

View Full Version : سرس کد های مفید و کاربردی



saadi2
سه شنبه 21 مهر 1388, 23:14 عصر
موضوعات این تاپیک:

سورس اول برنامه ای برای Encrypt و decrypt کردن متن ها (http://barnamenevis.org/forum/attachment.php?attachmentid=38331&stc=1&d=1255464225)

یه پروژه نصبتا کامل برای استفاده از encrypt و decrypt (http://barnamenevis.org/forum/showpost.php?p=828379&postcount=11)

سورس attach و detach کردن دیتابیس sql با یک دکمه (http://barnamenevis.org/forum/showpost.php?p=827023&postcount=6)

گرفتن سریال ویندوز xp (http://barnamenevis.org/forum/showpost.php?p=826735&postcount=2)

کپی کردن یک folder با تمام مجتویات آن (http://barnamenevis.org/forum/showpost.php?p=826758&postcount=5)

نمایش رزولوشن صفحه ویندوز (http://barnamenevis.org/forum/showpost.php?p=827878&postcount=7)

سورس کار با رزولوشن و مانیتور ویندوز (http://barnamenevis.org/forum/showpost.php?p=870684&postcount=15)

نمایش computer name و نام یوزر در ویندوز (http://barnamenevis.org/forum/showpost.php?p=828560&postcount=12)

EmptyRecyclebin (http://barnamenevis.org/forum/showpost.php?p=867277&postcount=13)

drive combobox and font combobox (http://barnamenevis.org/forum/showpost.php?p=894839&postcount=11)

saadi2
سه شنبه 21 مهر 1388, 23:23 عصر
گرفتن سریال ویندوز xp



Imports Microsoft.Win32
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
MsgBox(sGetXPKey)
End Sub
End Class
Module modXPKey
Public Function sGetXPKey() As String
Dim RegKey As RegistryKey = _
Registry.LocalMachine.OpenSubKey("Software\Microsoft\Windows NT\CurrentVersion", False)
Dim bytDPID() As Byte = RegKey.GetValue("DigitalProductID")
Dim bytKey(14) As Byte
Array.Copy(bytDPID, 52, bytKey, 0, 15)
Dim strChar As String = "BCDFGHJKMPQRTVWXY2346789"
Dim strKey As String = ""
For j As Integer = 0 To 24
Dim nCur As Short = 0
For i As Integer = 14 To 0 Step -1
nCur = CShort(nCur * 256 Xor bytKey(i))
bytKey(i) = CByte(Int(nCur / 24))
nCur = CShort(nCur Mod 24)
Next
strKey = strChar.Substring(nCur, 1) & strKey
Next
For i As Integer = 4 To 1 Step -1
strKey = strKey.Insert(i * 5, "-")
Next
Return strKey
End Function
End Module

saadi2
چهارشنبه 22 مهر 1388, 00:00 صبح
کپی کردن یک folder با تمام مجتویات آن



Public Class Form1
Public Sub CopyDirectory(ByVal Mabda As String, ByVal Maghsad As String)
Dim dirInfo As New System.IO.DirectoryInfo(Mabda)
Dim fsInfo As System.IO.FileSystemInfo
If Not System.IO.Directory.Exists(Maghsad) Then
System.IO.Directory.CreateDirectory(Maghsad)
End If
For Each fsInfo In dirInfo.GetFileSystemInfos
Dim strDestFileName As String = System.IO.Path.Combine(Maghsad, fsInfo.Name)
If TypeOf fsInfo Is System.IO.FileInfo Then
System.IO.File.Copy(fsInfo.FullName, strDestFileName, True)
'This will overwrite files that already exist
Else
CopyDirectory(fsInfo.FullName, strDestFileName)
End If
Next
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
CopyDirectory("C:\jj", "C:\kk")
End Sub
End Class

saadi2
چهارشنبه 22 مهر 1388, 14:24 عصر
اینم سورس attach و detach کردن دیتابیس sql با یک دکمه که نوشتم و خیلی خوب از کار در اومده

saadi2
پنج شنبه 23 مهر 1388, 20:26 عصر
نمایش رزولوشن صفحه ویندوز:



MsgBox(My.Computer.Screen.Bounds.Width & "x" & My.Computer.Screen.Bounds.Height)

saadi2
جمعه 24 مهر 1388, 18:04 عصر
این برنامه ای که نوشتم یه پروژه نصبتا کامل برای استفاده از encrypt و decrypt هست.

1- امکان استفاده از row filter برای ستونی که encrypt شده

2- نمایش جدولی که یک یا چند ستون آن encrypt شده به صورتی که اول اطلاعات decrypt میشود سپس در گرید نمایش داده میشود.
3- امکان ویرایش و اضافه کردن فیلد بدون اینکه encrypt شدن دیتا مزاحمتی ایجاد کند
و ....

saadi2
جمعه 24 مهر 1388, 23:25 عصر
نمایش computer name و نام یوزر در ویندوز :



Dim CompName As String = System.Environment.MachineName.ToString
Dim UseName As String = System.Environment.UserName.ToString
MsgBox(CompName + "/" + UseName)

saadi2
یک شنبه 22 آذر 1388, 03:53 صبح
Empty RecycleBin



Public Class Form1
Private Declare Function SHEmptyRecycleBin Lib "shell32.dll" Alias "SHEmptyRecycleBinA" (ByVal hWnd As Int32, ByVal pszRootPath As String, ByVal dwFlags As Int32) As Int32
Private Declare Function SHUpdateRecycleBinIcon Lib "shell32.dll" () As Int32
Private Const SHERB_NOCONFIRMATION = &H1
Private Const SHERB_NOPROGRESSUI = &H2
Private Const SHERB_NOSOUND = &H4

Private Sub EmptyRecycleBin()
SHEmptyRecycleBin(Me.Handle.ToInt32, vbNullString, SHERB_NOCONFIRMATION + SHERB_NOSOUND)
SHUpdateRecycleBinIcon()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
EmptyRecycleBin()
End Sub
End Class

naserrezaee
یک شنبه 22 آذر 1388, 14:05 عصر
کپی کردن یک folder با تمام مجتویات آن



PublicClass Form1
PublicSub CopyDirectory(ByVal Mabda AsString, ByVal Maghsad AsString)
Dim dirInfo AsNew System.IO.DirectoryInfo(Mabda)
Dim fsInfo As System.IO.FileSystemInfo
IfNot System.IO.Directory.Exists(Maghsad) Then
System.IO.Directory.CreateDirectory(Maghsad)
EndIf
ForEach fsInfo In dirInfo.GetFileSystemInfos
Dim strDestFileName AsString = System.IO.Path.Combine(Maghsad, fsInfo.Name)
IfTypeOf fsInfo Is System.IO.FileInfo Then
System.IO.File.Copy(fsInfo.FullName, strDestFileName, True)
'This will overwrite files that already exist
Else
CopyDirectory(fsInfo.FullName, strDestFileName)
EndIf
Next
EndSub
PrivateSub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load
CopyDirectory("C:\jj", "C:\kk")
EndSub
EndClass


سلام دوست عزيز خواستم بگم قطعه كد زير هم همين كار رو ميكنه ول يبا دردسر كمتر ، اينطور نيست ؟!!!


My.Computer.FileSystem.CopyDirectory("c:\test", "d:\test", True)

saadi2
پنج شنبه 26 آذر 1388, 21:24 عصر
سورس کار با رزولوشن و مانیتور ویندوز

http://www.planet-source-code.com/Upload_PSC/ScreenShots/PIC2005812351338245.JPG

saadi2
شنبه 03 بهمن 1388, 19:23 عصر
drive combobox and font combobox