CloseChannel PowerScript function
Description
Closes a DDE channel.
Syntax
|
1 |
<span>CloseChannel </span>( <span>handle</span> {, <span>windowhandle</span> } ) |
|
Argument |
Description |
|---|---|
|
handle |
A long that identifies the DDE channel |
|
windowhandle (optional) |
The handle to the PowerBuilder window |
Return Values
Integer. Returns 1 if it succeeds.If
an error occurs, CloseChannel returns a negative
integer. Possible values are:
-
-1 Open failed
-
-2 The channel refuses to close
-
-3 No confirmation from the server
-
-9 Handle is null
Usage
Use CloseChannel to close a channel to
a DDE server application that was opened by calling the OpenChannel function.
Although you can usually close the DDE channel by specifying
just the channel’s handle, it is a good idea to also specify
the handle for PowerBuilder window associated with the channel.
If you specify windowhandle, CloseChannel closes
the DDE channel in the window identified by windowhandle.
If you do not specify windowhandle, CloseChannel only
closes the channel if it is associated with the active window. You
can use the Handle function to obtain a window’s
handle.
Examples
These statements open and close the channel identified
by handle. The channel is associated with the window w_sheet:
|
1 |
long handle |
|
1 |
handle = OpenChannel("Excel", "REGION.XLS", & |
|
1 |
Handle(w_sheet) ) |
|
1 |
... // Some processing |
|
1 |
<span>CloseChannel</span>(handle, Handle(w_sheet)) |