home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / netds / rpc / mandel / mandel.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-10-05  |  4.0 KB  |  155 lines

  1. /****************************************************************************
  2.  
  3.     MANDEL.H -- Constants and function definitions for MANDEL.C
  4.  
  5.     Copyright (C) 1990 - 1997 Microsoft Corporation
  6.  
  7. ****************************************************************************/
  8.  
  9. /* Constants */
  10.  
  11. #ifdef WIN16
  12. #define APIENTRY        PASCAL
  13. #define UNREFERENCED_PARAMETER
  14. #endif
  15.  
  16. #define IDM_ABOUT        100
  17. #define IDM_ZOOMIN       101
  18. #define IDM_ZOOMOUT      105
  19. #define IDM_TOP          106
  20. #define IDM_REDRAW       107
  21. #define IDM_EXIT         108
  22. #define IDM_CONTINUOUS   109
  23. #define IDM_PROTSEQ      110
  24. #define IDD_PROTSEQNAME  111
  25. #define IDM_SERVER       112
  26. #define IDD_SERVERNAME   113
  27. #define IDM_ENDPOINT     114
  28. #define IDD_ENDPOINTNAME 115
  29. #define IDM_BIND         116
  30. #define IDM_GO           117
  31. #define IDM_1LINE        200
  32. #define IDM_2LINES       201
  33. #define IDM_4LINES       202
  34.  
  35. #define WIDTH            300
  36. #define HEIGHT           300
  37. #define LINES              4
  38. #define BUFSIZE         1200     // (HEIGHT * LINES)
  39. #define MAX_BUFSIZE     4800     // (BUFSIZE * sizeof(short))
  40.  
  41. #define POLL_TIME        2000
  42.  
  43. #define CNLEN             25     // computer name length
  44. #define UNCLEN       CNLEN+2     // \\computername
  45. #define PATHLEN           260    // Path
  46. #define MSGLEN            300    // arbitrary large number for message size
  47. #define MAXPROTSEQ         20    // protocol sequence
  48.  
  49. #define NCOLORS           11
  50.  
  51. #define SVR_TABLE_SZ      20
  52.  
  53. // Status of connection to server
  54. #define SS_DISCONN         0
  55. #define SS_IDLE            1
  56. #define SS_READPENDING     2
  57. #define SS_PAINTING        3
  58. #define SS_LOCAL           4
  59.  
  60. #define MINPREC       5.0E-9
  61. #define MAXPREC       5.0E-3
  62.  
  63. #define WM_DOSOMEWORK   (WM_USER+0)
  64. #define WM_PAINTLINE    (WM_USER+1)
  65.  
  66. #define EXCEPT_MSG      "The remote procedure raised an exception.\n\
  67. Check your connection settings."
  68.  
  69. /* Data Structures */
  70.  
  71. typedef struct _svr_table {
  72.     char    name[UNCLEN];       // name of remote server
  73.     int     hfPipe;             // RPC handle
  74.     int     iStatus;            // status of connection
  75.     int     cPicture;           // picture id for this line
  76.     DWORD   dwLine;             // line we're drawing
  77.     int     cLines;             // lines in this chunk
  78. } svr_table;
  79.  
  80. #ifndef RPC                     // If RPC, the following data would be
  81.                                 // defined in the IDL file
  82. typedef struct _cpoint {
  83.     double    real;
  84.     double    imag;
  85. } CPOINT;
  86.  
  87. typedef CPOINT * PCPOINT;
  88.  
  89. typedef struct _LONGRECT {
  90.     long    xLeft;
  91.     long    yBottom;
  92.     long    xRight;
  93.     long    yTop;
  94. } LONGRECT;
  95.  
  96. typedef LONGRECT *PLONGRECT;
  97.  
  98. typedef unsigned short LINEBUF[BUFSIZE];
  99.  
  100. #endif
  101.  
  102. typedef struct _calcbuf {
  103.     LONGRECT  rclDraw;
  104.     double    dblPrecision;
  105.     DWORD     dwThreshold;
  106.     CPOINT    cptLL;
  107. } CALCBUF;
  108.  
  109.  
  110. /* Function Prototypes */
  111.  
  112. int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int);
  113. BOOL InitApplication(HANDLE);
  114. BOOL InitInstance(HANDLE, int);
  115.  
  116. LONG APIENTRY MainWndProc(HWND, UINT, UINT, LONG);
  117. BOOL APIENTRY About(HWND, UINT, UINT, LONG);
  118. BOOL APIENTRY Protseq(HWND, UINT, UINT, LONG);
  119. BOOL APIENTRY Server(HWND, UINT, UINT, LONG);
  120. BOOL APIENTRY Endpoint(HWND, UINT, UINT, LONG);
  121.  
  122. #ifdef RPC
  123. RPC_STATUS Bind(HWND);
  124. #endif
  125.  
  126. void CountHistogram(void);
  127.  
  128. BOOL InitRemote(HWND);
  129. BOOL CheckDrawStatus(HWND);
  130. void SetNewCalc(CPOINT, double, RECT);
  131. void IncPictureID(void);
  132. void ResetPictureID(void);
  133. BOOL CheckDrawingID(int);
  134. DWORD QueryThreshold(void);
  135.  
  136. // buffer routines
  137. BOOL TakeDrawBuffer(void);
  138. LPVOID LockDrawBuffer(void);
  139. void UnlockDrawBuffer(void);
  140. void ReturnDrawBuffer(void);
  141. void FreeDrawBuffer(void);
  142.  
  143.  
  144. #ifndef RPC                     // If RPC, MandelCalc() would be
  145.                                 // defined in the IDL file
  146. void MandelCalc(PCPOINT   pcptLL,
  147.                 PLONGRECT prcDraw,
  148.                 double    precision,
  149.                 DWORD     ulThreshold,
  150.                 LINEBUF * pbBuf);
  151. #endif
  152.  
  153.  
  154.  
  155.