Click here to Skip to main content
16,011,374 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
This will be a long process, so thanks to everyone from the beginning.

Years ago (2007) I developed an app to the beta stage, I used Lcc-Win32 as a development environment. I chose Lcc because it was a free Win32 development environment, and I wanted to know what MS Developer did in the background.

The project progress to the point that I was ready to beta test.

Well here I am seven years later, and I want to revive the project, this time using Studio 2010.

I have a lot of code using handles for arguments to functions;
C++
BOOL SetItemTxt(HWND hwnd, int ID, LPTSTR Text);
BOOL GetPortConfig(HANDLE hCOM, TCHAR *tcBaud, TCHAR *tcParity, TCHAR *tcStopBits, TCHAR *tcByteSize);
BOOL SetPortConfig(HANDLE hCOM, TCHAR *tcBaud, TCHAR *tcParity, TCHAR *tcStopBits, TCHAR *tcByteSize);
BOOL GetPortTimeOuts(HANDLE hCOM, COMMTIMEOUTS *lpcCOMPortTimeOuts);
BOOL SetCOMTimeouts(HANDLE hCOM,  COMMTIMEOUTS &commTimeouts);

DWORD WriteToCOMPort(HANDLE hCOM, char *pszWriteBuffer);
DWORD ReadFromCOMPort(HANDLE hCOM, TCHAR *tcRecdData, int nBytesToRead);

HANDLE OpenCOM(TCHAR *tcCOMPort);

LPTSTR GetItemTxt(HWND hwnd, int ID);

LRESULT GetCOMPorts(HWND hwnd);


I also have a Dialog box created with Studio 2010, and one of the many, many, many errors I receive are;

C++
c:\....\visual studio 2010\projects\mydialog solution\mydialog project\mydialog project.cpp(85): error C2065: 'hwndDlg' : undeclared identifier


I don't understand how to use my existing code (there's a lot of handles), or as much as possible, with Studio.

I look at this link, but it seemed to reveal nothing.

http://msdn.microsoft.com/en-us/library/vstudio/c251x6s1%28v=vs.100%29.aspx[^]

Please help...
Thanks in advance.

PS I have a job and family, so please be patient I may not reply right away.
Posted

"if you have a handle. handle it proper" ;-)

You really need to understand handles. At the bottom they are identifiers (system unique) of some resources. They can be windows, bitmaps or ports. So it is better to be more specific. Is use HWND (for window handles), HBITMAP (for bitmap handles) and so the compiler helps you avoiding annoying bugs.

You error C2065: 'hwndDlg' : undeclared identifier is the compiler yelling that it dont know the 'hwndDlg'

It looks a bit rusty but this article may show some use cases of MFC and serial comm.
 
Share this answer
 
If you really want to port Win32 to MFC then you probably might want to move from structured programming to OOP (otherwise using Win32 is just fine, in my opinion). Hence I suggest you to keep the project idea and discard the rest: build a good OOP application from scratch.
 
Share this answer
 
Given the issues you refer to above, I would suggest you stay well away from MFC. While it sounds great that the wizards in Visual Studio will generate much of the template code automatically, it can be excessively complex. And unless you are a skilled C++ developer you will struggle with many of the concepts. Stick with Win32, it is clean and simple to use.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900