Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Help in MFC Application-SDI

Help in MFC Application-SDI

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++hardwarehelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Eyungwah
    wrote on last edited by
    #1

    Hello All: I have some hardware with given .DLL & .H files. I have created an MFC Application with Single Document Interface that have the following drop-down as follow. File -Regester. -Write Register. My goal in to have the CView display what is On the Register when select -Register or -Write Register. Could someone please help direct me to the right path?? Here is the Header contains: #include <string> #ifdef BUILD_SCANPORT_DLL #define DLLEXPORT2 __declspec(dllexport) #else #define DLLEXPORT2 __declspec(dllimport) #endif #define SETBIT 1 #define CLRBIT 0 #define CSR0 0x00 //scanner register locations #define CSR1 0x01 DLLEXPORT2 int readreg(int reg); //some prototypes DLLEXPORT2 void writereg(int reg, int value); DLLEXPORT2 void writebit(int reg, int value, bool clear); DLLEXPORT2 int checkwarmup(); DLLEXPORT2 float checkbattery(); typedef enum ScanStatus { SCAN_OK, SCAN_FAIL_FILE_ERROR, SCAN_FAIL_USB_OPEN_ERROR, SCAN_FAIL_USB_XFER_ERROR }; DLLEXPORT2 ScanStatus scanport(bool doClean, bool doSharpen, const char* outFile); Thanks in advance for your help Eyungwah

    I 1 Reply Last reply
    0
    • E Eyungwah

      Hello All: I have some hardware with given .DLL & .H files. I have created an MFC Application with Single Document Interface that have the following drop-down as follow. File -Regester. -Write Register. My goal in to have the CView display what is On the Register when select -Register or -Write Register. Could someone please help direct me to the right path?? Here is the Header contains: #include <string> #ifdef BUILD_SCANPORT_DLL #define DLLEXPORT2 __declspec(dllexport) #else #define DLLEXPORT2 __declspec(dllimport) #endif #define SETBIT 1 #define CLRBIT 0 #define CSR0 0x00 //scanner register locations #define CSR1 0x01 DLLEXPORT2 int readreg(int reg); //some prototypes DLLEXPORT2 void writereg(int reg, int value); DLLEXPORT2 void writebit(int reg, int value, bool clear); DLLEXPORT2 int checkwarmup(); DLLEXPORT2 float checkbattery(); typedef enum ScanStatus { SCAN_OK, SCAN_FAIL_FILE_ERROR, SCAN_FAIL_USB_OPEN_ERROR, SCAN_FAIL_USB_XFER_ERROR }; DLLEXPORT2 ScanStatus scanport(bool doClean, bool doSharpen, const char* outFile); Thanks in advance for your help Eyungwah

      I Offline
      I Offline
      Iain Clarke Warrior Programmer
      wrote on last edited by
      #2

      Your question can be broken into a few parts. Using class wizard, add menu handlers to your CMyDocument casll for (eg) IDM_REGISTER and IDM_WRITEREGISTER. In those handlers, do whatever the hardware thing you want to do is, and store the value that you'll want to display in eg CString m_MyValueToReport. To then get your CMyView to update and display the new string, just call UpdateAllViews in your menu handler. Then, in CMyView::OnDraw, just display the new string

      void CMyView::OnDraw (CDC *pDC)
      {
      CMyDoc *pDoc = GetDocument ();
      ASSERT(pDoc);

      ....
      
      pDC->TextOut (x,y, pDoc->m\_MyValueToReport);
      
      ....
      

      }

      Going back to the hardware stage, the header file doesn't look like there's any call saying "tell me what was recently written", so you're going to have to keep track of the value you write to the register. Beyond that, the help file / documentation that comes with the USB device/SDK should be of more help than us. Good luck, Iain.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups