Tuesday, January 7, 2020

MFC quick demo

  1. MFC programming tutorial
  2. first 4 modules are good enough. it has drawing circle logic.

    quick tutorials

  3. Module 1: Microsoft Windows, Visual C++ and Microsoft Foundation Class (MFC)
  4. Module 1a: Microsoft Windows, Visual C++ and Microsoft Foundation Class (MFC)
  5. Module 2: Getting Started with Visual C++ 6.0 AppWizard 1
  6. Module 2: Getting Started with Visual C++ 6.0 AppWizard 2
  7. Module 3: Basic Event Handling, Mapping Modes, and a Scrolling View 1
  8. Module 3a: Basic Event Handling, Mapping Modes, and a Scrolling View 2
  9. Module 3b: Basic Event Handling, Mapping Modes, and a Scrolling View 3
  10. Module 4: The Graphics Device Interface (GDI), Colors, and Fonts 1
  11. Module 4: The Graphics Device Interface (GDI), Colors, and Fonts 2
  12. Module 4: The Graphics Device Interface (GDI), Colors, and Fonts 3
  13. Module 9: A Reusable Frame Window Base Class 1
  14. Module 9a: A Reusable Frame Window Base Class 2
  15. good info on include files and theory

  16. MODULE 10 THE C/C++ PREPROCESSOR DIRECTIVES 1
  17. MODULE 10 THE C/C++ PREPROCESSOR DIRECTIVES 2: #define etc.
  18. another quick tutorial

  19. MFC Tutorial
  20. MFC - Dialog Boxes: Beginning point
  21. MFC - Messages & Events:End point
  22. above two links are in one tutorial. it has clear descriptions on how to create MFC application by creating a Win32 project.

  23. MFC - GDI
  24. MFC - File System
  25. MFC - Standard I/O
  26. MFC - Document View
  27. MFC - Strings

Saturday, January 4, 2020

passing object into C++ function

good C++ video series

compiled list from Youtube of good C++ video series:

    class vs object related quick shots

  1. Class and Object
  2. Constructor Destructor in C++
  3. C++ Tutorial for Beginners - Full Course: by minutes
  4. class vs object related quick shots:by Extern CodeExtern Code

  5. C++ Tutorial from Basic to Advance: separated by minutes in one class
  6. good C++ video series from Cherno

  7. Using Libraries in C++ (Static Linking)
  8. Using Dynamic Libraries in C++
  9. How to Setup C++ on Windows
  10. Setup VS Code For C/C++ Development on Windows
  11. Welcome to C++
  12. above is good series of tutorials. worth watching,

    good video from NewBostons

  13. Buckys C++ Programming Tutorials - 30 - Function Overloading
  14. Buckys C++ Programming Tutorials - 1 - Installing CodeBlocks
  15. Buckys C++ Programming Tutorials - 58 - function Templates
  16. C++ Programming Tutorials Playlist:73 series
  17. above is good series of tutorials. worth watching,

    another series

  18. C++ Void Functions by profgustin
  19. C++ - Value-Returning Functions by profgustin
  20. another series

  21. C++ Part 51 - Void Functions Introduction by ICT Tutorial Channel
  22. C++ Part 52 - Reference Parameters
  23. C++ Part 81 - Class Constructors
  24. C++ Part 82 - Class Accessors
  25. C++ Part 01 - What You Need to Program: complete playlist from ICT Tutorial Channel
  26. one long lesson in 10 hours

  27. C++ Programming All-in-One Tutorial Series (10 HOURS!)
  28. C++ Tutorials: complete play list from Caleb Curry
  29. a complete list

  30. C++ Programming | In One Video by Mike Dane:: by minutes
  31. bad training: not so good training

  32. C Programming Tutorial - 48: Functions (Part-4) Call By Value Method

Wednesday, January 1, 2020

Resolving issues( .ipch , .db , .suo files) in uploading VS projects (VC++) to SVN repository.

