robot1.h

来自「VC++串口通信设。本书详细说明讲解了在VC++环境下编写串口通信得过程。值得一」· C头文件 代码 · 共 51 行

H
51
字号
#ifndef ROBOT1_H
#define ROBOT1_H

// Get needed include files
#include "IRobot.h"
#include "IDrawbl.h"


class ComRobot : public CCmdTarget
{
public:

   // Constructor and destructor
	ComRobot();
	virtual ~ComRobot();

protected:

   // IRobot members
   BEGIN_INTERFACE_PART(RobotInner, IRobot)
      STDMETHOD(Initialize)         (ULONG ulXPos, ULONG ulYPos);
      STDMETHOD(TurnTo)             (USHORT usDegrees);
      STDMETHOD(GetCurrentHeading)  (PUSHORT pusDegrees);
      STDMETHOD(GetCurrentPosition) (PULONG pulXPos, PULONG pulYPos);
      STDMETHOD(MoveForward)        (ULONG ulNumUnits);
      STDMETHOD(MoveBackward)       (ULONG ulNumUnits);
   END_INTERFACE_PART(RobotInner)

   // ISimpleDrawable
   BEGIN_INTERFACE_PART(DrawInner, ISimpleDrawable)
      STDMETHOD(Draw)(HDC hDC);
   END_INTERFACE_PART(DrawInner)
      
   DECLARE_INTERFACE_MAP()
   DECLARE_OLECREATE(ComRobot)
   DECLARE_DYNCREATE(ComRobot)

private:

   // Member data
   USHORT m_usCurrHeading;
   ULONG  m_ulCurrXPos, m_ulCurrYPos;

   // Private methods
   VOID DrawHeading(CDC& DC);
};

typedef ComRobot* PComRobot;

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?