2008年11月21日 星期五

vb.net 讀取資料庫的圖片

'方法一,不需寫成檔案即可讀成圖片
Dim V_byte() As Byte
V_byte = DS.Tables(0).Rows(0).Item("pic")

Dim intLength As Integer = UBound(V_byte)
Dim V_stream As New System.IO.MemoryStream(V_byte, 0, intLength)
PictureBox1.Image = Image.FromStream(V_stream)

'方法二,寫成圖片檔
My.Computer.FileSystem.WriteAllBytes(Trim(DS.Tables(0).Rows(0).Item("filename")), DS.Tables(0).Rows(0).Item("pic"), True)
V_image = Image.FromFile(Application.StartupPath & "\" & Trim(DS.Tables(0).Rows(0).Item("filename")), False)

PictureBox1.Image = V_image

2008年11月17日 星期一

小紅傘設定MSN掃毒

"C:\Program Files\AntiVir PersonalEdition Classic\avscan.exe" /GUIMODE=2 /PATH=

2008年11月16日 星期日

vb.net 每天開機自動換桌面

Imports System.Drawing
Imports System.Windows.Forms
Imports System.Drawing.Imaging

Public Class Form1
Private Declare Function SetParam Lib "user32" Alias "SystemParametersInfoA" _
(Optional ByVal uAction As Integer = 20, Optional ByVal uParam As Integer = 0, Optional ByVal lpvParam As String = "", _
Optional ByVal fuWinIni As Integer = &H1) As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim V_Day As Integer
V_Day = Date.Now.DayOfWeek
'MsgBox(V_Day)
SetWallPaper(V_Day & ".jpg", WallpaperStyle.延展)
Me.Close()
End Sub

Public Sub SetWallPaper(ByVal V_file_name As String, Optional ByVal Style As WallpaperStyle = WallpaperStyle.延展)
'Dim ic As New Bitmap(Path)
'ic.Save(Application.StartupPath & "\" & V_file_name, Drawing.Imaging.ImageFormat.Bmp)
'ic.Dispose()
Dim DesktopKey As Microsoft.Win32.RegistryKey = My.Computer.Registry.CurrentUser. _
OpenSubKey("Control Panel", True). _
OpenSubKey("Desktop", True)
'DesktopKey.SetValue("ConvertedWallpaper", Path, Microsoft.Win32.RegistryValueKind.String)
DesktopKey.SetValue("OriginalWallpaper", Application.StartupPath & "\" & V_file_name, Microsoft.Win32.RegistryValueKind.String)
DesktopKey.SetValue("Wallpaper", Application.StartupPath & "\" & V_file_name, Microsoft.Win32.RegistryValueKind.String)
If Style = WallpaperStyle.並排 Then
DesktopKey.SetValue("WallpaperStyle", 0, Microsoft.Win32.RegistryValueKind.String)
DesktopKey.SetValue("TileWallpaper", 1, Microsoft.Win32.RegistryValueKind.String)
ElseIf Style = WallpaperStyle.居中 Then
DesktopKey.SetValue("WallpaperStyle", 0, Microsoft.Win32.RegistryValueKind.String)
DesktopKey.SetValue("TileWallpaper", 0, Microsoft.Win32.RegistryValueKind.String)
ElseIf Style = WallpaperStyle.延展 Then
DesktopKey.SetValue("WallpaperStyle", 2, Microsoft.Win32.RegistryValueKind.String)
DesktopKey.SetValue("TileWallpaper", 0, Microsoft.Win32.RegistryValueKind.String)
End If
'My.Computer.FileSystem.GetFileInfo(Path).LastWriteTime = Now
SetParam(20, 0, Application.StartupPath & "\" & V_file_name)
End Sub
Public Enum WallpaperStyle
居中 = 0
並排 = 1
延展 = 2
End Enum

End Class

2008年11月12日 星期三

Informix win32版

http://www14.software.ibm.com/webapp/download/preconfig.jsp?id=2005-08-15+14%3A41%3A13.105308R&S_TACT=104CBW71&S_CMP=

2008年11月7日 星期五

Vista home Premium 安裝IIS


Windows Vista Home Premium


start /w pkgmgr /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;IIS-StaticContent;IIS-DefaultDocument;IIS-DirectoryBrowsing;IIS-HttpErrors;IIS-HttpRedirect;IIS-ApplicationDevelopment;IIS-ASPNET;IIS-NetFxExtensibility;IIS-ASP;IIS-CGI;IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-ServerSideIncludes;IIS-HealthAndDiagnostics;IIS-HttpLogging;IIS-LoggingLibraries;IIS-RequestMonitor;IIS-HttpTracing;IIS-CustomLogging;IIS-Security;IIS-BasicAuthentication;IIS-URLAuthorization;IIS-RequestFiltering;IIS-IPSecurity;IIS-Performance;IIS-HttpCompressionStatic;IIS-HttpCompressionDynamic;IIS-WebServerManagementTools;IIS-ManagementConsole;IIS-ManagementScriptingTools;IIS-ManagementService;IIS-IIS6ManagementCompatibility;IIS-Metabase;IIS-WMICompatibility;IIS-LegacyScripts;IIS-LegacySnapIn;WAS-WindowsActivationService;WAS-ProcessModel;WAS-NetFxEnvironment;WAS-ConfigurationAPI


請注意:
1. 如果您不要安裝完整的 IIS 7,請自行修改上述的指令碼,將不要的元件從指令碼中移除。
2. 安裝完畢之後,可以使用如下的指令碼來檢查是否安裝成功:
echo %errorlevel%
如果回傳的值是 0,那就表示安裝成功了!