7 #if DOS_DJGPP | defined(__FreeBSD__)
11 #define MAX_TEST_FD (500)
13 LRESULT CALLBACK wproc(HWND,UINT,WPARAM,LPARAM);
15 int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
16 PSTR szCmdLine, int iCmdShow)
18 static char szAppName[]="HolaWin";
21 int random_fd[MAX_TEST_FD][2], fd, unreg_fd;
23 wndclass.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
24 wndclass.lpfnWndProc = (WNDPROC)wproc;
25 wndclass.cbClsExtra =0;
26 wndclass.cbWndExtra =0;
27 wndclass.hInstance =0;
30 wndclass.hbrBackground =(HBRUSH)GetStockObject(LTGRAY_BRUSH);
31 wndclass.lpszMenuName =NULL;
32 wndclass.lpszClassName = szAppName;
34 RegisterClass(&wndclass);
35 hwnd=CreateWindowEx(0L,
38 WS_OVERLAPPEDWINDOW | WS_VISIBLE,
49 * Create a random list of fd's to test the list
53 printf ("Select a random list of fd's to test with.\n");
55 for (fd = 0; fd < MAX_TEST_FD; fd++)
57 random_fd[fd][0] = random () % FD_SETSIZE;
58 random_fd[fd][1] = random () % 3;
61 for (fd = 0; fd < MAX_TEST_FD; fd++)
63 switch (random_fd[fd][1])
66 MwRegisterFdInput (hwnd, random_fd[fd][0]);
70 MwRegisterFdOutput (hwnd, random_fd[fd][0]);
74 MwRegisterFdExcept (hwnd, random_fd[fd][0]);
79 printf ("Bad fd type, fd index = %i, type = %i !\n",
80 fd, random_fd[fd][1]);
85 unreg_fd = random () % MAX_TEST_FD;
87 for (fd = 0; fd < MAX_TEST_FD; fd++)
89 switch (random_fd[unreg_fd][1])
92 MwUnregisterFdInput (hwnd, random_fd[unreg_fd][0]);
96 MwUnregisterFdOutput (hwnd, random_fd[unreg_fd][0]);
100 MwUnregisterFdExcept (hwnd, random_fd[unreg_fd][0]);
105 printf ("Bad fd type !\n");
110 if (unreg_fd >= MAX_TEST_FD)
118 LRESULT CALLBACK wproc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
131 hdc=BeginPaint(hwnd,&ps);
132 GetClientRect(hwnd,&rect);
133 DrawText(hdc, "Hola, NOS", -1, &rect,
134 DT_SINGLELINE|DT_CENTER|DT_VCENTER);
141 return DefWindowProc(hwnd,iMsg,wParam,lParam);