|
Not able to see the message on the message board saw the email)
|
|
|
|
|
Sorry about that, it was not appropriate to the specifics of your question.
I cannot remember if you are using MFC or not. If you are then perhaps create your own class that inherits from the RichEdit class. If not then you could use the SubClassWindow function to get control of Windows WM_xxx messages and so modify what gets displayed.
|
|
|
|
|
I am using MFC wondering if by that you mean WM_PAINT or in my case the OnPaint message handler to ensure bitmap is intact
|
|
|
|
|
I cannot suggest anything more without spending hours analysing your code. Which is not an option, sorry.
|
|
|
|
|
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
the richedit with smaller rect
|
|
|
|
|
Richard
For my GDI display I need the number of rows equal to same number as the original Client suffice on column is enough
|
|
|
|
|
|
thanks going try one more thing before bypassing richedit's coloring capabilities
|
|
|
|
|
# include <stdio.h>
# define scanf "%s me "
main()
{
printf(scanf, scanf);
getchar();
return 0;
}
|
|
|
|
|
Didn't you try to compile/test it?
|
|
|
|
|
You already have the answer on your repost of this:
Please give me explanation of this code.[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I don't have a physical printer, so I cannot test (Am I wrong here?)
I'm trying to print something (a bitmap) using MFC.
I set my default printer to "Microsoft Print To PDF" in Windows 10 settings.
I have a skeleton code like this :
The GetDefaults() fails.
Am I missing something ?
Obviously, other print commands in other software work (VS, Word, Chrome... )
{
CPrintDialog dlg(FALSE);
if (!dlg.GetDefaults())
{
AfxMessageBox(_T("You have no default printer!"));
}
else
{
CDC dc;
dc.Attach(dlg.m_pd.hDC);
}
}
CI/CD = Continuous Impediment/Continuous Despair
|
|
|
|
|
You don't need the CPrintDialog if you already know the printer name.
Just use something like
HANDLE printerHandle = nullptr;
TCHAR name[] = _T("Microsoft Print To PDF");
if (!::OpenPrinter(name, &printerHandle, nullptr))
{
...
}
|
|
|
|
|
the problem is not the device name, but GetDefaults not returning the default printer.
Obviously, it should work for any device.
CI/CD = Continuous Impediment/Continuous Despair
|
|
|
|
|
Max,
The default constructor is in the documentation[^]:
CPrintDialog(
BOOL bPrintSetupOnly,
DWORD dwFlags = PD_ALLPAGES | PD_USEDEVMODECOPIES | PD_NOPAGENUMS | PD_HIDEPRINTTOFILE | PD_NOSELECTION,
CWnd* pParentWnd = NULL);
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.
CPrintDialog dlg(FALSE,PD_RETURNDEFAULT,NULL);
dlg.DoModal();
LPDEVMODE lpdev = dlg.GetDevMode();
MessageBox(lpdev->dmDeviceName,0,0);
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.
Best Wishes,
-David Delaune
|
|
|
|
|
lol, thanks.
I should really pickup this technical skill of RTFM.
CI/CD = Continuous Impediment/Continuous Despair
|
|
|
|
|
|
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.
|
|
|
|
|
It is the increment operator, and as with any variable it adds 1 to the pointer. This will move the pointer forward by one element of whatever it is pointing to: int, long, struct, object etc.
|
|
|
|
|
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*[2];
Pointers[0] = &Something0;
*Pointers[0]++;
Pointers[1] = &Something1;
*Pointers[1]++;
**Pointers =10;
Pointers++;
**Pointers =30;
|
|
|
|
|
That's what the increment operator does to a pointer - it increments the pointer itself.
If you want to increment the value that it's pointing to, you must dereference the pointer first, like so: (*pointer)++;
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Thanks I think I understand.
|
|
|
|
|
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; int k = i++; int x = ++i++; 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++, ++);
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.
Keep Calm and Carry On
|
|
|
|
|
thanks k5054. I`m not sure I fully understand the difference. I guess I need look up the issue in several different sources. (I often find consulting different perspectives on the same issue helpful).
modified 16-Nov-21 17:41pm.
|
|
|
|
|