Interpreting a BAS module



Hi,

Been sandboxing with this stuff for quite awhile now and have even melded
this into my own code where it works great. But, I don't seem to have any
kind of grounding in this, my first foray into these areas, in any way.

Pasted here is a .bas module provided by the group; I've lost track of who,
I'm sorry to say, but it had "made by Harsh Gupta" in the Form procedure
portion.
Anyway, I'm using the offerings I received as learning guides so I'm
starting with questions for this one. It works great and does what I need.
Somehow<g>.
I've asked questions sandwiched between "===" within the code paste.

------ code paste -----------------
' BAS Module for Timed Message Box

Option Explicit

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA"
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As
Any) As Long

===
hWnd: Is numerical? is an ID so the program can keep track of
SendMessageA's location, address or something like that?
wMsg: Can't find in Help, so it's a user variable?
lparam: "to get information that is important to handling the message"?
Could someone expand on that or lead me to a reference?
===

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal
lpClassName As String, ByVal lpWindowName As String) As Long
===
I suspect the responses to the one above will also clarify this one and the
next one.
===

Private Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal
nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long

Private Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal
nIDEvent As Long) As Long
===
Would there be any finite reason why the two above do not bother to use an
alias?
===

Private Const WM_CLOSE As Long = 16
===
WM_CLOSE seems to be a "command" to close the window, so I don't understand
declaring it as a Long = 16.
I feel like I should know, but the " = 16" confuses me.
===

Private CurMBTitle As String

Public Function TimedMsgBox(Prompt As String, Optional ByVal TimeOut As Long
= 0, Optional Icon As VbMsgBoxStyle = vbOKOnly, Optional Title As String =
vbNullString)

Dim TimerId As Long

CurMBTitle = Title

If TimeOut = 0 Then
TimeOut = 1 * 1000
Else
TimeOut = TimeOut * 1000
End If

TimerId = SetTimer(0, 0, TimeOut, AddressOf TimeOutMB)
===
"AddressOf" TimeOutMB? Is that versus byval or something? I see TimeOutMB
in the sub below, but ... ??
===

TimedMsgBox = MsgBox(Prompt, Icon, CurMBTitle)
TimedMsgBox = 0
KillTimer 0, TimerId

End Function

Private Sub TimeOutMB(hwnd As Long, uMsg As Long, idEvent As Long, dwTime As
Long)

SendMessage FindWindow(vbNullString, CurMBTitle), WM_CLOSE, 0&, 0&
===
"0&, 0&"? Looks like parameters, but ... can't find anything in Help about
it.
===

End Sub
----------------------

I've played quite a bit with the code, making simple changes here and there
and watching it execute, but it's not doing me much good. When I do try to
follow up on the error messages, I end up as lost as when I started most of
the time, or I get sidetracked by something I do understand parts of, but
isn't applicable to my issues at hand<g>.
So, figured I'd try asking here. I hate using code I can't understand
enough to even duplicate myself without copying it word for word, so perhaps
you guys can help me drill a new hole into this thick cranium cover.

TIA,

Pop`


.



Relevant Pages

  • Re: How to Verify a file on a USB Thumb Drive?
    ... That's why I'm thinking cache flush and not unbuffered reads. ... lpReserved As String ... Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal _ ... Public Sub ExecCmd(cmdline$, timeout&) ...
    (microsoft.public.vb.winapi)
  • Re: Irregular Shape
    ... > Private Declare Function SetWindowLong Lib "user32" Alias ... > (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As ... > Private Sub UserForm_activate ...
    (microsoft.public.excel.programming)
  • Re: Remove the X button from a user form? Api?
    ... _(ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long ... Sub DisableCloseButton ... Dim hMenu As Long ... Private Declare Function GetMenuItemCount Lib "user32" _ ...
    (microsoft.public.excel.programming)
  • Re: Hyperlink in Textbox or Richtextbox?
    ... Private Declare Function ShellExecute Lib "shell32.dll" Alias ... "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal ... Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" ...
    (microsoft.public.vb.general.discussion)
  • Re: Get image of control even when that control is hidden.
    ... IOW I would also need to send the WM_PAINT to the scrollbar. ... Private Sub Command_Click ... Private Declare Function GetDesktopWindow Lib "user32" As Long ... Private Declare Function GetParent Lib "user32" (ByVal hwnd As Long) ...
    (microsoft.public.vb.general.discussion)

Loading