I understand I am going to try one more thing all this time I have been using DDX to create the window handle to the richedit. and using the control id it would pick the rect value from the resource file
This in a way doesnt make sense. I am going to do a GetClientRect for the parent dialog deflat the recct on the left side then instantiate the Richedit with new and Call the Richedit Create to Create the
Have a look at the Scintilla library[^]. Last time I used it was nearly 20 years ago. I'm not even sure if Scintilla supports Windows anymore, you might need to do some research. I do see that they mention requiring a C++17 compiler on the website.
The default constructor does not contain PD_RETURNDEFAULT. You will need to use the PD_RETURNDEFAULT flag[^] to get the CPrintDialog class to simply return the default printer. In fact by using this flag the DoModal(); function won't even open a window.
Windows 10 makes decisions for the novice users. So Windows 10 will sometimes decide which printer to use and override the user choice. To disable this programmatically you could set the HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows\LegacyDefaultPrinterMode to TRUE.
I have some basic knowledge about pointers and I`m trying to get an exhaustive understanding, like an all sides perspective. My question is what does the operator ++ do to a pointer? I`ve seen it being used in linked lists related code.
could I increment not the value of the variable the pointer is pointing to but the pointer itself?
int Something0 = 0;
int Something1 = 1;
int ** Pointers = new int*;
Pointers = &Something0;
*Pointers++; //increase Something0 by 1
Pointers = &Something1;
*Pointers++; //increase Something1 by 1//Could I do this
**Pointers =10; //set Something0 to 10
**Pointers =30; //set Something1 to 30
You should also know about the difference between a pre-increment and post-increment operator. In an expression, a pre-increment operator computes the increment before accessing the item, and a post-increment computes the increment afterwards. For example
int i = 1;
int j = ++i; // i is incremented before assignment: i = 2, j = 2;
int k = i++; // i is incremented after assignment: i = 3, k = 2;
int x = ++i++; // UNDEFINED BEHAVIOR!!! Do not do this!!!
In the case ++i++ The standard does not say what will happen. The only thing you know is that i will have the value 5 after the expression is complete. The variable x could be assigned at any point during the expression, or since this is undefined behavior, it might even get the value -42, which makes no sense in respect to the code, but is acceptable according to C/C++ standard. Even if you do some testing and work out that for type int the expression ++i++ is the equivalent of ++(i++), it might be different for type long, or for a pointer type, and it might change depending on complexity of the overall expression, and/or the optimization level. The takeaway for this is that you don't know what will happen if you try to pre and post increment an expressions term at the same time. Moreover, you should not try to increment the same variable within the same expression:
int i = 2;
printf("%d %d\n", i++, ++); // undefined order of evaluation
In the printf statement above, its undefined which order the arguments to printf get evaluated, and different compilers do it differently. I'm reasonably sure that clang and gcc do this differently.