to resolve issues in uploading VS projects (VC++) to SVN respository. there are some .ipch , .db , .suo files are very big and don't need to upload to SVN repository.

  1. How to avoid precompiled headers
  2. You can always disable the use of pre-compiled headers in the project settings.

    Instructions for VS 2010 (should be similar for other versions of VS):
    1. Select your project, use the "Project -> Properties" menu
    2. go to the "Configuration Properties -> C/C++ -> Precompiled Headers" section,
    3. then change the "Precompiled Header" setting to "Not Using Precompiled Headers" option.
  3. Visual Studio: Disable Precompiled Headers
    1. Open your project, then select “Project” > “appname Properties…“.
    2. Expand “Configuration Properties” > “C/C++” > “Precompiled Headers“.
    3. Set “Precompiled Header” to “Not Using Precompiled Headers“.
  4. What are these .pch and .ncb files in visual studio?
  5. PCH is the precompiled headers file. It's a temporary that you can safely delete. You can disable its creation through Project Settings > C++ > Precompiled Headers > Don't use precompiled headers and removing the stdafx.cpp file from your project.

    NCB is the database used by IntelliSense to allow you to browse the symbols defined in your project, including the inline hints and auto completion as you type. You can safely delete it. There is an option to disable IntelliSense too.

    However, both features may be useful; therefore you may not want to disable them. If you worry about the size of the backups or sending the projects to some other programmer, then you can just clean the project by removing said files.

  6. How to prevent or remove Visual Studio ipch/pch folders from the project
  7. not useful.


Tuesday, December 31, 2019

Layout management

  1. DockPanel Suite
  2. DockDotNET
  3. DockableForm
  4. TableLayoutPanel Class
  5. Step 4: Lay out your form with a TableLayoutPanel control
  6. Best Practices for the TableLayoutPanel Control
  7. AutoSize Behavior in the TableLayoutPanel Control
  8. .NET Layout Manager
  9. EvaLayout, Lay It Be!
  10. Drop-dead easy layout management
  11. Designing the Layout of Windows Forms using a TableLayoutPanel, with auto-expand panels
  12. Visual Studio error D8016: '/ZI' and '/Gy' command-line options are incompatible
  13. VS2017 New Install - fatal error C1083: Cannot open include file: 'new.h': No such file or directory
  14. the solution is copied from above link:

    new.h used to live in an include folder of the vc compiler and now is located in the SDK folder (for example C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\ucrt). Make sure to add this in your include section and it should compile fine.

  15. Visual Studio setup error: LNK1104 cannot open file 'ucrtd.lib'
  16. the solution comes from the above link:

    The file ucrtd.lib is a library from the Windows SDK and I searched it on my computer and it located in C:\Program Files (x86)\Windows Kits\10\Lib, and as far as I known, the Visual C ++ didn’t include the Windows SDK, I recommend you download the Windows SDK from the following links refer to your OS version, and use it to install or repair.

  17. BoxPlanner - Simple Layout Algorithm
  18. Fun with Physics: Implementing a Physics based layout manager
  19. Sizers: An Extendable Layout Management Library
  20. Creating a wizard layout using C#
  21. Creating a wizard layout using C#
  22. Layout Persistence for your Forms including all of their subcontrols
  23. Step 4: Lay out your form with a TableLayoutPanel control
  24. ritchiecarroll/Report.NET
  25. Layout Management in Windows Forms Diagram
  26. TableLayoutManager
  27. C# (CSharp) TlmColumnMM Examples
  28. C# (CSharp) TableLayoutManager Examples
  29. .vcxproj and .props file structure
  30. Old csproj to new csproj: Visual Studio 2017 upgrade guide
  31. I recently had to spend a lot of time with csproj files.

MFC quick tutorial and some critical concepts

