Windows programming, Multi-threading, Database connections in C++

Ryan Shrott

Active Member
C++ Student
My new job requires that I have a deep understanding of the following concepts:

1. Windows programming
2. Database connections
3. Multi threading

Can someone provide introductory references to help me learn these concepts?
 

Ryan Shrott

Active Member
C++ Student
@Daniel Duffy I will be using C++ for these projects.

Some main tasks will involve:

- MFC's threading library
- job scheduling application
- Optimization routines
 

Ryan Shrott

Active Member
C++ Student
@alain I would prefer to use C++11 threads, but I must use
MFC's Threading library since we only use Visual Studio 2008 with no C++11 support. I will provide more information about the optimization when I learn more about this.

For now, I was wondering if anyone could provide resources to learn about databases, MFC's threading library and windows programming. I know these are broad topics. I will provide more info when I find out more. Anything to help me start would be great.
 

Daniel Duffy

C++ author, trainer
Unfortunately, you are very much constrained by legacy VS2008 and super-legacy MFC. It's between a rock and a hard place. IMO you need to be at least on VS2010 and ideally VS2015.

MSDN has lots of stuff on MFC.

C++ is a pain with databases; C# is much easier.

For threading you could use Boost Thread which works with VS2008. For databases, ADO.NET is the MS standard.

Do you maintain a legacy C++/MFC application? To be honest, MFC is really really outdated.

Here is something I wrote on Boost Thread
https://www.quantnet.com/threads/c-multithreading-in-boost.10028/
 
Last edited:

pingu

Well-Known Member
Try to use openmp as much as you can. Boost.Threads is also good alternative but try to avoid MFC at all costs.

Install some well known free libraries. Boost and POCO should be at the top of your list.

PS - You are in for a lot of pain.
 

Daniel Duffy

C++ author, trainer
Try to use openmp as much as you can. Boost.Threads is also good alternative but try to avoid MFC at all costs.

Install some well known free libraries. Boost and POCO should be at the top of your list.

PS - You are in for a lot of pain.
I agree. OpenMP is a great way to learn.

A disgruntled user once said "Microsoft Frustration Classes".

=====
SOCI library for DB
SOCI - The C++ Database Access Library
 
Last edited:

Ryan Shrott

Active Member
C++ Student
Unfortunately, you are very much constrained by legacy VS2008 and super-legacy MFC. It's between a rock and a hard place. IMO you need to be at least on VS2010 and ideally VS2015.

MSDN has lots of stuff on MFC.

C++ is a pain with databases; C# is much easier.

For threading you could use Boost Thread which works with VS2008. For databases, ADO.NET is the MS standard.

Do you maintain a legacy C++/MFC application? To be honest, MFC is really really outdated.

Here is something I wrote on Boost Thread
https://www.quantnet.com/threads/c-multithreading-in-boost.10028/
Thanks for the references. I am maintaining legacy C++/MFC application. For that reason, I am constrained by the MFC threading interface.
 

Ryan Shrott

Active Member
C++ Student
Try to use openmp as much as you can. Boost.Threads is also good alternative but try to avoid MFC at all costs.

Install some well known free libraries. Boost and POCO should be at the top of your list.

PS - You are in for a lot of pain.
I've quickly realized this. I am constantly dealing with an onslaught of compiler errors.
 

Daniel Duffy

C++ author, trainer
Ryan,
Believe it or not, I am porting MFC from ages ago and I get error


MSG* pMsg = &AfxGetThread()->m_msgCur;

"m_msgCur is not a member of CWinThread"

Any ideas??
 

Ryan Shrott

Active Member
C++ Student
@Daniel Duffy I'm currently reading your article on threading -- thanks for this. I'm still trying to understand the basic concepts -- I'm finding it a difficult concept. I'll update you if I figure that out. Thanks.
 

Ryan Shrott

Active Member
C++ Student
Why not use C++11 Threading?
I can't use C++11 Threading because I only have access to VS 2008.

I have been debugging an MFC application for over a week now. I don't feel like I am making any progress. I am considering changing everything to boost::threads instead.
 

Daniel Duffy

C++ author, trainer
I can't use C++11 Threading because I only have access to VS 2008.

I have been debugging an MFC application for over a week now. I don't feel like I am making any progress. I am considering changing everything to boost::threads instead.
An advantage of VS2008 is that some MFC code has not yet been deprecated/unsupported, but this has major consequences..

It means VS2008 will be used for some more years?
 

pingu

Well-Known Member
An advantage of VS2008 is that some MFC code has not yet been deprecated/unsupported, but this has major consequences..

It means VS2008 will be used for some more years?
like VC++ 6? That one is still around
 

Daniel Duffy

C++ author, trainer
thinking about it, Ryan

would it not be better to us VC++ 6.0 instead of VS2008 for this MFC project?
 
Top