[SRC] Llenar pantalla con Msgbox xD

Iniciado por x64core, 15 Septiembre 2011, 11:13 AM

0 Miembros y 1 Visitante están viendo este tema.

x64core

bueno hace un tiempo pregunte sobre como se podria hacer y estaba programando y se me vino a la mente una idea y al parecer me funciono:
muy bueno ;D
la idea de cambiar la posicion de los msg lo saque enla pagina de elguille
se puede implementar sabiendo el tamaño de la pantalla, decorando los msgbox etc es solo un ejemplo:
:xD


muestra 50  msgbox en 5 segundos
form
Código (VB) [Seleccionar]

Private Sub Form_Load()
Dim T As Long

T = GetCurrentThreadId()
hook = SetWindowsHookEx(WH_CBT, AddressOf WinProc, App.PrevInstance, T)
 
If SetTimer(Me.hwnd, 0, 100, AddressOf TimerProc) Then Debug.Print Error
End Sub

Private Sub Form_Unload(Cancel As Integer)
UnhookWindowsHookEx hook
KillTimer Me.hwnd, 0
End Sub


modulo:
Código (VB) [Seleccionar]

Option Explicit

Declare Function MessageBox Lib "user32" Alias "MessageBoxA" (ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Long) As Long
Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long

Declare Function GetCurrentThreadId Lib "kernel32" () As Long
Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As Long
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
Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long

Public Const SWP_NOSIZE = &H1
Public Const SWP_NOZORDER = &H4
Public Const SWP_NOACTIVATE = &H10
Public Const HCBT_ACTIVATE = 5
Public Const WH_CBT = 5
Private Const MB_OK = &H0&


Dim count           As Integer
Public hook         As Long

Sub TimerProc(ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long)
If count = 50 Then Unload Form1

count = count + 1
DoEvents
MessageBox hwnd, "Warning", "Example!", MB_OK
End Sub

Function WinProc(ByVal lMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

If lMsg = HCBT_ACTIVATE Then
   SetWindowPos wParam, 1, Rando, Rando, 0, 0, SWP_NOSIZE Or SWP_NOZORDER Or SWP_NOACTIVATE
End If

End Function

Function Rando() As Integer
Randomize
Rando = Int(1000 - 1) * Rnd
End Function






$Edu$

Proque: Rando = Int(1000 - 1) * Rnd + 0, el + 0 ? xD