|
For example, if you have a Shape base class in a drawing program with a Draw method the Draw method will be pure virtual - each Shape will need to draw itself but there is no appropriate default behaviour.
|
|
|
|
|
thanks
one of my friend gave me the same example ..could u please give the class diagram, what u meant by exactly....and from the main function how do we call to draw different shape(say triangle or cube or rectangle)....just teh skeleton of the classes and calling methodology if u dont mind
-----------------------------
I am a beginner
|
|
|
|
|
See the message above from CPallini
|
|
|
|
|
Have a look at this extremely well authored article:
Generic Picker Dropdown Control[^]
You see a complex base class, with some virtual methods. To make different kinds of drop downs, You just have to implement some simple virtual methods, and the base class will do the heavy lifting.
It's similar to the Shapes examples that float about, but it's an actual implementation.
Give it a go, make your own picker class in the demo project.
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need cotract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
I want to distinguish between a Shutdown event and a Restart event , what should be done in achieving the same ? As , WM_QUERYENDSESSION doesnot give me any differentiation between Shutdown and Restart. Is there a way to know specifically which one of the two has been initiated ??
Regards,
Kushagra
I hate coding but I luv to develop.
|
|
|
|
|
According to the docs (WM_QUERYENDSESSION Message[^]) it is not possible.
Read the explanation of lParam .
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Actually I have seen many commercial applications that some how internally know about it ...that is why the question arises ... and If they know it ..we should also be able to device the same 
|
|
|
|
|
Somebodu please help me out in this
Kushagra
|
|
|
|
|
Kushagra Tiwari wrote: and If they know it ..we should also be able to device the same
Perhaps they are using a device driver of some sort (ie, ring 1 or 2).
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
No, it's possible : everything is possible...
For undocumented stuff, see Adv. Win32 grp (news://nntp.aioe.org/comp.os.ms-windows.programmer.win32)
(this had been posted in ~1994...)
|
|
|
|
|
Hello people!
I am a new boost user, and I am trying to implement a console for a
game, which binds console commands to functions. These functions can
come from different objects and this is why I decided to try using boost.
I am using Visual Studio 2005 + SP1.
I have something like this:
typedef boost::function1< void, std::vector<std::string>& > funcHolder;
std::map<std::string, funcHolder> commands;
void Console::addCommand(const String &command, funcHolder f)
{
std::map<String, funcHolder>::iterator t = commands.find(command);
if(t == commands.end()) commands.insert( make_pair(command, f) );
else commands[command] = f;
}
All of these things are members of a Console class. So once I added
these, I tried adding this line to the constructor:
addCommand("clear", boost::bind(&Console::clear, this);
void Console::clear( vector<std::string>& args )
{
lines.clear();
}
During compilation I get C4180 warnings. I have heard that those are due
to VS8.0 SP1 compiler bugs, so I ignore them but then I get a following
error:
Project : error PRJ0002 : Error result 1 returned from 'C:\Program
Files\Microsoft Visual Studio 8\VC\bin\cl.exe'.
Compiler basically crashes.
Any ideas what might be wrong?
I thank everyone in advance,
|
|
|
|
|
fley_fly wrote: typedef boost::function1< void, std::vector<std::string>& > funcHolder
With VS2005, you can use this syntax for boost::function - note you don't need to tell it the number of arguments - you just use function declaration syntax...
typedef boost::function< void(std::vector<std::string>&)> funcHolder;
fley_fly wrote: addCommand("clear", boost::bind(&Console::clear, this);
This line's missing a closing bracket at the end.
fley_fly wrote: void Console::addCommand(const String &command, funcHolder f)
I presume String should be std::string?
Finally - how is the function called? It will need a Boost ref wrapper[^] around the vector argument, to make sure a reference gets passed through to the function you want to call for that command.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi,
I want to set "Follow up flag" to some contact items but I am not able to find the method/property to set it.
I am using Outlook XP.
|
|
|
|
|
I have a simple code where a user moves a window and when the user releases the window, a message box is displayed.
here is my code for that.
<br />
void CFldWnd::OnLButtonDown(UINT nFlags, CPoint point)<br />
{ <br />
SendMessage(WM_NCLBUTTONDOWN, HTCAPTION);<br />
CWnd::OnLButtonDown(nFlags, point);<br />
}<br />
<br />
void CFldWnd::OnLButtonUp(UINT nFlags, CPoint point)<br />
{<br />
<br />
MessageBox("Button up"); <br />
CWnd::OnLButtonUp(nFlags, point);<br />
<br />
}<br />
the window moving part works fine but when i release the left mouse button, messagebox is not displayed. but when i double click on the window, message box is displayed.
please help!!!! thanx in advance!
|
|
|
|
|
Try listening for WM_NCLBUTTONUP, but this would trigger also when the user simply clicks somewhere in the non-client area of the window.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
If the mouse is over the window, it will receive WM_LBUTTONUP, if the mouse is outside - it will not. To overcome this situation, you need to 'SetCapture' on WM_LBUTTONDOWN and 'ReleaseCapture' on WM_LBUTTONUP...
|
|
|
|
|
TThank u 4 ur quick responses.. i tried both of them but the problem still exists.. I commented SendMessage(WM_NCLBUTTONDOWN,HTCATION); and put some variable assigning code there and both LBUTTONDOWN and LBUTTONUP triggers..
when put back SendMessage(WM_NCLBUTTONDOWN,HTCATION);, LBUTTONUP does not trigger..
i dont know wat to do..
|
|
|
|
|
The mouse up message does happen - you can check this with Spy++.
But the window moving stuff happens in response to the WM_NCLBUTTONDOWN message you've manually sent. That starts a message loop looking for mouse messages that is not the MFC message loops. It moves the window until you let go of the mouse, or press escape.
If you want your window to be movable with the mouse, a far more elegant way of doing it is responding to the WM_NCHITTEST message.
class CMyMovableDialog : public CDialog
{
...
afx_msg LRESULT OnNcHitTest(CPoint point);
...
};
...
ON_WM_NCHITTEST()
...
LRESULT CMyMovableDialog::OnNcHitTest(CPoint point)
{
return HTCAPTION;
}
I hope that helps,
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need cotract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
well, this still does not solve my problem, when i catch OnNcHitTest, i cannot even trigger the LBUTTONDOWN event.. anyway i learnt something out of your reply, thanx mate!
|
|
|
|
|
Isuru_Perera wrote: well, this still does not solve my problem
Well, I'm not sure what the problem actually is. You had a mystery of a "missing" WM_LBUTTONUP, which is now explained.
So, what's the actual problem that you're trying to solve?
Iain,
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need cotract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
I get it,too.But when i process wm_syscommand in winproc , it run away,hope help.
if(message==WM_SYSCOMMAND)
{
return 0;
}
return ViewItem::WindowProc(message, wParam, lParam);
|
|
|
|
|
hi,
i got 1 propertysheet which contain 3 propertypage. I want to make it when program start,it will auto visually click on the radio button for the 1st page.
I had set the OnRadioDirection1() function in my dialog OnInitDialog() and also onSetActive() .But still cannot work.Am i miss up something?
modified on Thursday, September 17, 2009 9:43 PM
|
|
|
|
|
If you have one int member variable for the radio button group, set it's value in the page's OnInitDialog() method. Otherwise, if you have a CButton object for each radio button in the group, call the SetCheck(BST_CHECKED) method.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
yes. i had set it into
<pre>
static_cast<cbutton*>(GetDlgItem(IDC_TEST))->SetCheck(BST_CHECKED);
OnClick(IDC_TEST);
but still nothing happen. i also had set it for onSetActive().
But when the user "click" to radio button. It will perform well.
|
|
|
|
|
first, declare as CButton type member variable in your .h file.
ex : CButton m_RadioBtn1;
after that, in InitDialog, call SetCheck() function and pass TRUE or 1
as argument.
m_RadioBtn1.SetCheck(1);
it should work.
Regards,
Srinivas
|
|
|
|