|
Hello,
Is there a way to change the color of the progress bar in a CProgressCtrl for each separate instance? I've a dialog with several of these and would like their color to give additional information to the user.
Thanks!
JennyP
|
|
|
|
|
JennyP wrote:
Hello,
Hey, JennyP!
Check out the Progress Controls section of CP, i think you might just find what you're looking for...
---
Shog9
If I could sleep forever, I could forget about everything...
|
|
|
|
|
First the RTTI question.
How is it possible to create an object without using MFC's CObject CreateObject() ...???
I checked out the source code (MFC) and could only determine CreateObject returns a Function*...???
Could someone please explain how I can accomplish similar code using plain old platform independent C++...??? Can I do this using RTTI...???
Second question.
I have asked this question before, but obviously didn't get it so i'll ask again...
How does MFC wrap a Windows window HWND with a class and avoid using global or static functions...???
Are they fancy MACROS...? if so where do I find these...???
Thanx!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
for the second question:
you can have a look for winamp3.0 client src; this is free. u can get it form it's site, just use a defwindowproc
and in this function use getwindowlong to get extra data,
then we can do all the things we want.
|
|
|
|
|
ttzzgg_80713 wrote:
just use a defwindowproc
and in this function use getwindowlong to get extra data,
then we can do all the things we want.
Is that how the MFC framework implements this...?
How would you handle messages, would you hook the object...?
Thanx
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hockey wrote:
How is it possible to create an object without using MFC's CObject CreateObject()...???
Sure. Just use 'new CYourObject' or declare CYourObject as local/global variable. CreateObject stuff is needed, because framework needs to create objects of 'unknown' type. For example, if you have doc/view app, MFC creates CYourDoc and CYourView for you, but doesn't have full knowledge about these classes. You're just passing the RUNTIME_CLASS which, among other things, has the CreateObject method.
Hockey wrote:
I checked out the source code (MFC) and could only determine CreateObject returns a Function*...???
No, CRuntimeClass::CreateObject returns CObject *. There's also m_pfnCreateObject data member which has an address to function which is called by CreateObject.
Tomasz Sowinski -- http://www.shooltz.com
What is "scratch" and why can everything be made from it?
|
|
|
|
|
Tomasz Sowinski wrote:
Sure. Just use 'new CYourObject'
This i knew...but I want to replicate MFC CObjects ability to create objects at runtime using CreateObject ...?
Like the DOC/VIEW in MFC, but I can't use MFC because I want to make my code cross platform...???
I did a little more reading an it turns out this isn't accomplished via RTTI...so i'm lost as to where to look...
I serach on google for objects dynamically and everything returns
CObject* pObject = new CObject;
Which is not exactly what I wanted to know...
I what I want to accomplish not dynamic creation...?
Cheers
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hockey wrote:
I did a little more reading an it turns out this isn't accomplished via RTTI...
Well, it isn't accomplished with C++ RTTI (dynamic_cast, typeid, typeinfo). MFC has its own RTTI invented before VC had support for C++ RTTI.
Hockey wrote:
I what I want to accomplish not dynamic creation...?
I'm not sure what do you mean here. If you want to get universal method for creating objects based on class name, you may find this article useful: http://www.microsoft.com/msj/defaulttop.asp?page=/msj/archive/S385.htm[^]
The article is titled 'Roll Your Own Persistence Implementations to Go Beyond the MFC Frontier', but dynamic creation is the base for serialization. Any reading which takes on 'factory' design pattern may also give you additional understanding of this subject.
Tomasz Sowinski -- http://www.shooltz.com
What is "scratch" and why can everything be made from it?
|
|
|
|
|
Tomasz Sowinski wrote:
I'm not sure what do you mean here
MFC DOC/VIEW uses a form of dynamic creation when instantiating the CView/CDoc derived classes however the dynamic creation is based on the new/delete operators...???
It uses a different method in creating objects dynamically...??
It is this method I wish to learn about...not the plain jane new and delete methods...
Thanx for the URL...i'll check it out...
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hockey wrote:
MFC DOC/VIEW uses a form of dynamic creation when instantiating the CView/CDoc derived classes however the dynamic creation is based on the new/delete operators...???
In the MFC slang, 'dynamic creation' is creation of object on heap given a class name (class name as a string) at runtime. However, deep inside, it always boils down to some 'new CYourObject' in your code. The MFC magic works with macros. Basically, if you mark CYourObject with DECLARE_DYNCREATE/IMPLEMENT_DYNCREATE will have corresponding function which calls 'new CYourObject'. This function (along with class name) is hooked into list of available factory functions. Implementation of factory function is done for you by - guess what - IMPLEMENT_DYNCREATE.
So, you can look at the 'dynamic creation' problem like this: having a string with class name like 'CYourObject', you have to find a function which will call 'new CYourObject'.
Tomasz Sowinski -- http://www.shooltz.com
What is "scratch" and why can everything be made from it?
|
|
|
|
|
q1: Are you talking about dynamically creating an object at runtime?
q2. I think the answer to this is in MFC's Handle Maps. Have a look at CWnd::FromHandle()
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
Neville Franks wrote:
q1: Are you talking about dynamically creating an object at runtime?
Yes I think...but NOT using new/delete
using something similar to MFC CObject but I can't use this method because I want to keep my code cross platform.
RUNTIME_CLASS macro takes a class and dynamically creates objects...I need this kinda functionality
But without MFC...
How is this accomplished...???
Thanx
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Do a search on Google for stuff like "RTTI dynamic objects/creation", "C++ Persistance" etc. Also see what the various cross-platform libraries do to handle this.
It might be a good idea to post another question here stating what you are trying to achieve and asking people how they would go about. Dynamic creation of objects isn't something you need to do very often.
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
I want to write a wizard like "IE-->Internet connect wizard ",My method is that :
if (InsDWFirstDlg.DoModal ()==IDOK)
{
if (InsDWSecondDlg.DoModal ()==IDOK )
{
if (InsDWThirdDlg.DoModal ()==IDOK )
{
InsDWFourthDlg.DoModal ();
}
}
}
I find that there is twinkle
Do you have good advice or other good method ?
|
|
|
|
|
A wizard is just a property sheet with the wizard style set. Check out my hotfix checker in the System section, that's a wizard and should be a good starting point.
--Mike--
Just released - RightClick-Encrypt v1.3 - Adds fast & easy file encryption to Explorer
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
thank you for your replaying .
I see it at once
|
|
|
|
|
I just got a copy of Visual Studio.net. Since I am new to programming I thought I would try building an app I have done in 6.0 so I could get a feel for the new lay out. I created a new class "CLine" for my drawing app and when I try adding functions like "CLine (CDC* pDC)" I get a message saying it's not a valid name. In 6.0 it works perfectly. Is there something I might be doing wrong? Any assistance and guidance would really be appreciated.
Thanks
|
|
|
|
|
can any body tell how to click a button using sedmessage method?
i did not know the last three parameters execpt HWND
plz explain last three parameters ?
r00d0034@yahoo.com
|
|
|
|
|
To reiterate a reply I made here:
The SendMessage function sends a message to the window procedure of a window. It doesn't return until the window fully processes the message. You should never send messages to windows of other applications because it is possible that the application may be hung and SendMessage will never return.
This is the prototype of SendMessage.
LRESULT SendMessage(
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);
The hwnd parameter, as you know, is the handle to a window to which to send a message. The Msg parameter identifies what type of message to send, and the wParam and lParam parameters specify additional information about the message.
The system and applications communicate to windows via messages. Besides SendMessage, there is the PostMessage function, which sends a message to a window and returns immediately, making it ideal for communicating with windows in other applications.
To answer the second question, to programmatically simulate a button click, make the following call:
SendMessage(hwndBtn,BM_CLICK,0,0);
Peter O.
|
|
|
|
|
if the statement "using namespace" could be used to shorten the name to access to a certain function/variable.
Is there a similiar method to access to base class functions/variables in inheritance class functions , ie. to remove the front portion "base_class::" from "base_Class::base_class_func"?
|
|
|
|
|
normally you wouldnt need to explicitly qualify the base class variables and functions, unless they are static....
could you post some code?
|
|
|
|
|
You are right! I just tried to remove the front portions of it.
Before
class classOne {
public:
void functionOne()
{}
};
class classTwo: public classOne {
public:
void functionTwo()
{
classOne::functionOne();
}
};
I have removed the classOne:: from the function, and it works perfectly now. I was having some problems implementing class initially, that's why I have kept the front portion.
Thanks a million!
|
|
|
|
|
First of all Thanks for reading this post.
In my project I have a Access databse. I want to take a backup of the database file, when the user wants to , from the application.And restore it whenever user wants to.
The database file is in the current directory.
May be by a function OnBackup()
In this function i want to implement a mechanism, by which the software gets the pointer to the file (mdb file) and then save this file to his/her desired target.
I understand that this can be one by getting pointer to the file by using GetFile() function and by saving it using OnSaveDocument() function.
But then how to invoke OnFileSaveAs kind of diaolog box?
Please provide the complete detail how to do it. Or may be some source code.
Or else , suggest me some other beter mechanism to do backup/restore of a file.
|
|
|
|
|
For the file save as dialog , look up the CFileDialog class of MFC. In the constructor of the dialog box, you can specify it as an open or save dialog box.
Then you can use other win api function / or file classes for copying the mdb file.
|
|
|
|
|
Helllllo people .. i'm new in vc++ but i want to learn ... now i have a mfc mdi wizard with base class CFormView and i want to put on a new document something but in dynamic mode with Create function ... something like a button or a static text ... the problem is that i don't know where and how to do this .. i have tryed and the best result is that the button was there for a moment just and then gone .. i don't know where ... my last tryings are
CMDIChildWnd * bb=((CMDIFrameWnd*)AfxGetMainWnd())->MDIGetActive();
CButton info1;
CRect rct(50,50,200,200);
info1.Create("Info1",WS_CHILD,rct,bb,130);
info1.SetWindowText("Pleease !!!");
please help me ... and forgive my english
|
|
|
|