Interpreting a BAS module
- From: "Pop`" <nodoby@xxxxxxxxxxxxxxxxxxx>
- Date: Sat, 22 Sep 2007 22:26:31 GMT
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`
.
- Follow-Ups:
- Re: Interpreting a BAS module
- From: Pop`
- Re: Interpreting a BAS module
- From: Randy Birch
- Re: Interpreting a BAS module
- From: Ralph
- Re: Interpreting a BAS module
- From: Larry Serflaten
- Re: Interpreting a BAS module
- From: Steve Gerrard
- Re: Interpreting a BAS module
- Prev by Date: Re: VB6 and Video Part 2
- Next by Date: Re: Interpreting a BAS module
- Previous by thread: Re: VB6 and Video Part III
- Next by thread: Re: Interpreting a BAS module
- Index(es):
Relevant Pages
|
Loading