|
-
May 22nd, 2003, 02:53 AM
#1
VB API Tutorial - Standard windows messages
Windows has a large number of predefined windows messages which are sent to a window when a given event occurs. You can intercept these messages by subclassing the window and take actions accordingly. This allows you to alter or extend the way that a standard VB window (or control) behaves.
The currently defined set of windows messages is:
VB Code:
Public Enum WindowMessages
WM_ACTIVATE = &H6
WM_ACTIVATEAPP = &H1C
WM_ASKCBFORMATNAME = &H30C
WM_CANCELJOURNAL = &H4B
WM_CANCELMODE = &H1F
WM_CAPTURECHANGED = &H1F
WM_CAPTURECHANGED_R = &H215
WM_CHANGECBCHAIN = &H30D
WM_CHAR = &H102
WM_CHARTOITEM = &H2F
WM_CHILDACTIVATE = &H22
WM_CHOOSEFONT_GETLOGFONT = &H401
WM_CHOOSEFONT_SETFLAGS = (&H400 + 102)
WM_CHOOSEFONT_SETLOGFONT = (&H400 + 101)
WM_CLEAR = &H303
WM_CLOSE = &H10
WM_COMMAND = &H111
WM_COMPACTING = &H41
WM_COMPAREITEM = &H39
WM_CONTEXTMENU = &H7B
WM_CONVERTREQUESTEX = &H108
WM_COPY = &H301
WM_COPYDATA = &H4A
WM_CREATE = &H1
WM_CTLCOLORBTN = &H135
WM_CTLCOLORDLG = &H136
WM_CTLCOLOREDIT = &H133
WM_CTLCOLORLISTBOX = &H134
WM_CTLCOLORMSGBOX = &H132
WM_CTLCOLORSCROLLBAR = &H137
WM_CTLCOLORSTATIC = &H138
WM_CUT = &H300
WM_DDE_ACK = (&H3E0 + 4)
WM_DDE_ADVISE = (&H3E0 + 2)
WM_DDE_DATA = (&H3E0 + 5)
WM_DDE_EXECUTE = (&H3E0 + 8)
WM_DDE_FIRST = &H3E0
WM_DDE_INITIATE = &H3E0
WM_DDE_LAST = (&H3E0 + 8)
WM_DDE_POKE = (&H3E0 + 7)
WM_DDE_REQUEST = (&H3E0 + 6)
WM_DDE_TERMINATE = (&H3E0 + 1)
WM_DDE_UNADVISE = (&H3E0 + 3)
WM_DEADCHAR = &H103
WM_DELETEITEM = &H2D
WM_DESTROY = &H2
WM_DESTROYCLIPBOARD = &H307
WM_DEVICECHANGE = &H219
WM_DEVMODECHANGE = &H1B
WM_DRAWCLIPBOARD = &H308
WM_DRAWITEM = &H2B
WM_DROPFILES = &H233
WM_ENABLE = &HA
WM_ENDSESSION = &H16
WM_ENTERIDLE = &H121
WM_ENTERSIZEMOVE = &H231
WM_ENTERMENULOOP = &H211
WM_ERASEBKGND = &H14
WM_EXITMENULOOP = &H212
WM_EXITSIZEMOVE = &H232
WM_FONTCHANGE = &H1D
WM_GETDLGCODE = &H87
WM_GETFONT = &H31
WM_GETHOTKEY = &H33
WM_GETMINMAXINFO = &H24
WM_GETTEXT = &HD
WM_GETTEXTLENGTH = &HE
WM_HELP = &H53
WM_HOTKEY = &H312
WM_HSCROLL = &H114
WM_HSCROLLCLIPBOARD = &H30E
WM_ICONERASEBKGND = &H27
WM_IME_CHAR = &H286
WM_IME_COMPOSITION = &H10F
WM_IME_COMPOSITIONFULL = &H284
WM_IME_CONTROL = &H283
WM_IME_ENDCOMPOSITION = &H10E
WM_IME_KEYDOWN = &H290
WM_IME_KEYLAST = &H10F
WM_IME_KEYUP = &H291
WM_IME_NOTIFY = &H282
WM_IME_SELECT = &H285
WM_IME_SETCONTEXT = &H281
WM_IME_STARTCOMPOSITION = &H10D
WM_INITDIALOG = &H110
WM_INITMENU = &H116
WM_INITMENUPOPUP = &H117
WM_INPUTLANGCHANGEREQUEST = &H50
WM_INPUTLANGCHANGE = &H51
WM_KEYDOWN = &H100
WM_KEYUP = &H101
WM_KILLFOCUS = &H8
WM_LBUTTONDBLCLK = &H203
WM_LBUTTONDOWN = &H201
WM_LBUTTONUP = &H202
WM_MBUTTONDBLCLK = &H209
WM_MBUTTONDOWN = &H207
WM_MBUTTONUP = &H208
WM_MDIACTIVATE = &H222
WM_MDICASCADE = &H227
WM_MDICREATE = &H220
WM_MDIDESTROY = &H221
WM_MDIGETACTIVE = &H229
WM_MDIICONARRANGE = &H228
WM_MDIMAXIMIZE = &H225
WM_MDINEXT = &H224
WM_MDIREFRESHMENU = &H234
WM_MDIRESTORE = &H223
WM_MDISETMENU = &H230
WM_MDITILE = &H226
WM_MEASUREITEM = &H2C
WM_MENUCHAR = &H120
WM_MENUSELECT = &H11F
WM_MENURBUTTONUP = &H122
WM_MENUDRAG = &H123
WM_MENUGETOBJECT = &H124
WM_MENUCOMMAND = &H126
WM_MOUSEACTIVATE = &H21
WM_MOUSEHOVER = &H2A1
WM_MOUSELEAVE = &H2A3
WM_MOUSEMOVE = &H200
WM_MOUSEWHEEL = &H20A
WM_MOVE = &H3
WM_MOVING = &H216
WM_NCACTIVATE = &H86
WM_NCCALCSIZE = &H83
WM_NCCREATE = &H81
WM_NCDESTROY = &H82
WM_NCHITTEST = &H84
WM_NCLBUTTONDBLCLK = &HA3
WM_NCLBUTTONDOWN = &HA1
WM_NCLBUTTONUP = &HA2
WM_NCMBUTTONDBLCLK = &HA9
WM_NCMBUTTONDOWN = &HA7
WM_NCMBUTTONUP = &HA8
WM_NCMOUSEMOVE = &HA0
WM_NCPAINT = &H85
WM_NCRBUTTONDBLCLK = &HA6
WM_NCRBUTTONDOWN = &HA4
WM_NCRBUTTONUP = &HA5
WM_NEXTDLGCTL = &H28
WM_NEXTMENU = &H213
WM_NULL = &H0
WM_PAINT = &HF
WM_PAINTCLIPBOARD = &H309
WM_PAINTICON = &H26
WM_PALETTECHANGED = &H311
WM_PALETTEISCHANGING = &H310
WM_PARENTNOTIFY = &H210
WM_PASTE = &H302
WM_PENWINFIRST = &H380
WM_PENWINLAST = &H38F
WM_POWER = &H48
WM_POWERBROADCAST = &H218
WM_PRINT = &H317
WM_PRINTCLIENT = &H318
WM_PSD_ENVSTAMPRECT = (&H400 + 5)
WM_PSD_FULLPAGERECT = (&H400 + 1)
WM_PSD_GREEKTEXTRECT = (&H400 + 4)
WM_PSD_MARGINRECT = (&H400 + 3)
WM_PSD_MINMARGINRECT = (&H400 + 2)
WM_PSD_PAGESETUPDLG = (&H400)
WM_PSD_YAFULLPAGERECT = (&H400 + 6)
WM_QUERYDRAGICON = &H37
WM_QUERYENDSESSION = &H11
WM_QUERYNEWPALETTE = &H30F
WM_QUERYOPEN = &H13
WM_QUEUESYNC = &H23
WM_QUIT = &H12
WM_RBUTTONDBLCLK = &H206
WM_RBUTTONDOWN = &H204
WM_RBUTTONUP = &H205
WM_RENDERALLFORMATS = &H306
WM_RENDERFORMAT = &H305
WM_SETCURSOR = &H20
WM_SETFOCUS = &H7
WM_SETFONT = &H30
WM_SETHOTKEY = &H32
WM_SETREDRAW = &HB
WM_SETTEXT = &HC
WM_SETTINGCHANGE = &H1A
WM_SHOWWINDOW = &H18
WM_SIZE = &H5
WM_SIZING = &H214
WM_SIZECLIPBOARD = &H30B
WM_SPOOLERSTATUS = &H2A
WM_SYSCHAR = &H106
WM_SYSCOLORCHANGE = &H15
WM_SYSCOMMAND = &H112
WM_SYSDEADCHAR = &H107
WM_SYSKEYDOWN = &H104
WM_SYSKEYUP = &H105
WM_TIMECHANGE = &H1E
WM_TIMER = &H113
WM_UNDO = &H304
WM_USER = &H400
WM_VKEYTOITEM = &H2E
WM_VSCROLL = &H115
WM_VSCROLLCLIPBOARD = &H30A
WM_WINDOWPOSCHANGED = &H47
WM_WINDOWPOSCHANGING = &H46
WM_WININICHANGE = &H1A
WM_APPCOMMAND = &H319
End Enum
As well as the message there are two parameters called wParam and lParam which give you additional information about the event that occured.
-
May 22nd, 2003, 02:54 AM
#2
WM_ACTIVATEAPP
WM_ACTIVATEAPP
This message is sent to the top level window of an application when that application gains or loses the focus. i.e. when the user ALT+TAB switches to/from it or clicks on the application in the task bar etc.
wParam - This is non-zero if your application is gaining the focus, and zero if it is losing the focus.
lParam - This is the thread handle of the other application. If your application gains the focus this is the thread handle of the application that lost the focus and if your application loses the focus this is the thread handle of the application that will get the focus next.
-
May 22nd, 2003, 02:55 AM
#3
WM_CAPTURECHANGED
WM_CAPTURECHANGED
This message is sent to a window when it gains of loses the mouse capture, either as a result of the user or by the SetCapture API call.
wParam - This parameter is ignored
lParam - The window handle of the window which is gaining the focus.
-
May 22nd, 2003, 02:56 AM
#4
WM_CHAR
WM_CHAR
This message is posted to a window when a keyboard key is pressed (other than ALT) and the window has the input focus.
wParam - This is the virtual key number which corresponds to the vbKey constants like vbKeyA if key "A" was pressed.
lParam - This holds additional information about the key press.
Bits 0-15 is the repetition count (when a key is held down)
Bits 16-23 is the scan code of the key - this is dependednt on the actual keyboard hardware
Bit 29 is set if the ALT key is down
Bit 30 is set if the key was already down i.e. the event is due to a key repetition
Bit 31 is set if the ke is being pressed, i.e. opposite to bit 30
-
May 22nd, 2003, 02:57 AM
#5
WM_COMPACTING
WM_COMPACTING
This message is sent to all top level windows when the operating system is running low on memory and is compacting the memory.
wParam - The amount of time spent compacting : the higher this number is the more trouble windows is having freeing up memory
lParam - Unused (set to zero)
-
May 22nd, 2003, 02:58 AM
#6
WM_MOVE
WM_MOVE
This message is sent to a window when it has been moved.
(Why this isn't part of the standard VB form events is beyond me...)
wParam - Unused, set to zero
lParam The upper 16 bits (HIWORD) hold the vertical (y) position of the window after the move, and the lower 16 bits (LOWORD) holds the horizontal(x) position of the window after the move.
You can use this message to be notified whenever a user moves a form.
-
May 22nd, 2003, 02:59 AM
#7
WM_NCLBUTTONDOWN etc...
WM_NCLBUTTONDOWN , WM_NCMBUTTONDOWN , WM_NCRBUTTONDOWN , WM_NCLBUTTONUP etc.
WM_NCLBUTTONDOWN , WM_NCMBUTTONDOWN , WM_NCRBUTTONDOWN
The mouse button (left, middle or right respectively) was pressed down while the pointer was over the non-client area of the subclassed window.
WM_NCLBUTTONUP , WM_NCMBUTTONUP , WM_NCRBUTTONUP
The mouse button (left, middle or right respectively) was released while the pointer was over the non-client area of the subclassed window.
WM_NCMOUSEMOVE
The mouse moved over the non client area of the form
wParam - The bit of the non client area which the mouse event occured over. This can be one of:
VB Code:
Public Enum enHitTestResult
HTBORDER = 18
HTBOTTOM = 15
HTBOTTOMLEFT = 16
HTBOTTOMRIGHT = 17
HTCAPTION = 2
HTCLIENT = 1
HTERROR = (-2)
HTGROWBOX = 4
HTHSCROLL = 6
HTLEFT = 10
HTMAXBUTTON = 9
HTMENU = 5
HTMINBUTTON = 8
HTNOWHERE = 0
HTRIGHT = 11
HTSYSMENU = 3
HTTOP = 12
HTTOPLEFT = 13
HTTOPRIGHT = 14
HTVSCROLL = 7
HTTRANSPARENT = (-1)
HTOBJECT = 19
HTCLOSE = 20
HTHELP = 21
End Enum
lParam - The lower 16 bits are an unsigned integer representing the x position of the mouse pointer when the event occured and the upper 16 bits are an unsigned integer representing the y position of the pointer.
-
May 22nd, 2003, 03:01 AM
#8
WM_MINMAXSIZE
WM_GETMINMAXINFO
Whenever a window is going from being minimised to maximised or restored this message is sent to the window to allow it to specify the size of the window resulting from the operation.
wParam - Unused
lParam - Pointer to a MINMAXINFO structure defined thus:
VB Code:
Private Type POINTAPI
x As Long
y As Long
End Type
Private Type MINMAXINFO
ptReserved As POINTAPI
ptMaxSize As POINTAPI
ptMaxPosition As POINTAPI
ptMinTrackSize As POINTAPI
ptMaxTrackSize As POINTAPI
End Type
You can use the API call RtlMoveMemory to copy this structure to or from this pointer e.g.:
VB Code:
Private Declare Sub CopyMemoryMinMaxInfo Lib "kernel32" _
Alias "RtlMoveMemory" (Destination As MINMAXINFO, _
ByVal Source As Long, ByVal Length As Long)
Private Declare Sub CopyMinMaxToMemoryInfo Lib "kernel32" _
Alias "RtlMoveMemory" (ByVal Destination As Long, _
Source As MINMAXINFO, ByVal Length As Long)
Thus to make the maximised size of a window to be 300 x 200 you could process this message thus:
VB Code:
'..snippet from message handler loop
Case WM_GETMINMAXINFO
Dim mmInfo As MINMAXINFO
Call CopyMemoryMinMaxInfo(mmInfo, lParam, Len(mmInfo)
With mmInfo.ptMaxSize
.x = 300
.y = 200
End With
Call CopyMinMaxToMemoryInfo(lParam, mmInfo, Len(mmInfo))
'...
-
May 22nd, 2003, 03:05 AM
#9
WM_SIZING
WM_SIZING
WM_SIZING is sent to a sizeable window (i.e. a form with borderstyle set to Sizeable) when the user is resizing it.
Intercepting this message allows you to control the resizing process without flickering as the message is sent before the form is drawn at it's new size.
wParam - Indicates which edge is being used to resize the window. This value is one of:
- WMSZ_LEFT = 1 The sizing is from the left hand frame border
- WMSZ_RIGHT = 2 The sizing is from the right hand frame border
- WMSZ_TOP = 3 The sizing is from the top frame border
- WMSZ_TOPLEFT = 4 The sizing is from the top left corner
- WMSZ_TOPRIGHT = 5 The sizing is from the top right corner
- WMSZ_BOTTOM = 6 The sizing is from the bottom frame border
- WMSZ_BOTTOMLEFT = 7 The sizing is from the bottom left corner
- WMSZ_BOTTOMRIGHT = 8 'The sizing is from the bottom right corner
[b]lParam is a pointer to the rectangle that describes the size of the window after the sizing has taken place. If you alter the values of this rectangle the sizing will go to that size instead.
e.g. to prevent the width of the window exceeding 100 pixels:-
VB Code:
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Sub CopyMemoryRect Lib "kernel32" Alias "RtlMoveMemory" (Destination As RECT, _
ByVal Source As Long, ByVal Length As Long)
Private Declare Sub CopyMemoryFromRect Lib "kernel32" Alias "RtlMoveMemory" (ByVal Destination As Long, _
Source As RECT, ByVal Length As Long)
'.....
If msg = WM_SIZING Then
Dim rcSize As RECT
Call CopyMemoryRect(rcSize, lParam, Len(rcSize))
If rcSize.Right - rcSize.Left > 100 Then
rcSize.Right = rcSize.Left + 100
End If
Call CopyMemoryFromRect(lParam, rcSize, Len(rcSize))
End If
'.....
-
May 22nd, 2003, 03:07 AM
#10
WM_MOVING
WM_MOVING
WM_MOVING is sent to a window when the user is moving it by dragging it.
Intercepting this message allows you to control the resizing process without flickering as the message is sent before the form is drawn at it's new size.
lParam is a pointer to the rectangle that describes the position of the window after the move has taken place. If you alter the values of this rectangle the window will move to that position instead.
e.g. to prevent the being moved left of the middle of the screen:-
VB Code:
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Sub CopyMemoryRect Lib "kernel32" Alias "RtlMoveMemory" (Destination As RECT, _
ByVal Source As Long, ByVal Length As Long)
Private Declare Sub CopyMemoryFromRect Lib "kernel32" Alias "RtlMoveMemory" (ByVal Destination As Long, _
Source As RECT, ByVal Length As Long)
'.....
If msg = WM_MOVING Then
Dim rcMove As RECT
Call CopyMemoryRect(rcMove , lParam, Len(rcMove ))
If rcMove < (Screen.Width / 2 ) / Screen.TwipsperPixelX Then
rcMove.Left = (Screen.Width / 2 ) / Screen.TwipsperPixelX
End If
Call CopyMemoryFromRect(lParam, rcMove , Len(rcMove ))
End If
'.....
-
May 22nd, 2003, 03:09 AM
#11
WM_MOUSEHOVER
WM_MOUSEHOVER
WM_MOUSEHOVER is sent to a window that has been registered as a mouse tracking window if the pointer hovers over that window for a system defined time period.
wParam - The combination of mouse key flags which show which buttons were pressed down:
- MK_LBUTTON &H1 indicates that the left mouse button is pressed
- MK_RBUTTON &H2 indicates that the right mouse button is pressed
- MK_SHIFT &H4 indicates that the Shift key is pressed
- MK_CONTROL &H8 indicates that the Control key is pressed
- MK_MBUTTON &H10 idicates that the middle mouse button is pressed
- MK_XBUTTON1 &H20 indicates that the first XButton is pressed
- MK_XBUTTON2 &H40 indicates that the second XButton is pressed
lParam - The lower 16 bits are an unsigned integer representing the x position of the mouse pointer when the event occured and the upper 16 bits are an unsigned integer representing the y position of the pointer.
Notes - To tell Windows that you wish to be informed about the MouseHover event you need to fill in a TRACKMOUSEEVENT structure and call the TrackMouseEvent API call.
VB Code:
Public Enum TrackMouseEventFlags
TME_HOVER = &H1
TME_LEAVE = &H2
TME_NONCLIENT = &H10
TME_QUERY = &H40000000
TME_CANCEL = &H80000000
End Enum
Private Type TRACKMOUSESTRUCT
cbSize As Long
dwFlags As TrackMouseEventFlags '\\ TrackMouseEvents
hwndTrack As Long '\\ Target window
dwHoverTime As Long '\\ Mouse hover timeout in milliseconds
End Type
Private Declare Function TrackMouseEvent Lib "user32" (lpTrackMouseStruct As TRACKMOUSESTRUCT) As Long
-
May 22nd, 2003, 03:11 AM
#12
WM_MOUSELEAVE
WM_MOUSELEAVE
WM_MOUSELEAVE is sent to a window that has been registered as a mouse tracking window if the pointer leaves that window.
wParam - NOT USED
lParam - NOT USED
Notes - To tell Windows that you wish to be informed about the MouseHover event you need to fill in a TRACKMOUSEEVENT structure and call the TrackMouseEvent API call.
VB Code:
Public Enum TrackMouseEventFlags
TME_HOVER = &H1
TME_LEAVE = &H2
TME_NONCLIENT = &H10
TME_QUERY = &H40000000
TME_CANCEL = &H80000000
End Enum
Private Type TRACKMOUSESTRUCT
cbSize As Long
dwFlags As TrackMouseEventFlags '\\ TrackMouseEvents
hwndTrack As Long '\\ Target window
dwHoverTime As Long '\\ Mouse hover timeout in milliseconds
End Type
Private Declare Function TrackMouseEvent Lib "user32" (lpTrackMouseStruct As TRACKMOUSESTRUCT) As Long
-
May 22nd, 2003, 03:13 AM
#13
WM_CTLCOLORBUTTON
WM_CTLCOLORBTN
WM_CTLCOLORBTN - is sent to a perent window (such as a form or panel control) when a button control on that form is going to be drawn to allow the parent to supply a different brush to colour it with.
wParam - A handle to the Device Context of the button control that is going to be drawn
lParam - The window handle of the button control that is going to be drawn.
Notes In order to paint the button using a different brush you pass the logical brush handle back as the return value from your window proc and do not pass the message on to the standard window procedure.
For example, to paint the button with a hatched red background:
VB Code:
Public Enum BrushStyles
BS_SOLID = 0
BS_NULL = 1
BS_HATCHED = 2
BS_PATTERN = 3
BS_INDEXED = 4
BS_DIBPATTERN = 5
BS_DIBPATTERNPT = 6
BS_PATTERN8X8 = 7
BS_DIBPATTERN8X8 = 8
BS_MONOPATTERN = 9
End Enum
Public Enum HatchStyles
HS_HORIZONTAL = 0 '/* ----- */
HS_VERTICAL = 1 '/* ||||| */
HS_FDIAGONAL = 2 '/* \\\\\ */
HS_BDIAGONAL = 3 '/* ///// */
HS_CROSS = 4 '/* +++++ */
HS_DIAGCROSS = 5 '/* xxxxx */
End Enum
Private Type LogBrush
lbStyle As BrushStyles
lbColor As Long
lbHatch As HatchStyles
End Type
Private Declare Function CreateBrushIndirect Lib "gdi32" (lpLogBrush As LogBrush) As Long
Dim hMyButtonBrush As Long
And at form load use:
VB Code:
Private Sub Form_Load()
Dim brush As LogBrush
With brush
.lbStyle = BS_HATCHED
.lbColor = vbRed
.lbHatch = HS_DIAGCROSS
End With
hMyButtonBrush = CreateBrushIndirect(brush)
and in the subclass procedure...
VB Code:
'......
If msg = WM_CTLCOLORBUTTON Then
WndProc = hMyButtonBrush
Exit Function
Else
WndProc = CallWindowProc(lpOldProc, wMsg, wParam, lParam)
End If
-
May 22nd, 2003, 03:14 AM
#14
WMCTLCOLORSCROLL etc.
WM_CTLCOLOREDIT , WM_CTLCOLORLISTBOX , WM_CTLCOLORSCROLLBAR , WM_CTLCOLORSTATIC
WM_CTLCOLOREDIT , WM_CTLCOLORLISTBOX , WM_CTLCOLORSCROLLBAR , WM_CTLCOLORSTATIC - Same as WM_CTLCOLORBUTTON except for textbox, listbox, scrollbar and static controls respectively.
-
May 22nd, 2003, 03:16 AM
#15
WM_MOUSEWHEEL
WM_MOUSEWHEEL - This message is sent to the window that has the input capture when the user moves the mouse wheel up or down.
wParam - The upper 16 bits hold the amount of rotation (negative being downwards, positive up) and the lower 16 bits hold the mouse key flags:
- MK_LBUTTON &H1 indicates that the left mouse button is pressed
- MK_RBUTTON &H2 indicates that the right mouse button is pressed
- MK_SHIFT &H4 indicates that the Shift key is pressed
- MK_CONTROL &H8 indicates that the Control key is pressed
- MK_MBUTTON &H10 idicates that the middle mouse button is pressed
- MK_XBUTTON1 &H20 indicates that the first XButton is pressed
- MK_XBUTTON2 &H40 indicates that the second XButton is pressed
lParam - The lower 16 bits represents the x position of the mouse pointer when the wheel moved and the upper 16 bits represent the y position.
-
May 27th, 2003, 07:20 AM
#16
Fanatic Member
this is really good!!
congrats!
you are getting a 5 rating from me!
but aren't you going to continue it?
Best Regards,
seec77
If you helped me, cosinder yourself thanked.
Get each and every Garfield strip here!
Here you can get all Calvin & Hobes strips!
Damn UComics! It was probably unprofitable for them to allow us to just download Garfield and Calving & Hobes strips... so they made folder indexing unallowed on their server!!!
I am 33% addicted to Counterstrike. What about you?
I am 23% addicted to Star Wars. What about you?
I am 0% addicted to Tupac. What about you?
-
May 27th, 2003, 08:03 AM
#17
I'm only working on those messages that VB does not convert into a native VB method at the moment. Each message is documented on MSDN but this is still going to take some time...
-
May 29th, 2003, 04:28 AM
#18
WM_HSCROLL and WM_VSCROLL
WM_HSCROLL and WM_VSCROLL are sent to a window when the intrinsic scrollbars of that window are moved. Although VB forms do not have a property that coresponds to showing the intrinsic scrollbars you can simulate this by adding the window styles WS_HSCROLL and WH_VSCROLL to the window.
wParam: The LOWORD specifies the scroll type, and the HIWORD specifies the value of the scrollbar position after the scroll is effected.
VB Code:
Public Enum enScrollMessages
SB_ENDSCROLL = 8
SB_TOP = 6
SB_LINELEFT = 0
SB_LINERIGHT = 1
SB_LINEDOWN = 1
SB_LINEUP = 0
SB_PAGEDOWN = 3
SB_PAGELEFT = 2
SB_PAGERIGHT = 3
SB_PAGEUP = 2
SB_RIGHT = 7
SB_LEFT = 6
SB_THUMBPOSITION = 4
SB_THUMBTRACK = 5
End Enum
lParam: If the message is sent to a parent window from a scroll control then this holds the window handle of the scrollbar control that sent the message
-
Oct 30th, 2003, 07:23 AM
#19
Fanatic Member
-
Nov 7th, 2003, 04:19 PM
#20
Supreme User
Wooahh! better save this page as a complete HTML file, cant take all this in yet. Its good to see that you are bothered to take the time and effort to post so much information like this.
THANKS!
5 Starts from me
-
Jul 31st, 2006, 05:20 PM
#21
Member
Re: WM_CHAR
 Originally Posted by Merrion
WM_CHAR
This message is posted to a window when a keyboard key is pressed (other than ALT) and the window has the input focus.
wParam - This is the virtual key number which corresponds to the vbKey constants like vbKeyA if key "A" was pressed.
lParam - This holds additional information about the key press.
Bits 0-15 is the repetition count (when a key is held down)
Bits 16-23 is the scan code of the key - this is dependednt on the actual keyboard hardware
Bit 29 is set if the ALT key is down
Bit 30 is set if the key was already down i.e. the event is due to a key repetition
Bit 31 is set if the ke is being pressed, i.e. opposite to bit 30
How would I set the ALT key and other bits?
-
Jul 31st, 2006, 09:48 PM
#22
Re: VB API Tutorial - Standard windows messages
 Originally Posted by Madboy
Wooahh! better save this page as a complete HTML file, cant take all this in yet. Its good to see that you are bothered to take the time and effort to post so much information like this.
THANKS!
5 Starts from me 
I don't usually do 'me too' posts, but me too. This is definitely going into my documentation directory as a .doc file.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|