|
u can use PreTranslateMessage(MSG* pMsg) like this
BOOL [ur class name]::PreTranslateMessage(MSG* pMsg)
{
switch (pMsg->message)
{
case WM_LBUTTONDBLCLK:
pMsg->message = WM_LBUTTONDOWN;
break;
}
return 0;
}
|
|
|
|
|
Just add both a single-click handler and a double-click handler to the button, and do nothing for a double click.
|
|
|
|
|
or simply call the single-click handler from the double-click handler
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
He said he wants it to do nothing on a double click.
|
|
|
|
|
That is fine if that is what he wants. But I was thinking of the user who will start rapidly clicking the button only to find that every other click does not work as expected.
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
you can use Pretranslatemessage method
BOOL <your class="" name="">::PreTranslateMessage(MSG* pMsg)
{
switch (pMsg->message)
{
case WM_LBUTTONDBLCLK:
pMsg->message = WM_LBUTTONDOWN;
break;
}
return 0;
}
or
u can map lbuttondblclk and then post a message of WM_LBUTTONDOWN(best for activex button controls)
|
|
|
|
|
How about simply removing the double click style from the window's class?
BOOL YourButtonClass::PreCreateWindow(CREATESTRUCT &cs)
{
WNDCLASS wndClass = { 0 };
GetClassInfo(NULL, cs.lpszClass, &wndClass);
wndClass.style &= ~CS_DBLCLKS;
wndClass.lpszClassName = _T("BUTTON-DBLCLKS");
if (AfxRegisterClass(&wndClass))
{
cs.lpszClass = wndClass.lpszClassName;
}
return __super::PreCreateWindow(cs);
}
|
|
|
|
|
Hello All
I am building my project Visual Studio.Net 2003. It is a big project that inturn consists of 83 small projects.....during the compilation of some project i am getting the error:
Project : error PRJ0019: A tool returned an error code: "Performing Pre-Build Event..."
Please suggest how this can be fixed.
waiting for suggestions.
|
|
|
|
|
In the project's property pages check out Build Events->Pre-build event and see what might be causing the problem.
|
|
|
|
|
How to place a button control over a picture control or some other control
|
|
|
|
|
You mean programatically? Well, you can make the picture control the parent of the button or you can use SetWindowPos to setup a Z-Order in which the button is over the picture control. Also if you choose to do the later, have the WS_CLIPSIBLINGS style set on your picture control.
|
|
|
|
|
The solution was given in your previous post. Dint you try that?
|
|
|
|
|
hi, I am using VS2002 for a client
need to have a round corner combobox VC++/MFC
if Anyone can help?
Thanks in Advance
|
|
|
|
|
This article[^] may help.
Regards,
Sandip.
|
|
|
|
|
Lots of thanks
|
|
|
|
|
Very interesting article; thanks for the link!
|
|
|
|
|
Hi,
I have created an SDI application and created a new class "CMyClass" that is derived from CObject. So I have included the header file "stdafx.h/afx.h " in CMyClass.h. I am trying to create an object of CMyClass in CMyDoc.h and for this purpose I have to include MyClass.h.When I do so and compile I am getting the "warning C4182: #include nesting level is 360 deep; possible infinite recursion" and "fatal error C1076: compiler limit : internal heap limit reached; use /Zm to specify a higher limit".
In order to solve the problem , I have maximum tried to minimize the inclusion of header files. But couldn't.
How to solve this problem?
Thanks in advance.
Taruni
|
|
|
|
|
Taruni wrote: I am trying to create an object of CMyClass in CMyDoc.h and for this purpose I have to include MyClass.h
Possibly you're including MyClass.h in MyDoc.h and viceversa.
you may use
#pragma once
at the top of you header files to prevent multiple inclusion.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thank you Pallini.
#program once is already there in all the header files except in MyClass.h.When I tried to include, I am getting the errors
'CMyClass' : is not a class or namespace name
syntax error : identifier 'CMyClass'
syntax error : missing ';' before '}'
syntax error : missing ';' before '}'
.
.
.
.
.
fatal error C1003: error count exceeds 100; stopping compilation
Taruni
|
|
|
|
|
What is the source file the error is given for?
Have you included MyClass.h in that source file?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
In adding to the generated classes for SDI application (all the .h files however has #pragma once statements and all .cpp files have #include "stdafx.h" statements) , I am writing a serializable class(CMyclass) that is derived from CObject. In the MyClass.h file, I am including "stdafx.h" (as the header file for CObject and others) file and in the MyClass.cpp file, I am including "MyClass.h" file .
Upto this point the application compiles nicely. But whenever I include "MyClass.h" in "MyTrialDoc.h" (in order to create a global object of CMyClass) I get that the compiler limit.When I tried to include #pragma once , I got all the errors which I have mentioned in my previous post.
Taruni
|
|
|
|
|
The compiler reports the source file under compilation when the error occurs. This piece of info is important, please post it.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
"The compiler reports the source file under compilation when the error occurs" - Pallini are you speaking of "'CMyClass' : is not a class or namespace name" error?
Taruni
|
|
|
|
|
Instead of placing #include <stdafx.h> in your CMyClass.h, put is as the first line in CMyClass.cpp. That will most likely resolve the problem.
Good luck.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
Thank you krmed.
I have even tried that. When I tried to include "stdafx.h" in .cpp files, I am getting the error "error C2504: 'CObject' : base class undefined". As the other alternatives I have even tried including "afx.h" and "afxwin.h" . But in vain.
Taruni
|
|
|
|