|
I disabled my intellisense that borked my classes/resources windows
CI/CD = Continuous Impediment/Continuous Despair
|
|
|
|
|
Hi
I have a richedit control as child control in my modeless dialog. I have populated editcontrol via streamin SF_TEXT with a program listing. I am looking to insert a bullet to specify a breakpoint.
After doing some research there were a number of articles about the richedit ole interface. With the bitmap being an ole client. I remember at one time getting this work (had different computer but still had windows 10)
regardless just looking back at those articles it seems the ole support would only work with RTF format text.
I am now thinking of going back to original API for bitmaps by that I mean BitBlt and or Strechbilt.
In my initdialog after creating the rich edit both object via new and creating a HWND via DDX_CONTROL I did a Clientrect on bot the modless dialog box and the richedit control it showed that right variable of the RECT structure for richedit window was 20 pixels less than the right viariable of the parent modeless dialog box. I think those 20 pixels would be enough for me to insert a bullet bmp
Yet when eyeballing the output, it seemed the text of the richedit was right up against the frame of the modeless dialog box
I think 20 pixels would be something I would notice
am I not understanding things correctly
thanks
|
|
|
|
|
I'm not sure, but couldn't it be that the dialog's client rect is relative to the upper left of the window, while the child control's client rect is relative to the upper left of the dialog's client rect?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Not sure what you mean by window in dialog box same as CFRamewnd there is a frame that takes up space
The GetClientRect implies as in Client the white back ground portion
I mean if you were to Draw text the coordinates would be the white back ground right So if the richedit child control is +20 from the client area of dialog the text I’m writting to or streaming shouldn’t be right up against the frame right ?
|
|
|
|
|
I don't have MFC so I cannot test this control. However, it occurs to me that perhaps the RichEdit control reserves some edge space for its own purposes (possibly a scrollbar). Try calling GetWindowRect on the control and compare that with the dialog's client rect.
[edit]
I just checked the difference between the Window and Client sizes of a simple Edit control. The width was 25 pixels different, and the height 4. So I guess what you are seeing is correct.
[/edit]
modified 18-Oct-21 11:30am.
|
|
|
|
|
I had this code working in the begining of this year. I a program listing in a rich edit control that I streamed in with SF_TEXT (looked really) nice. I then wanted insert a bullet to indicate a break point something similar to what visual studio does.
I had a red bullet and used the Richedit OLE interface along the lines in what is in KB Article Q220844 All of the sudden now its not working the red bullet does even look a bitmap after I do insertobject
Could it be to fixes windows have something to do with this
I'll end by asking a general question is it possible to insert a bitmap (in may case a red bullet ) in Richedit doc where I streamed in data in SF_TEXT format ?
|
|
|
|
|
If a bitmap does not work, could you use an HTML character instead? I'm not sure what format CRichEditCtrl uses, but maybe something like:
·
·
·
·
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
I know I tried streaming in a z/os assembler listing when I look at the project date it was 1/2020 it was under windows 10 I now have a different computer newer version of windows 10 back then inserting the bullet via richeditole->object worked
I just would like to ask you a general question if streamin the text with SF_TEXT should I after doing the other api calls be able to do richediole->insertobject I did setsel to where I want to place it and put value in REFORMT structure to use current selection for bitmap should this work if initial text was streamed in with SF_TEXT
|
|
|
|
|
I have a richedit control which first time I am not able to clear out to nulls or have no value
Below is the code for CGRegs which a modeless Cdialog in which the client area is filled by a rich edit
as you can see all the way on the bottom I select the entire richedit and do a Clear
The first time around before General Purpose Registers Cdialog/richedit is filled I do a Stream out
I would assume the value of cb would be zero but its not its 0x7b for some unexplained reason more so
the value of the buffer of the rich edit is
pbBuff = 0x000001d45061df80 "{\\rtf1\\ansi\\deff0{\\fonttbl{\\f0\\fnil\\fcharset0 Courier New;}}\r\n\\viewkind4\\uc1\\pard\\lang1033\\f0\\fs17
Dont know what this is when I try to populate the the richedit with the register value it puts after the string
{\rtf1\ansi\deff0{\fonttbl{\f0\fnil\
\viewkind4 GPR 00=000000_00000114 GPR 04=00000000_FFFF
Any one the know who I can clear the inital value of the rich edit
thanks
static DWORD MyStreamOutGPRCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG* pcb)
BOOL CGPRegs::OnInitDialog()
{
gprrichedit = new CRichEditCtrl;
CDialog::OnInitDialog();
gprrichedit->SetSel(0, -1);
gprrichedit->Clear();
return TRUE;
}
CGPRegs::~CGPRegs()
{
}
void CGPRegs::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_RICHEDIT22, (CWnd &)*gprrichedit);
}
|
|
|
|
|
gprrichedit = new CRichEditCtrl;
CDialog::OnInitDialog();
gprrichedit->SetSel(0, -1);
gprrichedit->Clear();
You are creating a new RichEdit control so it will not contain any data, so no need to clear it. As to the other code you show above, I cannot understand what it is about; e.g:
pbBuff = 0x000001d45061df80 "{\\rtf1\\ansi\\deff0{\\fonttbl{\\f0\\fnil\\fcharset0 Courier New;}}\r\n\\viewkind4\\uc1\\pard\\lang1033\\f0\\fs17
is not valid, since the parameter is a long integer.
|
|
|
|
|
That’s the data I find the first time I call streamout with cb being x’7B’
Okay thanks
|
|
|
|
|
I think that is just the base control data for CRichEdit text, which is used to format it in the display. If you want pure text then you need to use CEdit.
|
|
|
|
|
|
Solve in C language:
1: "A savings account was opened with a deposit of $500.00. Imagine that this account is paid at 1% interest per month. What will the account value be after three months?"
2: "Make a program with 2 variables, A and B, where A will have the value 40 and B will have the value -1. Print the value of A+B, A-B, AxB and A/B. Then make B increment by a drive and repeat the 4 operations."
|
|
|
|
|
And what is your question?
|
|
|
|
|
as a starter, I give you the 'compute_interest' skeleton. To complete it is up to you
double compute_interest(double deposit, int months)
{
double interest;
return interest;
}
"In testa che avete, Signor di Ceprano?"
-- Rigoletto
|
|
|
|
|
At this rate, you might want to plan on staying a beginner.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Senhor League wrote: Then make B increment by a drive and repeat the 4 operations
What does that mean? Is it a quirk of Google Translate?
Based on the language that I thought seemed reasonable given your CP username, I tried Google translate from English to Portuguese (Em seguida, faça o incremento B por uma unidade e repita as 4 operações) and back to English. That gives "Then increment B by one unit and repeat the 4 operations." - that makes more sense.
|
|
|
|
|
Maybe Google Translate tried to solve it and encountered a divide by zero error.
|
|
|
|
|
I think you are a bit harsh! We all had to learn! Maybe Codeproject should start a Beginners Page
Bram van Kampen
|
|
|
|
|
Bram van Kampen wrote: I think you are a bit harsh! We all had to learn!
Indeed we did, and for many of us there was no internet to help.
But there seems to be an attitude among a number of students (I assume a minority) these days that they do not have to put any actual effort into learning. We get regular questions in QA of this type, which at best are, "please do my assignment". Some of them even use the excuse that they don't have time to learn, or it must be ready by tomorrow at the latest.
|
|
|
|
|
The question is:
Do you seriously want to learn how to become an IT specialist, who can code, or are you more interested in the party type student life.
The problems you want resolved are quite trivial, and I could easily write you the required lines.
However, I will not! You seem to be early in your course. I have no doubt that your college provided you with the resources required where you can find out how to write this code. Read it, and Try it out, fail and Learn. Writing Code is about Trying and Learning, the whole time. You write the Code, Compile it. You get Compiling errors. That means that the Compiler does not understood what you wrote. Solve them, it Compiles. Now you have a running program or App. Does the App do what you want it to do! Very Often it does not. They call that Debugging!
I learned C and CPP/MFC the hard way. By myself, trial and error. My University simply did not have a computer that students could work with in 1974. My first computer was a Commodore 64 in 1985, where I learned the beginnings of Machine Code and ASM programming. A small PC with a C Compiler came as a godsend, and at the time I was in no doubt what compilers linkers, and debug/retail versions did and could do.
You have an institution with resources behind you. Use those resourses and learn. Stop asking this forum to resolve your exam questions.
Believe it or not,
Everybody on this forum has met intractable issues, All of us have been students, one way or the other. We deal with real science here. Helping you to spoof your exam is never a way forward.
Bram van Kampen
|
|
|
|
|
Given following definition for singly linked list node and a pointer type:
struct Node {
int num;
Node* next;
Node() = delete;
Node(int num) : num{ num }, next{ nullptr } {}
};
typedef Node* NodePtr;
Use following prototype:
void quiz2(NodePtr& head1, NodePtr& target, NodePtr& head2)
to design a function that:
Takes in two linked lists, indicated by head1 and head2, and a NodePtr target
Searches target Node in linked list 1 (by comparing address, not by value):
If found, then connect the whole linked list 2 to the target node. In other words, use list 2 to replace nodes after target. Also update head2 to nullptr as the merged linked list should have only one entry point at head1.
If not found, then connect list 2 to the end of list 1, and set head2 to nullptr for the same above reason.
For example,
list 1: 10->20->30->40, target is the address of node 20, list 2: 11->12->13, then after calling the function, list 1 should be 10->20->11->12->13.
list 1: 10->20->30->40, target is an address that cannot be found in list 1, list 2: 11->12->13, then after calling the function, list 1 should be 10->20->30->40->11->12->13.
When merging, please take care of memory and do not let leak happen. You will be deducted by 10 points if memory leak happens. (Hint: in the first example, what should happen to nodes 30 and 40?)
Submit one .cpp file as your answer to Quiz 2.
Develop your own work and DO NOT CHEAT. Violator will be found, reported, and penalized with F grade for this course.
Attach FileNo file chosen
modified 3-Nov-21 21:01pm.
|
|
|
|
|
Quote: Develop your own work and DO NOT CHEAT. Violator will be found, reported, and penalized with F grade for this course. What part of that statement did you not understand?
|
|
|
|
|
wrote: Develop your own work and DO NOT CHEAT. Violator will be found, reported, and penalized with F grade for this course.
LOL.
CI/CD = Continuous Impediment/Continuous Despair
|
|
|
|