Help in MFC Application-SDI
-
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
-
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
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.