Unicode Caption nel form
Domenica 15 Marzo 2009 18:08
amministratore
Public Property Let CaptionW(ByRef NewValue As String)
Static WndProc As Long, VBWndProc As Long
m_Caption = NewValue
' get window procedures if we don't have them
If WndProc = 0 Then
' the default Unicode window procedure
WndProc = GetProcAddress(GetModuleHandleW(StrPtr("user32")), "DefWindowProcW")
' window procedure of this form
VBWndProc = GetWindowLongA(hWnd, GWL_WNDPROC)
End If
' ensure we got them
If WndProc <> 0 Then
' replace form's window procedure with the default Unicode one
SetWindowLongW hWnd, GWL_WNDPROC, WndProc
' change form's caption
SetWindowTextW hWnd, StrPtr(m_Caption)
' restore the original window procedure
SetWindowLongA hWnd, GWL_WNDPROC, VBWndProc
Else
' no Unicode for us
Caption = m_Caption
End If
End Property
Cambiare lo sfondo del desktop
Domenica 15 Marzo 2009 18:10
amministratore
Ecco un codice che permette di cambiare lo sfondo del desktop mettendo il percorso:
Declare Function SystemParametersInfo Lib "user32" Alias _
"SystemParametersInfoA" (ByVal uAction As Long, _
ByVal uParam As Long, lpvParam As Any, ByVal fuWinIni As Long) As Long
Dim t As Long
Dim Wallpaper As String
Wallpaper = InputBox("Introduci il path completo")
If Wallpaper = "" Then Exit Sub
t = SystemParametersInfo(ByVal 20, vbnostring, ByVal Wallpaper, &H1)
If t = 0 Then
MousePointer = 0
MsgBox "Errore !"
Exit Sub
End If
End Sub