Visual C++ :: What Is The Class Name Of CRichEditCtrl
Sep 10, 2013
QUESTION: What is the class name of CRichEditCtrl? More generally, how can I figure this out myself eg with the debugger or documentation?
I've successfully made 3-4 fairly complicated controls from scratch, starting by subclassing CButton as shown in some of the associated example projects.
My current project needs a CRichEditCtrl, with just a slight bit of extra functionality.
I've always used a method called RegisterControlClass(), taken from the example projects, that filled in a WNDCLASS structure by getting another class's WNDCLASS then just modifying it a bit. To get the initial values I used the class name "button" as that was in the example program. It worked fine.
I've tried using the debugger and looking at prich->GetRuntimeClass()->m_lpszClassName, but it equals "CWnd". Obviously wrong.
I found some docs on the 'net referring to MSFTEDIT_CLASS, which has a value of "RICHEDIT50W", that doesn't seem to work either.
I found some fields deep inside the prich object in the debugger leading me to think it might be simply "CRichEditCtrl" but alas not that either.
Here's the function with the class name "button" that works albeit isn't what I want.
Code:
BOOL SCRichEdit::RegisterControlClass() {
// STEP 1: check to see if a class is already registered with this name.
// If it is, and the WndProcHook is ours, then WE'VE already registered
// and its OK. Otherwise someone else is using the same class name. Not OK.
WNDCLASS wclsSCRichEdit;
static const TCHAR szClass[] = _T( "SCRichEdit" );
if ( ::GetClassInfo( AfxGetInstanceHandle(), szClass, &wclsSCRichEdit ) )
return wclsSCRichEdit.lpfnWndProc == (WNDPROC) SCRichEdit::WndProcHook;
I am trying to print the content of the CRichEditCtrl v 2.0. The problem is that when I want to use pagination (with A4 pages), the printed text (which is just 4 sample line with 40 chars at most) at the code lTextPrinted =FormatRange(&fr,TRUE); is always lesser than the actual text pointed by the lTextLength variable making the loop run for ever. notice that using the RichEditControl Version 1 it works fine.
Check the code. I am attaching also the full source code at [URL]
Code:
CPrintDialog printDialog(false); if (bShowPrintDialog) { int r = printDialog.DoModal(); if (r == IDCANCEL) return; // User pressed cancel, don't print.
The problem is that I want to scale the output. I was trying to send message to my control before blitting:
SendMessage( EM_SETZOOM, numer, denom ).
It scaled the control itself, but the blitted context was still the same size as original content CRichEditCtrl (befeoe scaling). Is there any way to blit/render scaled content of CRichEditCtrl to any device context (screen/paper) ?
Code: Error1error LNK2019: unresolved external symbol "public: __thiscall ReachTop<class Character>::ReachTop<class Character>(class Character *)" (??0?$ReachTop@VCharacter@@@@QAE@PAVCharacter@@@Z) referenced in function "void __cdecl `dynamic initializer for 'gReachTop''(void)" (??__EgReachTop@@YAXXZ)Main.objDecisionTest
#include "IMyIntData.h" class MyIntData : public CPMUnknown<IMyIntData> {
I need to know what this syntax means (including MyIntData in angular brackets after parent class name) where IMyIntData is the Interface from where MyIntData is derived.
My program is a basic MFC AppWizard (exe) created project in VC++ 6. In MainFrm.cpp, I am trying to access some user defined CMyView member functions. However when I try to do the standard procedure to get the CMyView pointer in MainFrm.cpp, I get the " ... 'CMyView' : undeclared identifier" error. To resolve this, I add " #include myView.h " at the top of MainFrm.h which then produces the following errors:
Code: myview.h(21) : error C2143: syntax error : missing ';' before '*' myview.h(21) : error C2501: 'CMyDoc' : missing storage-class or type specifiers myview.h(21) : error C2501: 'GetDocument' : missing storage-class or type specifiers
What do these errors mean? Is there a simple way to access CMyView member functions from CMainFrame?
I have encountered a problem I can't see to solve. I want to access a function and can't seem to find the right combination to get me there. Here is what I am looking at:
CFoo1::CFoo2::GetStrDataC(int nRow) const
How do I call the GetStrDataC function from another class?
So I'm trying to do a homework assignment, where I read a uml about a bank program, and just create it. Here is the UML. So while working on Bank, the top one, i've come up with this so far.
Code: #include <iostream> #include <string> using namespace std; class bank { string name; int routingNum;
[Code] ....
I'm assuming that's what the uml wants. However I can't seem to access that private class. Idk why. I declared it as an object in the main.
C++ Create a Triangle class that has the following member variables: side1 - a double side2 - a double side 3 - a double perimeter area
The class should have the following member functions:
- default constructor that sets the value of all 3 sides of a triangle to 0.0
- a constructor with arguments that accepts values for the three sides of a triangle (member variables) as arguments
- setDimensions - a function that allows the value of the three sides to be entered by the user through the keyboard
- testSides - a function that determines if the 3 values entered can actually be the sides of a triangle. If they do not create a triangle, print the values entered and an appropriate message --The sum of any two side lengths of a triangle must always be greater than the length of the third side: so side 1 + side 2 > side 3 and side 1 + side 3 > side 2 and side 2 + side 3 > side 1 ( all three must be true for the 3 values to make a triangle)
- getSide1 - a function that returns the value of side 1, getSide2 - a function that returns the value of side 2, getSide3 - a function that returns the value of side 3
- getArea - a function that returns the area of a triangle: The formula for the area of a triangle (when the height is not known) is: A = sqrt (p(p-side1)(p-side2)(p-side3)) where p = (side1+side2+side3)/2
- getPerimeter - a function that returns the perimeter of a triangle: Perimeter = side1 + side2+ Side 3
- A displayTriangleInfo function that displays side1, side2, side3, area, and perimeter for a triangle object.
After testing your code for a single object, create an array of 5 triangles. Use a for loop and the setDimensions function to allow the user to set the values for the 3 sides of a triangle, test the vales entered to determine if the 3 create a triangle. If they do create a triangle than use the getArea and getPerimeter functions to calculate the Area and Perimeter for the triangle and use the displayTriangleInfo function to display all of the data for that triangle. If the three values do not create a triangle then print the 3 numbers entered and an appropriate message. In either case the loop should then move on and get the data for the next triangle from the user.
I figured it out when I built a simple demo project. Problem arose because of trying to access a c-wrapper dll from the app class whereas the wrapper class had not been initialized there but rather in the main dialog class - so naturally it didn't work!!! Anyway, I've attached the demo for any who might be interested, but I regard the problem as resolved. Shows the value of building simple projects to isolate a problem. I failed to organize the order in which such a program initializes - I guess it's always App first, then MainFrame, then Doc and View (I think).
Is it possible to pass a class pointer as memory buffer across the socket? The above code is just an example. My question in general is, whether it's possible to pass any Classes pointer as a memory buffer across sockets.
The following code it taken from msdn library but it is failing to compile.
the following code has a header where all the variables used here are stored in header App.h.
The following lines are giving trouble:
Code: DialogBox(pApp->getInstance(), MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, pApp->About); error: 'App::About': function call missing argument list; use '&App::About' to create a pointer to member
Code: wcex.lpfnWndProc= &App::WndProc; error: '=' : cannot convert from 'LRESULT (__stdcall App::* )(HWND,UINT,WPARAM,LPARAM)' to 'WNDPROC'
There is no context in which this conversion is possible
i am trying to create a firework display by reading in the fireworks off a .xml file, which will then iterate through and launch each firework.
I followed a tutorial on dinomage to find out how to use tinyxml, i learnt that i can store the attributes into char pointers but i dont know how to convert them to GLfloats to store them in my class variables.
I did try using atof but when i ran the program i got loads of errors which im guessing is because the pointer only stores the address which im passing to my variable.
Update
i have found out that tinyxml is not compatible with vs2010 but tinyxml 2 is, so i have changed my code but am still having trouble loading my attributes i have added error checking, and it prints out that the xml has loaded but then it wont load the root
My program (Test) is a basic MFC AppWizard (exe) created project. I have followed the steps in the link below to create a docked dialog box (myDialog) using VC++. [URL]...
The dialog box works, however, I have 2 issues that I am trying to resolve.
1) I have added a button to the Dialog box, however, when I run the application they start as disabled (note: the Disabled option on the Button Properties is unchecked). If I add function myDialog::OnButton to the myDialog class, the button remains disabled, however, if I add the function CTestView::OnButton to the View class, the button becomes active and works. How can I make the button work from the myDialog class?
2) I would like to be able to change an Edit box in the same dialog box when I click the button. How can I access the pointer to the myDialog from the View class?
I have a non-MFC static library which I share between a number of different projects, some non-MFC and some MFC. Currently the static library uses a typedef of std::wstring and std::string for UNICODE and non-UNICODE builds.
After discovering it's possible to use CString in non-MFC applications, by including atlstr.h header, I decided I'd rather that than using stl strings and having to keep converting between the different types. However, I seem to be struggling with linker errors when linking the library with a MFC application.
Can I create a non-MFC static library using CString from atlstr.h and link it with a MFC application?
In file included from /usr/lib/gcc/i686-redhat-linux/4.5.1/../../../../include/c++/4.5.1/bits/ios_base.h:43:0, from /usr/lib/gcc/i686-redhat-linux/4.5.1/../../../../include/c++/4.5.1/ios:43, from /usr/lib/gcc/i686-redhat-linux/4.5.1/../../../../include/c++/4.5.1/ostream:40, from /usr/lib/gcc/i686-redhat-linux/4.5.1/../../../../include/c++/4.5.1/iostream:40, from player1.cpp:3: /usr/lib/gcc/i686-redhat-linux/4.5.1/../../../../include/c++/4.5.1/bits/locale_classes.h:45:1: error: expected unqualified-id before "namespace"
What does it mean? I am working on classes and this error comes when I run the implentation of my class file.
//Implimentation of class player1 (player.cpp) #include "player1.h" #include <iostream> //using namespace std; void player1 :: Set_Name()
I understand that the files using the exported class or function need to call this class or function with dllimport and the file containing the exported class or function needs to call this class or function with dllexport. But I tried to use __declspec(dllexport) only instead of the statements above. It still works. Is there anything I am missing?Why'd we have to switch between dllexport and dllimport?
I need understanding this block of code, particularly this line : *getLeftChild() { return this - _child; }
Code:
public class UpperNode { BOX _box; int _child; FORCEINLINE UpperNode *getLeftChild() { return this - _child; } ... };
Here I have this function:
Code: void UpperNode::visulization(int level) { if (isLeaf()) _box.visulization(); else if ((level > 0)) {
[Code] .....
It also makes calls for "getLeftChild()";
But I see that getLeftChild expects function pointer, and I absolutely have no clue where "this" comes from inside function body.
(return this - _child) - "this" has to be integer.
Or, if we gave pointer, and "this" is referring to some UpperNode, then I can't understand to which one, I have no UpperNode array defined or something. So if this functions is actually scaling pointer address, then scaling where to? I could comprehend it, if I had some array of UpperNodes, but not just class. I have UpperNodes array defined in other friendly class, but don't think they are related .....
I need to create an object of a mfc derived CFormView class that's not in the doc/template (a second view class). But it was generated with a protected ctor. Here's the code explanation with comments.
I'm thinking all the normal classes of the Doc/View template are created starting with this code, but within the template code base.
Code:
CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate(IDR_MAINFRAME, RUNTIME_CLASS(CViewSwitchDoc), //<-expands to-> ((CRuntimeClass*)(&CViewSwitchDoc::classCViewSwitchDoc)), RUNTIME_CLASS(CMainFrame), // main SDI frame window RUNTIME_CLASS(CViewSwitchView));
But I have generated "another view" using the "Add Class" Wizard, it's a derived class of mfc CFormView which I named ViewForm. However I'm having a problem creating an instance of it because of the generated protected ctor and pulls a compile error of not being able to access ctor. Below are the header and implementation files of this said ViewForm class. How to create an object of this view ? Did I go about it all the wrong way since it's not in the doc/template group ?
// ViewForm.h file #pragma once // ViewForm form view class ViewForm : public CFormView { DECLARE_DYNCREATE(ViewForm)
Imagine if there is an abstract class with a method (say output or print) which would be inherited by a few other classes. Later objects are created using the inherited classes, and the user wishes to call the above method twice, for eg (i) output/print to screen and (ii) output/print to a file. What is the best way to achieve that.
For a ribbon bar with edit controls (CMFCRibbonEdit) I want to handle the mouse scroll events for the edit controls. That is, when the user clicks and then scrolls on the edit it will navigate a predefined list of strings. I want to capture the scroll event in order to update the edit text step by step.
This kind of behavior is implemented by the Spin Edit; I don't want to use the spin edit control since it only uses a list of integers and the spin buttons are too small.
Is there a way to catch the mouse scroll event for the CMFCRibbonEdit control? How to approach message handling for the ribbon (other messages than the COMMAND allowed by the ribbon designer). I'm using VS2010 on Windows 7 and the ribbon was designed with the ribbon designer?