Esiste un modo per oscurare lo schermo?? (tipo quando in xp si clicca su spegni il computer) grz in anticipo![]()
Esiste un modo per oscurare lo schermo?? (tipo quando in xp si clicca su spegni il computer) grz in anticipo![]()
simula uno screensaver.
imposta su form1, Form1.BorderStyle = 0
codice:Private Declare Function SetWindowPos Lib "user32" _ (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, _ ByVal X As Long, ByVal Y As Long, ByVal cx As Long, _ ByVal cy As Long, ByVal wFlags As Long) As Long Private Declare Function ShowCursor Lib "user32" _ (ByVal bShow As Long) As Long Sub AlwaysOnTop(FrmID As Form, OnTop As Boolean) Const SWP_NOMOVE = 2 Const SWP_NOSIZE = 1 Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE Const HWND_TOPMOST = -1 Const HWND_NOTOPMOST = -2 If OnTop Then OnTop = SetWindowPos(FrmID.hwnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS) Else OnTop = SetWindowPos(FrmID.hwnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS) End If End Sub Private Sub Form_Load() Form1.WindowState = 2 Form1.BackColor = RGB(0, 0, 0) Dim X As Integer Call AlwaysOnTop(Me, True) X = ShowCursor(False) End Sub Private Sub Form_Unload(Cancel As Integer) Dim X As Integer X = ShowCursor(True) End Sub Private Sub Form_Terminate() Dim X As Integer X = ShowCursor(True) End Sub
mah non è l'effetto k desideravo...lo skermo è del tutto nero e la finestra in qst modo è a tt skermo...grz cmq x l'aiutoaspetto altri suggerimenti...
Al codice che hai già ricevuto aggiungi questo codice:Originariamente inviato da poves
mah non è l'effetto k desideravo...lo skermo è del tutto nero e la finestra in qst modo è a tt skermo...grz cmq x l'aiutoaspetto altri suggerimenti...
per migliorarlo ulteriormente puoi impostare il Form concodice:' nelle Dichiarazioni del form Const LWA_COLORKEY = &H1 Const LWA_ALPHA = &H2 Const GWL_EXSTYLE = (-20) Const WS_EX_LAYERED = &H80000 Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long ' nell'evento Form_Load() Dim Ret As Long 'Set the window style to 'Layered' Ret = GetWindowLong(Me.hWnd, GWL_EXSTYLE) Ret = Ret Or WS_EX_LAYERED SetWindowLong Me.hWnd, GWL_EXSTYLE, Ret SetLayeredWindowAttributes Me.hWnd, 0, 128, LWA_ALPHA
BorderStyle=0
ma poi devi anche usare
così premendo ESC puoi uscire, altrimenti sei bloccato.codice:Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyEscape Then Unload Me End If End Sub![]()
Voilà! Il gioco è fatto.
![]()
P.S.
Per cortesia evita il linguaggio SMS, sappi che sui forum tecnici non è tollerato.
ok scusa per il linguaggio...comunque grazie mille è perfetto!!![]()
ma va anche con windows 7 64 bit?
mi da errore nel codice con visual basic 2010
Cosa c'entra VB 2010?Originariamente inviato da Stellsl
ma va anche con windows 7 64 bit?
mi da errore nel codice con visual basic 2010
Ovvio che non funziona.![]()
Come è indicato nel titolo il codce è per VB6 .
Comunque il codice (in VB6!) funziona anche su Windows 7.
![]()
La discussione si riferisce a un altro linguaggio, quindi è inutile risollevarla per porre una domanda di questo tipo: tanto vale aprire una nuova discussione in cui parlare del proprio problema specifico (tenendo conto che VB6 e VB.NET, nonostante l'assonanza del nome, sono agli antipodi).Originariamente inviato da Stellsl
ma va anche con windows 7 64 bit?
mi da errore nel codice con visual basic 2010
MARCO BREVEGLIERI
Software and Web Developer, Teacher and Consultant
Home | Blog | Delphi Podcast | Twitch | Altro...