Feeds:
Posts
Comments

Archive for the ‘Visual C++’ Category

I am learning the Windows Device Driver development, and came to the BixVReader on BixVReader and VSmartCard.

  • Compiling from the source
    1. Clone the VSmartCard from github, go to .\vsmartcard\virtualsmartcard\win32 and you will find .sln file for visual studio, open in using visual studio 2015
    2. Install Windows Driver Kit 10.0, Windows SDK 10.0 and Wix Toolset
    3. Now you should be able to compile it successfully. In my case I did not change any configuration (default debug x64), it will produce the drivers file including the installer.
  • Installing the drivers manually (more…)

Read Full Post »

Well, at this moment I am doing a small project, writing a GUI for Mitsubishi MoveMasterEx-1, robot arm. It is quite old but still good enough for lab practice or for learning. I am now writing some code for the GUI. The GUI itself will talk to a microcontroller, and I am using AVR ATMega16. The controller then will send signal to the driver then to the DC motor. The DC Motor will return encoder pulse to the circuit. I will need to find the value of the degree rotation . Actually, I haven’t gone that far :D.

Mitsubishi MoveMasterEx-1

FYI, I am new in VC++, that’s why I would like to share several small functions but important. Here we go:

Converting int to CString or LPCTSTR:

CString CMOVEMASTERDlg::IntToString(int Nilai)
{

//refer to MSDN: ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_vccrt/html/eb746581-bff3-48b5-a973-bfc0a4478ecf.htm

char charBuffer[65];

CString temp;

if ( _itoa_s(Nilai, charBuffer, 65, 10) != 0) //if conversion goes wrong
{
AfxMessageBox(_T(“Error converting int to LPCTSTR or CString”), MB_ICONERROR | MB_OK);
::MessageBeep(MB_ICONEXCLAMATION);
}

temp = charBuffer;

return temp;

}

Though this function is really simple, but if you have read the UNICODE things, or wide character sometimes as a newbie you will get confused 😛

Auto Scrolling in CEdit Class:

//The Scroll to the last line
this->LineScroll (GetLineCount(), 0);

For automatic scrolling, you need to add this line on your code after you add/insert string in the CEdit control.

Readonly Text Edit (CEdit Class):

m_EditOutput.SetBackColor(RGB(255,255,255));
m_EditOutput.SetTextColor(RGB(0,0,0));

The secret for any Text Edit control with the same background and text color is that you set the background and textcolor manuall. Add these 2 lines on your code (on the OnInitDialog())

Guess, If there’s any new things I learned, I will share in this blog 🙂

Read Full Post »