|
Hi all,
Could anybody help me to customize a combo box?
I would like change the appearance of the button that used to dropdown list.
Thank you.
- NS -
|
|
|
|
|
|
Thank you...
It's fine. I could manage color for list box and edit box in the combo. But how could I change the selection color? Also the scroll bar should be customized.
- NS -
|
|
|
|
|
If i have a base class and a derived class the
destrutor of the base class is not virtual & i
use a Base ptr to point to Derived Object.
An error occures and the base destructor is not called .Why??
class Base<br />
{<br />
public:<br />
Base() {<br />
cout << "Constructor: Base" << endl;<br />
}<br />
<br />
~Base(){<br />
cout << "Destructor : Base" << endl;<br />
}<br />
};<br />
<br />
<br />
<br />
class temp<br />
{<br />
public:<br />
temp() {<br />
cout << "Constructor: temp" << endl;<br />
}<br />
<br />
~temp(){<br />
cout << "Destructor : temp" << endl;<br />
}<br />
};<br />
<br />
<br />
<br />
class Derived: public Base ,virtual temp<br />
{<br />
public:<br />
Derived(){ <br />
cout << "Constructor: Derived" << endl;<br />
}<br />
<br />
~Derived(){<br />
cout << "Destructor : Derived" << endl;<br />
}<br />
};<br />
<br />
<br />
int main(void)<br />
{<br />
Base *Var = new Base();<br />
delete Var;<br />
return 0;<br />
}
Vikas Amin
Embin Technology
Bombay
|
|
|
|
|
What error is generated ? Please, when you have errors, crashes and things like try to be as complete as possible. This will help people to understand better your problem.
vikas amin wrote: i
use a Base ptr to point to Derived Object
It is not the case in your sample code. In your code, you just use the base class.
vikas amin wrote: class Derived: public Base ,virtual temp
Also, what has this virutal temp to do there ?
If you are using a base pointer that has been allocated as an derived class (Base* ptr = new Derived; ), if you don't specify that your destructor is virtual, then only the destructor of your base class will be called thus this may result in memory leaks (and other problem if you have specific clean-up code in the destructor of your Derived class)
|
|
|
|
|
Cedric Moonen:
What error is generated ? Please, when you have errors, crashes and things like try to be as complete as possible. This will help people to understand better your problem.
Ok will try to take care from next time , post the error also with the code.
thanx
Vikas Amin
Embin Technology
Bombay
|
|
|
|
|
use a Base ptr to point to Derived Object
so when deived class is instantiated,first base class constuctor will be called then the derived.llarly when the memory allocated to derived object gets cleaned up the reverse should takes place first the destructor of derived must be called and then base destructor.
so if cleaning takes place via base pointer the destructor must be made virtual.
but i suggest u to always make base destructor virtual if u want to derive class form the base class
never say die
|
|
|
|
|
I am creating the installer package for MFC app with InstallShield. Now I want while installing the user should not be able to select the subfeatures twice in the Customed installation. He should be able to select the sub feature only once. for the second time he will not be allowed. How can i do that?
|
|
|
|
|
Hi
Im just learning how to wrap a window procedure and i am following this tutorial from stromcode.
I am wondering why would I have to create an object of the class first and then store it as pointer variable (Win32WrapperClass* pWnd)?
Is there a reason why this has to be done, because i thought that if i create a Win32WrapperClass object now it would have no relation to the Win32WrapperClass i would create in my main.cpp
<br />
<br />
LRESULT CALLBACK Win32WrapperClass::stWinProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)<br />
{<br />
<br />
Win32WrapperClass* pWnd;<br />
<br />
if (uMsg == WM_NCCREATE) {<br />
SetWindowLong(hWnd, GWL_USERDATA, (long)((LPCREATESTRUCT(lParam))->lpCreateParams));<br />
}<br />
<br />
pWnd = (Win32WrapperClass *)GetWindowLong(hWnd, GWL_USERDATA);<br />
<br />
if (pWnd) return pWnd->WinProc(hWnd, uMsg, wParam, lParam);<br />
else return DefWindowProc(hWnd, uMsg, wParam, lParam);<br />
any help on this would be great
cheers
|
|
|
|
|
Doing so allows you to write object oriented code and at runtime can easily manage the state of the window because you can always retreive the object associated with the window using the GWL_USERDATA given the window handle.
Vipin - MVP
|
|
|
|
|
It is a little bit tricky to explain. First important point: the window procedure has to be static because static member functions and standard member functions behave differently (and don't have the same prototype). Standard member functions are kind of 'attached' to an instance of your class (so when they are called they 'know' to which instance they belong). In fact this is done by passing an additional parameter to your function, which the this parameter of the instance (and thus the pointer to the instance). This is done implicitely and the user doesn't know about it (it's hidden).
Now if you take a static member function, the behavior is different: for a static member function, it is shared among all instances of the class and thus, doesn't belong to any particular instance of the class. This has two consequences: first, there is no need for the implicit 'this' parameter (because the function doesn't blong to an instance) and second, the function doesn't have access to data from a particular instance: in a static function, you cannot access non-static member, you can only access to static member variables and functions (which are then shared among all instances).
For the windows procedure, it accept only a certain type of functions prototypes which are not member functions, thus the only way to have it in your class is to declare it static. The consequence is that it doesn't which instance it belongs to, so the need to 'save' first the this parameter associated with the specific window handle. This will allow you to get the 'this' parameter later and to be able to call the non-static window procedure of a particular instance.
Hope this helps, if you need some more precisions, don't hesitate to ask
|
|
|
|
|
Hi,
I am creating one mdi application, which has say 5 forms(like employee management, leave management, etc.). these forms are derived from CFormView. What i want is if user clicks one of 5 menus the corresponding form should be shown as child window. I want know how to create an instance for these forms. How to make this for as a child window and how to show it? that is my problem.
|
|
|
|
|
Hi,
You should create dialogs at runtime and then show them in menu command handlers.
Basically it will be like this:-
CDialog *pDlg = new CDialog;
pDlg->Create(id,...)
Then you can show or hide them using
pdlg->ShowWindow(...)
There would be samples here in codeproject to get you started.
Microsoft - MVP
|
|
|
|
|
But I want it as MDI child window. How to do it?
|
|
|
|
|
Even if i have only one formview, how to show this view say when the user click a menu? (I mean other than FileNew menu). And this view should have only one instance.
-- modified at 11:50 Tuesday 24th January, 2006
|
|
|
|
|
Hello All,
i need help about how i implement a TabView(e.g. in an application) to use property sheets like the time site.
It would be a great help for me if anyone has an example.
Sorry for my bad english.
|
|
|
|
|
Hi All,
I would like to develop a Remote Task Manager utility, which reads the Tasks running on a remote machine(s). Does anybody give me a hint, how it can be done in C++/MFC.
Thanks in Advance
Regards,
Satya
|
|
|
|
|
Hi,
You can implement this using tool-help library... For more information search MSDN with "tool-help Library". Rest is sockets.
Hope this will help you.
|
|
|
|
|
Try this:
http://www.codeproject.com/internet/RemoteAdmin.asp
|
|
|
|
|
Thanks Guys )
|
|
|
|
|
I am making an application for Pocket PC using dialog based MFC on embedded VC++.
I try to attach an application like Word, Excel on dialog.
I used "SetParent" to attach the application on dialog.
The code is like this.
::SetParent(dlg.m_hSWnd, m_hWnd);
"dlg.m_hSWnd" is the handle of application that I want to attach on dialog.
"m_hWnd" is the handle of dialog.
Actually, applications are shown on dialog well.
However, it is shown without command bar that the application originally has.
What I hope to know is how to show the command bar.
If you know something about this kind of problem, help me please..
this code is what I tried
CDlgSelect dlg;
if ( IDOK == dlg.DoModal() )
{
::SetParent(dlg.m_hSWnd, m_hWnd);
CMenu *a=CMenu::FromHandle(dlg.m_hSMenu);
SetMenu( a );
::CommandBar_Show(dlg.m_hSWnd, true);
::SetForegroundWindow(dlg.m_hSWnd);
}
-- modified at 5:55 Tuesday 24th January, 2006
|
|
|
|
|
I'm not sure it's 100% relevant, but you could search MSDN for "dsoframer". Perhaps that will give you some ideas.
Mike Stephenson
|
|
|
|
|
hi,
i was stuck up in the project where a string is to be supplied to the notepad so that it can be saved anywhere else,
can anyone who knows the answer help me,
appreciation in advance,
paul
-- modified at 5:44 Tuesday 24th January, 2006
|
|
|
|
|
|