beautypg.com

Onevent – Measurement Computing Personal488 rev.3.0 User Manual

Page 102

background image

Personal488 for Windows 95/98/Me/NT/2000

04-10-01

API Reference 6-34

OnEvent

Windows9x and Windows2000 Only !

Syntax

INT WINAPI OnEvent(DevHandleT devHandle, HWND hWnd, OpaqueP

lParam);

devHandle

refers to either an interface or an external device.

hWnd

is the window handle to receive the event notification.

lParam

value will be passed in the notification message.

Returns

-1

if error

Bus States

None

Example

ieee = OpenName (“ieee”);
OnEvent (ieee, hWnd, (OpaqueP) 12345678L);
Arm (ieee, acSRQ | acError);
break;

See Also

OnEventVDM, Arm, Disarm

The

OnEvent

command causes the event handling mechanism to issue a message upon occurrence of an

Arm

ed event.

The message will have a type of

WM_IEEE488EVENT

, whose value is retrieved via:

RegisterWindowMessage ((LPSTR) “WM_IEEE488EVENT”);

The associated

wParam

is an event mask indicating which

Arm

ed event(s) caused the notification, and the

lParam

is the value passed to

OnEvent

. Note that although there is a macro for

WM_IEEE488EVENT

in the

header file for each language, this macro resolves to a function call and therefore cannot be used as a case
label. The preferred implementation is to include a default case in the message handling case statement and
directly compare the message ID with

WM_IEEE488EVENT

.

The following is an example of an event handler.

LONG FAR WINAPI export

WndProc(HWND hWnd, unsigned iMessage, WORD wParam, LONG lParam);
{
HANDLE
ieee;
switch (iMessage)

{
case WM_CREATE:

ieee = OpenName (“ieee”);
OnEvent (ieee, hWnd, (OpaqueP) 12345678L);
Arm (ieee, acSRQ | acError);
break;

default:

if (iMessage == WM_IEEE488EVENT) {

char buff [80];
wsprintf (buff, “Condition = %04X, Param = %081X”,wParam, lParam);
MessageBox (hWnd, (LPSTR) buff, (LPSTR) “Event Noted”, MB OK);
return TRUE;

}

}

}

This manual is related to the following products: