| By Ludwin Feiten | Article Rating: |
|
| March 28, 2006 12:00 PM EST | Reads: |
25,362 |
WM_VSCROLL Notification
The WM_VSCROLL message is
sent to a window when a scroll event occurs in the window's standard
vertical scroll bar. This message is also sent to the owner of a
vertical scroll bar control when a scroll event occurs in the control.
SYNTAX
WM_VSCROLL
WPARAM wParam
LPARAM lParam;
PARAMETERS
wParam
The high-order word specifies the
current position of the scroll box if the low-order word is
SB_THUMBPOSITION or SB_THUMBTRACK; otherwise, this word is not used.
The low-order word specifies a scroll bar value that indicates the user's scrolling request. This parameter can be one of the following values:
- SB_BOTTOM: Scrolls to the lower right.
- SB_ENDSCROLL: Ends scroll.
- SB_LINEDOWN: Scrolls one line down.
- SB_LINEUP: Scrolls one line up.
- SB_PAGEDOWN: Scrolls one page down.
- SB_PAGEUP: Scrolls one page up.
- SB_THUMBPOSITION: The user has dragged the scroll box (thumb) and released the mouse button. The high-order word indicates the position of the scroll box at the end of the drag operation.
- SB_THUMBTRACK: The user is dragging the scroll box. This message is sent repeatedly until the user releases the mouse button. The high-order word indicates the position that the scroll box has been dragged to.
- SB_TOP: Scrolls to the upper left.
If the message is sent by a scroll bar, this parameter is the handle to the scroll bar control. If the message is not sent by a scroll bar, this parameter is NULL.
In winuser.h, we find that WM_VSCROLL is 0x0115 which is dec 277. SB_PAGEDOWN is 3.
wParam is 3 for SB_PAGEDOWN.
lParam is set to Zero.
So send(Handle(this), 277,3, long(0,0)) scrolls one page down.
Table 2 provides a list of some common events.
STRATEGIES FOR THE HELP
If you want to
learn more about Window Controls or to look for something special, go
to the MSDN at: MSDN Home > MSDN Library > Win32 and COM
Development > User Interface > Windows Shell > Windows
Controls and look for "Messages" and "Notifications" in the subtopics
"General Control Information" and "Individual Control Information."
Another approach is to look in the winusers.h for something that seems
to suit your needs.
Send Messages to PowerBuilder Custom Events
You
can also send messages to PowerBuilder custom events. You may need that
to communicate between two PowerBuilder applications.
The pbm_custom01 event ID maps to wm_user+0, pbm_custom02 maps to wm_user+1, and so on, through pbm_custom75, which maps to wm_user+74. WM_USER is defined in winusers.h:
#define WM_USER 0x0400 = 124
Application Ping-Pong
Figure 2 and Figure 3 provides an example of a ping - pong between several instances of an application.
In the open event I searched for instances that have already started; this is shown in a listbox. In addition in an instance variable il_number I store the instance that I am. (die wievielte?)
For the interapplication communication, I have two events (ue_ping and ue_pong) that map to custom controls. Ue_ping receives a message from another instance where the sender's window handle and its Instance-Number are transmitted in the wparam and lparam. The event displays a messagebox and answers with a pong.
event ue_ping pbm_custom01
Messagebox("Here is window: "+string(handle(this)),
" Got a Ping from: " + string (wparam) + " with Instance No. "+string(lparam) )
// Pong to sender of the Ping (Event Id:1025)
send (wparam, 1025, handle(this), il_number ) ;
end event
ue_pong receives the message send from ue_ping where the sender's window handle and its Instance-Number are transmitted in the wparam and lparam displays a messagebox.
event ue_pong pbm_custom02;
Messagebox("Here is window: "+string(handle(this)),
" Got the Pong from: " + string (wparam) + " with Instance No. "+string(lparam) )
end event
To send a ping I type one of the window handles of a running instance in an edit-field (em_win_handle) and press a button where the script for the clicked event sends a "ping" to that window:
In the button Control clicked event
unsignedlong hndl_me,&
hndl_you
hndl_me = handle(parent)
hndl_you = long(em_win_handle.text)
IF hndl_you > 0 THEN
// Send a ping to pbm_custom01 and transmit my handle and instance number in the params
send (hndl_du, 1024, hndl_ich, il_nummer ) ;
ELSE
MessageBox("Oups", em_window.text + " is not running!")
END IF
More Examples
STARTING SYSCOMMANDS WITH SEND()
Another
unusual use of the send() function is to start System Commands. If you
search for SYSCOMMAND Notification, you'll find several parameters that
trigger various actions, one of which is SC_SCREENSAVE to start the
screensaver.
START SCREENSAVER
To start the screensaver, write:
/*
** WM_SYSCOMMAND 0x0112 274
** SC_SCREENSAVE 0xF140 61760
*/
send(handle(This),274,61760,0)
MAXIMIZE A FRAME
To maximize a window when it opens put the following code into the Open event:
CONSTANT Integer WM_SYSCOMMAND = 274
CONSTANT UInt SC_MAXIMIZE = 61488
//
Send(Handle(This), WM_SYSCOMMAND, SC_MAXIMIZE, 0)
MOVE A WINDOW WITHOUT A TITLEBAR
To move a window without a titlebar, place the following code in the mousedown event:
CONSTANT uint WM_NCLBUTTONDOWN = 161
CONSTANT uint HTCAPTION = 2
Post( Handle( this ), WM_NCLBUTTONDOWN, HTCAPTION, Long( xpos, ypos ) )
MAKE THE ENTER KEY ACT AS A TAB KEY
First, define a user event to correspond with the pbm_dwnprocessenter event on a DataWindow. In that event, code:
Send(Handle(this),256,9,Long(0,0))
OPEN A DDDW VIA POWERSCRIPT
[external function declaration]
SUBROUTINE keybd_event( int bVk, int bScan, int dwFlags, int dwExtraInfo) &
LIBRARY "user32.dll"
[powerscript]
constant integer VK_F4 = 115
dw_1.SetFocus()
dw_1.SetColumn( "dept_head_id" ) // the DDDW
keybd_event( VK_F4,0,0,0 ) // F4 key down
keybd_event( VK_F4,0,2,0 ) // F4 key up
Published March 28, 2006 Reads 25,362
Copyright © 2006 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Ludwin Feiten
Ludwin Feiten is a senior consultant with Power People and has many years of experience in software development. He started working with PowerBuilder with version 3.1a. Ludwin runs the German PowerBuilder User Group and is a frequent speaker at PBUG meetings.
![]() |
Kiran 09/11/06 12:20:42 PM EDT | |||
Am new to Powerbuilder, this article describes how to send windows message but i would like to know how to interpret the message sent by another application, ie, how to receive and process the message using powerbuilder. Could any one help me in this regard. Regards, |
||||
- User Group Malaise?
- What's New in HTML5
- SAP Buys US Mobile Platform House Syclo
- Best Way to Grow Enterprise Mobility In-House
- What's New in HTML5 - Week of April 1, 2012
- How to Test Drive Enterprise Mobility
- Mobile Marketing News Weekly – Week of March 26, 2012
- Enterprise Mobility Asia News Weekly – Week of March 25, 2012
- The PowerBuilder DataWindow as an Image Thumbnail Display Control
- Mobile Commerce News Weekly – Week of March 19, 2012
- Tablets Have Come of Age
- Mobile Health News Weekly – Week of April 8, 2012
- User Group Malaise?
- What's New in HTML5
- SAP Buys US Mobile Platform House Syclo
- Going Mobile in 2012
- Appeon Mobile: First-Ever Mobility Solution for the PowerBuilder Community
- Take PB to the Web, Mobile & More!
- M2M News Weekly – Week of February 27, 2012
- Best Way to Grow Enterprise Mobility In-House
- What's New in HTML5 - Week of April 1, 2012
- How to Test Drive Enterprise Mobility
- Mobile Marketing News Weekly – Week of March 26, 2012
- Mobility News Weekly – Week of February 20, 2012
- Where Are RIA Technologies Headed in 2008?
- PowerBuilder History - How Did It Evolve?
- The Top 250 Players in the Cloud Computing Ecosystem
- DDDW Tips and Tricks
- Dynamically Creating DataWindow Objects
- OLE - Extending the Capabilities of PowerBuilder
- Working with SOA & Web Services in PowerBuilder
- DataWindow.NET How To: Data Entry Form
- Custom Common Dialogs Using SetWindowsHookEx
- Sybase ASE 12.5 Performance and Tuning
- Office 2003 Toolbar: A New Look For Your Old PowerBuilder App
- Book Excerpt: Sybase Adaptive Server Anywhere






















