Re: VC++ endless task

From: Martijn Lievaart (m_at_remove.this.part.rtij.nl)
Date: 01/12/04


Date: Mon, 12 Jan 2004 09:13:25 +0100

On Sun, 11 Jan 2004 19:44:28 +0000, Coyoteboy wrote:

> Hi all,
>
> I'm a newbie to C++ and VC++ but I have a monster task ahead. I've to

Note that this forum talks about the languages C and C++ only, VC++ itself
is off topic here.

> develop a windows multithreaded program to constantly communicate through a
> serial interface to a robot controller, displaying the current data (after
> some manipulation) and then taking user inputs and performing calculations
> for accelerations etc befere outputting them back to the controller.

Windows can be programmed event driven. This may aleviate the need to do
this task multithreading.

An event driven program must store lots of state, so it is difficult to
write correctly. But you don't have multithreading to worry about.

A multithreaded program is much simpler in structure, but is very hard to
get right and often impossible to debug. You have to worry about
synchronisation, race conditions and deadlocks. And if you get it worng,
bugs are more often than not irrepreducable, making them impossible to
find and they only surface when the program goes into production.

> Now this, to my untrained eye, seems like an enormouse task, mainly because
> I'm entirely new to programming and more of a mechanical engineer. I've
> spent the last couple of months learning and getting to grips with the
> basics of normal C++, but I'm much better at learning from examples than
> books, or even books with examples! Programming is not my strong point! I've
> managed to make a rough bit of code for decoding the data, which works when
> put into a simple console program.

Good start. Divide and conquer. You may want to put this logic in a
library that can be used from a console program for testing and in the
real program for real use.

> Anyways, Ive fiddled with VC++ and the projects in that, I've read a few
> online tutorials as I'm going to have to use a graphical interface I guess.
> My problems are these:
>
> 1) There seem to be so many 'forms' of C++ im lost as to which to use - MFC,
> win32 etc

There is only one form of C++, it is defined by the standard. Then there
are dialects, which unfortunately are not always compatible with standard
C++. The latest incarnation of VC++ is pretty standards complient though.

But there are many ways to use C++. To write a Windows GUI program, one
can use the native Win32 API, or use a wrapper library like MFC or
vxWindows. You could even think about writing the GUI in VB, making that
call a C++ library.

> 2) Once I think I follow the structure of an example program, I look at
> another and it seems utterly unrelated. I get one part (controls etc)
> sorted, then try to look at the next bit (threads or the serial coms, or the
> import the decoding stuff) and I get confused by the structure - what goes
> where and why.

As noted above, divide and conquer. A good design helps greatly, break it
up into pieces and at first only think about how those pieces communicate.

> I have a copy of Practical Visual C++, which helps with some bits but is
> almost entirely irrelevant it seems and it could take weeks to weed out the
> bits that i need. The standard libraries are HUGE! Most of my time is spent
> trying to figure out parameters etc even with the SDK. HWnd,CWnd etc etc -
> god I'm getting confused!

The SDK is /not/ the standard library. The SDK is a couple of libraries
with their documentation that enable you to call the Windows API.

> Anyways, are there any sites or books about that can help me figure out
> these structures and why things are as they are, not just 'take it as we
> say'?
>
> Would you recommend I use Win32, MFC or some other form? Can someone with
> experience tell me roughly what I should be reading up on?

Ask in a Windows oriented group. Your question is off topic for this group.

HTH,
M4



Relevant Pages

  • Re: difference between a .dll and .ocx????
    ... Windows), then it must be a COM library since, that's the architecture ... it's a function that is called when the DLL ... class definitions or just function libraries is actually besides the ... about the .dll or .exe adhering to the COM standard. ...
    (microsoft.public.dotnet.framework)
  • Re: non-standard functions in libc -- bad design?
    ... a critical component of Windows, and there's a separate Windows ... because I'm not aware of any C library on Windows that don't include extensions to the C standard. ... may generate circular dependencies in two libraries which is Bad Design. ...
    (comp.unix.programmer)
  • Re: c# or Java???
    ... The standard was updated in 2003 with Technical Corrigendum 1, ... > No deal with Java and the tool will work on Linux, Windows or Solaris. ... If I understand you correctly you lament a lack of cross-platform libraries ...
    (comp.programming)
  • Re: Notebook cannot read any CD at XP normal mode
    ... Does the controller identify itself simply as "Standard" or is there ... > BIOS can read bootable CD, ... > safe mode XP Windows can read /write CD. ...
    (microsoft.public.windowsxp.general)
  • Re: So is Turbo free, or not?
    ... it from becoming pretty popular. ... The lack of standard conformance is an issue for anyone that codes in C++ using libraries portable libraries of recent times, esepcially the open source portable types. ... Visual C++ users also got down and dirty with the latest APIs in new Windows versions before users of other compiler vendors. ...
    (borland.public.delphi.non-technical)

Loading