/************************************************************************* Windows Sockets Application Support Module Written by John A. Junod, 267 Hillwood St., Martinez, GA, 30907 93.10.01 Released into the public domain with no restrictions other than to give me some of the credit if you use this code in other applications. *************************************************************************/ /* MODULE: WS_PAINT.C (main window (debug) display routines) */ #include "ws_glob.h" #include "ws_ping.h" #include int nLineHeight=5; int nScreenRows=10; // extern HWND hWndDbg; void ReleaseDisplayMem() { int nIndex; for(nIndex=0;nIndex0 && (hGlobalMemory=GlobalAlloc(GMEM_MOVEABLE,nIndex))!=NULL) { if((lpGlobalMemory=GlobalLock(hGlobalMemory))!=NULL) { lstrcpy(lpGlobalMemory,szString); GlobalUnlock(hGlobalMemory); if(ptrhGMem<90) { hGMem[ptrhGMem++]=hGlobalMemory; } else { if(GlobalFree(hGMem[0])==NULL) { for(nIndex=0;nIndex<90;nIndex++) hGMem[nIndex]=hGMem[nIndex+1]; hGMem[ptrhGMem-1]=hGlobalMemory; } } } } } GetClientRect(hWndMain,&rect); rect.top=min(0,(ptrhGMem-sVPos-1))*nLineHeight; if(ptrhGMem > (sVPos+nScreenRows)) PostMessage(hWndMain,WM_VSCROLL,SB_LINEDOWN,0L); else InvalidateRect(hWndMain,&rect,TRUE); UpdateWindow(hWndMain); } void DoPrintf(char *szFormat,...) { va_list vaArgs; static char szBuf[256]; va_start(vaArgs,szFormat); if(vsprintf(szBuf,szFormat,vaArgs)!=EOF) DoAddLine(szBuf); va_end(vaArgs); } void DoPaint(HWND hWnd) { HDC hDC; // handle for the display device PAINTSTRUCT ps; // holds PAINT information int nRc; int nIndex; LPSTR lpMem; RECT rRect; TEXTMETRIC tm; memset(&ps, 0x00, sizeof(PAINTSTRUCT)); hDC = BeginPaint(hWnd, &ps); // Included as the background is not a pure color SetBkMode(hDC, TRANSPARENT); GetTextMetrics(hDC,&tm); nLineHeight=tm.tmHeight+tm.tmExternalLeading; GetClientRect(hWnd,&rRect); nScreenRows=rRect.bottom/nLineHeight; if(nScreenRows >= ptrhGMem) ShowScrollBar(hWnd,SB_VERT,FALSE); else ShowScrollBar(hWnd,SB_VERT,TRUE); for(nIndex=0;(nIndex+sVPos)h_name); */ while ( (iptr = (struct in_addr *) *(hostptr->h_addr_list)) != NULL) { DoPrintf("Local Address: %s",inet_ntoa(*iptr)); hostptr->h_addr_list++; } } } return(TRUE); }