JLT.C
上传用户:bjghjy
上传日期:2007-01-07
资源大小:379k
文件大小:3k
源码类别:

金融证券系统

开发平台:

Visual C++

  1. #include <windows.h>
  2. #include <string.h>
  3. #include "resource.h"
  4. #include "global.h"
  5. #include "hq.h"
  6. #include "hq_cl.h"
  7. #include "jlt.h"
  8. #include "toolbar.h"
  9. #define JLT_CLASS "CJLT"
  10. extern HINSTANCE ghInstance;
  11. extern HWND ghWndMain, ghWndJlt;
  12. extern BOOL ErrMsg(HWND, LPSTR);
  13. extern int UDP_Client_GMin10();
  14. BOOL RegisterJlt(void)
  15. {
  16. WNDCLASS wc;
  17. memset(&wc, 0, sizeof(wc));
  18. wc.lpfnWndProc =JltWndProc;
  19. wc.lpszClassName =JLT_CLASS;
  20. wc.hbrBackground =GetStockObject(BLACK_BRUSH);
  21. wc.hInstance = ghInstance;
  22. wc.hCursor = LoadCursor(NULL, IDC_ARROW);        
  23. if(!RegisterClass(&wc)) return FALSE;
  24. return TRUE;
  25. }
  26. extern int CapHig;
  27. BOOL CreateWndJlt(HWND hWnd)
  28. {                          
  29. int x, y;
  30. HWND hwnd;
  31. RECT rc;
  32. GetClientRect(ghWndMain, &rc);
  33. x =rc.right -rc.left;
  34. y =rc.bottom -rc.top;
  35. if(ghWndJlt ==NULL)
  36. {
  37. hwnd =CreateWindow(JLT_CLASS, NULL, WS_CHILD|WS_CLIPSIBLINGS,
  38. 0,
  39. STATUS_HEIGHT+TOOLBAR_HEIGHT+(y-STATUS_HEIGHT*2-TOOLBAR_HEIGHT-20)*3/5 ,
  40. x*2/3+30,
  41. (y-STATUS_HEIGHT*2-TOOLBAR_HEIGHT -20)*2/5,
  42. hWnd, NULL, ghInstance, NULL);
  43. if(hwnd ==NULL)
  44. {
  45. ErrMsg(hWnd, "不能建立交易量显示窗口");
  46. return FALSE;
  47. }
  48. ghWndJlt =hwnd;
  49. }
  50. else
  51. {
  52. SetWindowPos(ghWndJlt, (HWND) NULL, 
  53. 0, 
  54. STATUS_HEIGHT+TOOLBAR_HEIGHT+(y-STATUS_HEIGHT*2-TOOLBAR_HEIGHT -20)*3/5 ,
  55. x*2/3+30, 
  56. (y-STATUS_HEIGHT*2-TOOLBAR_HEIGHT -20)*2/5,
  57. NULL);
  58. }
  59. return TRUE;
  60. }
  61. extern int DrawTimeLines(HWND hWnd,HDC, LPRECT, BOOL);
  62. extern int DrawJlt(HDC, LPRECT);
  63. int UDP_Send_GMin00(int, int);
  64. LRESULT CALLBACK JltWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
  65. {
  66. char tmp[256];
  67. PAINTSTRUCT ps;
  68. DWORD dw;
  69. int x, y;
  70. RECT rc;
  71. switch(message)
  72. {
  73. case WM_SETFOCUS:
  74. SetFocus(ghWndMain);
  75. break;
  76. case WM_CREATE:
  77. break;
  78. case WM_SIZE:
  79. if(IsWindowVisible(hWnd))
  80. InvalidateRect(hWnd, NULL, TRUE);
  81. break;
  82. case WM_PAINT:
  83. BeginPaint(hWnd, &ps);
  84. GetClientRect(hWnd, &rc);
  85. strcpy(tmp, HqData[HqPaintData.jys].lpPreData[
  86. HqPaintData.sortData.key[
  87. HqPaintData.curRecNum+HqPaintData.curSelRec]].zqmc);
  88. dw =GetTextExtent(ps.hdc, tmp, strlen(tmp));
  89. x =LOWORD(dw); y =HIWORD(dw);
  90. SetBkColor(ps.hdc, RGB(0, 0, 0));
  91. SelectObject(ps.hdc, GetStockObject(WHITE_PEN));
  92. SetTextColor(ps.hdc, RGB(255, 255, 255));
  93. rc.left =50; rc.right -=30;
  94. rc.top =y+5; rc.bottom -=30;
  95. DrawTimeLines(hWnd,ps.hdc, &rc, TRUE);
  96. rc.bottom --;
  97. DrawJlt(ps.hdc, &rc);
  98. EndPaint(hWnd, &ps);
  99. break;
  100. case WM_DESTROY:
  101. break;
  102. }
  103. return DefWindowProc(hWnd, message, wParam, lParam);
  104. }