When you need to listen a file descriptor, you can use select(2) system call. In MiniGUI, you can also register it to MiniGUI to be a listened fd, and when there is a read/write/except event on the registered fd , MiniGUI will sent a notification message to the registered window.
Example:
...
/* Register to listen the read event of the master pty. */
RegisterListenFD (pConInfo->masterPty, POLLIN, hMainWnd, 0);
/* Enter the message loop. */
while (!pConInfo->terminate && GetMessage (&Msg, hMainWnd)) {
DispatchMessage (&Msg);
}
/* Unregister the listening fd. */
UnregisterListenFD (pConInfo->masterPty);
...
/* The window procedure. */
static int VCOnGUIMainWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
{
PCONINFO pConInfo;
pConInfo = (PCONINFO)GetWindowAdditionalData (hWnd);
switch (message) {
...
/* MSG_FDEVENT sent by MiniGUI indicates that you should to read the data. */
case MSG_FDEVENT:
ReadMasterPty (pConInfo);
break;
...
}
/* Calling default window procedure. */
if (pConInfo->DefWinProc)
return (*pConInfo->DefWinProc)(hWnd, message, wParam, lParam);
else
return DefaultMainWinProc (hWnd, message, wParam, lParam);
}
|
|
The max number of listen fd which user can use.
|
|
||||||||||||||||||||
|
Registers a listening file descriptor to MiniGUI-Lite. This function registers the file desciptor fd to MiniGUI-Lite for listening. When there is a read/write/except event on this fd, MiniGUI will post a MSG_FDEVENT message with wParam being equal to MAKELONG (fd, type), and the lParam being set to context to the target window hwnd.
|
|
|
Unregisters a being listened file descriptor. This function unregisters the being listened file descriptor fd.
|
1.4.2