|
I know you didn't ask for a book, but I really think you should treat yourself with "MFC Internals" by George Shepherd and Scot Wingo. It's very old (1996), covers MFC 4.0 (many versions back) but it is still the bible of MFC programming. It covers all the fundamental functionalities of MFC and gives you an in-depth understanding of the framework. And MFC really haven't changed that much since 4.0. I regularly read it although I've been programming MFC for 10 years. You can get some used copies for about $7 at Amazon.
Another must-have book is "Programming Visual C++" by Kruglinski, Wingo and Shepherd, also available used at Amazon (<$5)
Cheers
Steen.
"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
Thanks, I like to use books better actually. I've spent all my money for this month (literally), so I'll have to wait 'till next month to see if I have money, but I'll look into it.
Danny
|
|
|
|
|
Hi all,
I have a dialog box which has rich-edit as child control inside it.
When i click inside the rich-edit box, focus is in the rich-edit.
Now when i press 'Tab' key from here, then text in rich-edit is highlighted.
But focus does not move outside rich-edit. Instead i want the focus to move to other controls in the main dialog, when i press 'Tab' key inside rich-edit.
Please suggest on how should i handle Tab key notification for rich-edit in this dialog.
Thanks in Advance
Abhijeet Jadhav
|
|
|
|
|
use LayOut-->TabOrder (ctrl+D) menu.
set ordering.
|
|
|
|
|
Hi prasad,
i have set tab-order appropriately.
But since rich-edit is a child control inside the dialog, on pressing tab control does not go outside rich-edit.
Please see if you find the solution.
Tell me if the problem is clear.
Thanks
Abhijeet Jadhav
|
|
|
|
|
The behavior you describe is not the default. You are doing something else in your code that is causing this behavior. To verify this, create a temporary dialog-based application, add a rich edit control to the dialog template, call AfxInitRichEdit() in InitInstance() , and run the application. Notice anything different?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
How do i use functions that have been defined in a dll?
For example:
I built a ATL/Dll that has a class definition. This class has some methods and atributtes. How can i use that methods and atributtes in a other project?
I'm using Visual c++ 6.0;
I wait for reply!
Greatful!
Hélio
-- modified at 9:00 Tuesday 20th September, 2005
|
|
|
|
|
|
unhappyly this article was not util for me
|
|
|
|
|
I forgot to say that my dll is a ATL DLL
|
|
|
|
|
You can either export the member functions with __declspec( dllexport ), or you convert the class to a COM interface which has get/set functions.
Don't try it, just do it!
|
|
|
|
|
/*
** This is an interesting C++ bug, well I think it is a bug
*/
class CTest1
{
public:
BYTE* pbData;
public:
CTest1()
{
pbData = new BYTE[GetDataSize()];
}
virtual int GetDataSize()
{
return 16;
}
};
class CTest2 : public CTest1
{
CTest2() : CTest1()
{
}
virtual int GetDataSize()
{
return 32;
}
};
/*
** when CTest2 is created you would expect a buffer of 32 bytes to be allocated
** but lo and behold, you get 16, try it
**
** in c# they got it right, try the same experiment and you will get 32 allocated in CTest2
*/
public class CTest1
{
public byte[] abyData = null;
public CTest1()
{
abyData = new byte[DataSize];
}
virtual int DataSize
{
get{return 16;}
}
}
public class CTest2 : CTest1
{
override int DataSize
{
get{return 32;}
}
}
|
|
|
|
|
Vtable initiazation takes place in constructor of base class,its obvious that base class function will get called
|
|
|
|
|
Simply, C++ has a different order of construction than C# or Java. It was a design decision, not a bug.
Take a look at this article[^] for more details.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
I am in a project that aims to build a opos driver, a species of intermediary between application and opos devices that support the standard. The opos driver is divided in two parts: The Control Object(CO), that makes the interface with application and the Service Object(SO), that makes the interface with the devices. The CO makes methods calls in the SO.
My problem is the following one: The CO are ActiveX controls(ocx) and SO are dlls. I am not knowing that type of project I must create in the Visaul c++ and how do I link the CO and the SO? I need them( ocx and dll) will be invisible at runtime. I would like that somebody help about that. Somekind of help is welcome. I wait reply! Grateful! Helio
P.S.: for more information about opos standard "monroecs.com/opos.htm"
|
|
|
|
|
Friends there are two simple C++ classes Car and Engine . I am getting the following error in the function Start of class Engine
d:\Car\Car.cpp(19): error C2027: use of undefined type 'Car'
Please tell me why i am getting this error. Code is here:
class Car;
class Engine
{
public:
Engine(Car *pCar)
{
m_pCar = new Car();
}
void Start()
{
m_pCar->OnStart();
}
private:
Car *m_pCar;
};
class Car
{
public:
Car()
{
}
void OnStart()
{
}
};
Ahsan
|
|
|
|
|
you must declare class Car before using it...
precede your class Engine definition with : class Car;
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
You beat me!
Anyway, he declared the class Car before he used it. You must define the class before you try to use it however.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Sorry, forward declaration is there in my code. Please look it again
class Car;
class Engine
{
public:
Ahsan
|
|
|
|
|
Hello,
Your problem is that you did not define Car before you used it! Try the following:
class Car
{
public:
Car() {}
void OnStart() {}
};
class Engine
{
public:
Engine(Car *pCar)
{
m_pCar = new Car();
}
void Start()
{
m_pCar->OnStart();
}
private:
Car *m_pCar;
};
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Some how your Foward Declaration doesn't help.
try this:
//class Car; // Forward Declaration
class Car
{
public:
Car()
{
}
void OnStart()
{
}
};
class Engine
{
public:
Engine()
{
m_pCar = new Car();
}
void Start()
{
m_pCar->OnStart();
}
private:
Car* m_pCar;
};
Vote if help is of use.
|
|
|
|
|
If you want to have both Car and Engine classes in separate files (previous post gave solution to your problem but you have to put both classes in one file), the easiest solution is to move the code m_pCar->OnStart(); in the cpp file and include Car.h in the top of it:
In the cpp file:
void Engine::Start()<br />
{ m_pCar->OnStart(); }
But I have a little problem with your design (if you really use these classes in your project). It must be the opposite: this is the car that has an engine and not the engine that has a car
-- modified at 7:56 Tuesday 20th September, 2005
Sorry, and also move the code from your constructor in the cpp file
|
|
|
|
|
I bet you have an error reported in the constructor as well:
m_pCar = new Car();
Anyway, the problem is that you can't create instances (objects) of incomplete types. To work around this, separate member function implementations in a cpp file.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
My application is SDI Application and it has two views( i used CSplitterWnd) class mainview is derived from CListView and class logview is derived from CFormView. logview contains only one listbox, and i have a public member function DisplayInListBox();. Now the problem is, I have no way to access DisplayInListBox(); from outside(mainview class) the logview class. I cannot create an object of class logview, its constructor is protected. If i change the access specifier to public i get an assertion failure.
Can You help?
Thanks
|
|
|
|
|
Hello,
It's not allowed to create views yourself. Somewhere in your header file, you'll read: //Create from serialisation only! . You have to create the views the following way:
CRuntimeClass* pClass = RUNTIME_CLASS(CLogView);
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|