googled keyword "MFC quick tutorial" and gleaned the useful links for my future references.

    good video tutorials

  1. VC++/C++ MFC tutorial 1: Creating a Dialog box for user input
  2. VC++ MFC Basics - 1 - Installing Visual Studio
  3. VC++ MFC Basics - 2 - Project File Structure and VS Environment
  4. VC++ MFC Basics - 3 - Drawing
  5. VC++ MFC Basics - 4 - Using Menus , Menu command
  6. VC++ MFC Basics - 5 - Dialog box with SDI
  7. VC++ MFC Basics - 6 - New, Open, Save, Save As in SDI
  8. VC++ MFC Basics - 7 - Button (CButton) in a view
  9. VC++/C++ MFC tutorial for beginners - A Draw app View/Document (no voice)
  10. C++ programming tutorial: Functions part 1
  11. C++ programming tutorial: Functions part 2
  12. C++ programming tutorial: Functions part 3
  13. C++ programming tutorial: Functions part 4
  14. C++ programming tutorial: Functions part 5/5
  15. C++ Programming tutorial: Reference variable
  16. What is the Difference Between a Pointer and a Reference C++
  17. C++ Programming tutorial: characters (char -type)
  18. C++ Programming tutorial: C-type strings (array or characters)
  19. C++ Tutorial for Beginners - Classes and object 1
  20. C++ Tutorial for Beginners - Classes and object 2
  21. other concepts

  22. How to write classes and create objects in C++ (Episode 4)
  23. C++ Tutorial 29 - Reading and Writing to Files - fstream
  24. C++ Programming Tutorial - 14 - string Class
  25. 16. Strings:: MIT license
  26. C++ Tutorial 27: Multiple constructors.
  27. C++ Tutorial 20-1 - Classes and Object-Oriented Programming (Part 1): another teacher
  28. C++ Tutorial 20-2 - Classes and Object-Oriented Programming (Part 2):another teacher
  29. C++ Tutorial 11 : Classes and Objects in C++
  30. C++ Tutorial: Classes and Objects
  31. C++ Programming Tutorial 21: Passing class object as function parameter
  32. C++ 03 - The C++ Object Model
  33. Classes and Objects (Lecture 19)

  34. C++ Tutorial: Pass by value, reference and pointer
  35. What is the Difference Between Pass By Value, Pass By Reference, and Pass By Pointer, C++
  36. What is the Difference Between Pass By Pointer and Pass By Pointer Reference (int * and int * &) C++
  37. good notes

    Paul gave very clear explanation on these two topics. very good.


  38. 6.11 — Reference variables
  39. References are the third basic type of variable that C++ supports. A reference is a type of C++ variable that acts as an alias to another object or value. other two types of variable are:

    • Normal variables, which hold values directly.
    • Pointers, which hold the address of another value (or null) and can be dereferenced to retrieve the value at the address they point to.

    Note:: const variables are considered non-modifiable l-values.

    l-values and r-values:

    In C++, variables are a type of l-value (pronounced ell-value). An l-value is a value that has an address (in memory). Since all variables have addresses, all variables are l-values. The name l-value came about because l-values are the only values that can be on the left side of an assignment statement. When we do an assignment, the left hand side of the assignment operator must be an l-value. Consequently, a statement like 5 = 6; will cause a compile error, because 5 is not an l-value. The value of 5 has no memory, and thus nothing can be assigned to it. 5 means 5, and its value can not be reassigned. When an l-value has a value assigned to it, the current value at that memory address is overwritten.

    The opposite of l-values are r-values (pronounced arr-values). An r-value refers to any value that can be assigned to an l-value. r-values are always evaluated to produce a single value. Examples of r-values are literals (such as 5, which evaluates to 5), variables (such as x, which evaluates to whatever value was last assigned to it), or expressions (such as 2 + x, which evaluates to the value of x plus 2).

    References must be initialized when created.Unlike pointers, which can hold a null value, there is no such thing as a null reference.

    Unlike pointers, which can hold a null value, there is no such thing as a null reference.

    References to non-const values can only be initialized with non-const l-values. They can not be initialized with const l-values or r-values.

    References can not be reassigned. Once initialized, a reference can not be changed to reference another variable. Consider the following snippet:

    References and pointers have an interesting relationship -- a reference acts like a pointer that is implicitly dereferenced when accessed (references are usually implemented internally by the compiler using pointers). Thus given the following:

    • int value{ 5 };
    • int *const ptr{ &value };
    • int &ref{ value };

    *ptr and ref evaluate identically. As a result, the following two statements produce the same effect:

    • *ptr = 5;
    • ref = 5;

    Because references must be initialized to valid objects (cannot be null) and can not be changed once set, references are generally much safer to use than pointers (since there’s no risk of dereferencing a null pointer). However, they are also a bit more limited in functionality accordingly.

    If a given task can be solved with either a reference or a pointer, the reference should generally be preferred. Pointers should only be used in situations where references are not sufficient (such as dynamically allocating memory).

  40. 6.11a — References and const
  41. A reference to a const value is often called a const reference for short, though this does make for some inconsistent nomenclature with pointers.

    Unlike references to non-const values, which can only be initialized with non-const l-values, references to const values can be initialized with non-const l-value, const l-values, and r-values.

    Much like a pointer to a const value, a reference to a const value can reference a non-const variable. When accessed through a reference to a const value, the value is considered const even if the original variable is not:

    References used as function parameters can also be const. This allows us to access the argument without making a copy of it, while guaranteeing that the function will not change the value being referenced.

    References to const values are particularly useful as function parameters because of their versatility. A const reference parameter allows you to pass in a non-const l-value argument, a const l-value argument, a literal, or the result of an expression:

    #include void printIt(const int &x) { std::cout << x; } int main() { int a = 1; printIt(a); // non-const l-value const int b = 2; printIt(b); // const l-value printIt(3); // literal r-value printIt(2+b); // expression r-value return 0; }

    To avoid making unnecessary, potentially expensive copies, variables that are not pointers or fundamental data types (int, double, etc…) should be generally passed by (const) reference. Fundamental data types should be passed by value, unless the function needs to change them.

    Rule: Pass non-pointer, non-fundamental data type variables (such as structs) by (const) reference.

  42. 6.10 — Pointers and const
  43. To summarize, you only need to remember 4 rules, and they are pretty logical:

    • A non-const pointer can be redirected to point to other addresses.
    • A const pointer always points to the same address, and this address can not be changed.
    • A pointer to a non-const value can change the value it is pointing to. These can not point to a const value.
    • A pointer to a const value treats the value as const (even if it is not), and thus can not change the value it is pointing to.
    • Keeping the declaration syntax straight can be challenging. Just remember that the type of value the pointer points to is always on the far left:

  44. 6.12 — Member selection with pointers and references
  45. Note that the pointer dereference must be enclosed in parentheses, because the member selection operator has a higher precedence than the dereference operator.

    • struct Person
    • {
    • int age;
    • double weight;
    • };
    • Person person;
    • // Member selection using pointer to struct
    • Person *ptr = &person;
    • (*ptr).age= 5;

    Because the syntax for access to structs and class members through a pointer is awkward, C++ offers a second member selection operator (->) for doing member selection from pointers. The following two lines are equivalent:

    • (*ptr).age = 5;
    • ptr->age = 5;

    This is not only easier to type, but is also much less prone to error because the dereference is implicitly done for you, so there are no precedence issues to worry about. Consequently, when doing member access through a pointer, always use the -> operator instead of the . operator.

    Rule: When using a pointer to access the value of a member, use operator-> instead of operator. (the . operator)

  46. References in C++
  47. Pointers and References in C++
  48. Pointers vs References in C++
  49. C++ References


  50. C++ & MFC Part 1: README FIRST: good and complete materials
  51. Event Programming Event from Washington University
  52. Chapter Tutorials for Essentials of Interactive Computer Graphics from Washington University
  53. Creating Dialog Based Applications with MFC 7
  54. A Beginners Guide to Dialog Based Applications - Part One
  55. Beginners Guide to Dialog Based Applications - Part Two
  56. Windows Message Handling - Part 1
  57. Windows Message Handling - Part 2
  58. Windows Message Handling - Part 3
  59. Windows Message Handling - Part 4
  60. Exception Handling Best Practices in .NET
  61. Creating Your First Windows Application
  62. Using the List Control