STKDRV.cpp
上传用户:wenjimin
上传日期:2014-08-12
资源大小:111k
文件大小:2k
源码类别:

金融证券系统

开发平台:

Visual C++

  1. // STKDRV.cpp: implementation of the CSTKDRV class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #include "stdafx.h"
  5. #include "STKDRV.h"
  6. //////////////////////////////////////////////////////////////////////
  7. // Construction/Destruction
  8. //////////////////////////////////////////////////////////////////////
  9. CSTKDRV::CSTKDRV()
  10. {
  11. m_pfnStock_Init = NULL;
  12. m_pfnStock_Quit = NULL;
  13. m_pfnGetTotalNumber = NULL;
  14. m_pfnSetupReceiver = NULL;
  15. m_pfnGetStockDrvInfo = NULL;
  16. m_hSTKDrv = NULL;
  17. GetAdress();
  18. }
  19. CSTKDRV::~CSTKDRV()
  20. {
  21. if( m_hSTKDrv )  
  22. {
  23. FreeLibrary(m_hSTKDrv);
  24. m_hSTKDrv = NULL;
  25. }
  26. }
  27. void CSTKDRV::GetAdress()
  28. {
  29. m_hSTKDrv = LoadLibrary( "STOCK.DLL" );
  30. if( !m_hSTKDrv ) 
  31. return;
  32. m_pfnStock_Init = 
  33.     (int (WINAPI *)(HWND,UINT,int)) GetProcAddress(m_hSTKDrv,"Stock_Init");
  34. m_pfnStock_Quit = 
  35. (int (WINAPI *)(HWND)) GetProcAddress(m_hSTKDrv,"Stock_Quit");
  36. m_pfnGetTotalNumber = 
  37. (int (WINAPI *)())GetProcAddress(m_hSTKDrv,"GetTotalNumber");
  38. m_pfnSetupReceiver = 
  39. (int (WINAPI *)(BOOL))GetProcAddress(m_hSTKDrv,"SetupReceiver");
  40. m_pfnGetStockDrvInfo = 
  41. (DWORD (WINAPI *)(int,void * ))GetProcAddress(m_hSTKDrv,"GetStockDrvInfo");
  42. }
  43. int CSTKDRV::Stock_Init(HWND hWnd, UINT uMsg, int nWorkMode)
  44. {
  45. if( !m_pfnStock_Init )
  46. return -1;
  47.  return( (*m_pfnStock_Init)(hWnd,uMsg,nWorkMode));
  48. }
  49. int CSTKDRV::Stock_Quit(HWND hWnd)
  50. {
  51. if( !m_pfnStock_Quit )
  52. return -1;
  53. return( (*m_pfnStock_Quit)(hWnd));
  54. }
  55. int CSTKDRV::GetTotalNumber()
  56. {
  57. if( !m_pfnGetTotalNumber )
  58. return 0;
  59. return( (*m_pfnGetTotalNumber)());
  60. }
  61. int CSTKDRV::SetupReceiver(BOOL bSetup)
  62. {
  63. if( !m_pfnSetupReceiver )
  64. return -1;
  65. return( (*m_pfnSetupReceiver)(bSetup));
  66. }
  67. DWORD CSTKDRV::GetStockDrvInfo(int nInfo, void *pBuf)
  68. {
  69. if( !m_pfnGetStockDrvInfo ) 
  70. return 0;
  71. return( (*m_pfnGetStockDrvInfo)(nInfo,pBuf));
  72. }