Setup Example

image\head10.gif VB.NET

Dim hWnd As Integer

Dim wMsg As Short

Dim Ret, SrqOn As Integer

 

hWnd = Handle.ToInt32  ' Handle is procedure handle

wMsg = 0x430  ' user-specified number 400H to 7FFFH

SrqOn = 1   ' Create event

Ret = GpSrqEvent(hWnd, wMsg, SrqOn)

 

' Event handler routine

Select Case message  ' message is procedure's 2nd parameter

Case 0x430:  ' = wMsg

    ... ' Write necessary process

    ...

End Select

 

image\head10.gif C

HANDLE hWnd;

WORD wMsg;

DWORD Ret, SrqOn;

 

hWnd = hDlg; /* hDlg is procedure handle */

wMsg = 0x430; /* user-specified number 400H to 7FFFH */

SrqOn = 1;  /* Create event */

Ret = GpSrqEvent(hWnd, wMsg, SrqOn);

 

/* Event handler routine */

switch(message){ /* message is procedure's 2nd parameter */

case 0x430: /* = wMsg */

 ... /* Write necessary process */

 ...

 break;

}

 

image\head10.gif C#

int hWnd;

short wMsg;

uint Ret, SrqOn;

 

hWnd = this.Handle.ToInt32();  /* hDlg is procedure handle */

wMsg = 0x430; /* user-specified number 400H to 7FFFH */

SrqOn = 1;  /* Create event */

Ret = gpib.SrqEvent(hWnd, wMsg, SrqOn);

 

/* Event handler routine */

switch(message){ /* message is procedure's 2nd parameter */

case 0x430: /* = wMsg */

    ... /* Write necessary process */

    ...

    break;

}

 

image\head10.gif Python

wMsg = ctypes.c_ushort()

Ret, SrqOn = ctypes.c_ulong(), ctypes.c_ulong()

 

wMsg.value = WM_USER + 0x30 # user-specified number 400H to 7FFFH

        # WM_USER = 0x400

hWnd = ctypes.windll.user32.FindWindowW(0, "Name")       # "Name" is the caption of the currently running procedure

 

SrqOn.value = 1  # Create event

Ret.value = GpibPy.GpSrqEvent(hWnd, wMsg, SrqOn)

 

# Event handler routine

# message is procedure's 2nd parameter

if message == WM_USER + 0x30: # WM_USER + 0x30 is the value set by GpSrqEvent

    ... # Write necessary process

    ...