|
You may put a breakpoint in the implementation of CWnd::OnToolHitTest (it's inside [Visual Studio Install directory]\VC\atlmfc\src\mfc\wincore.cpp) and see if you can determine whether it's returning a hit for those controls, and if not, why.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Hi,
i've started working on VC++ recently and i'm developing an application in which the menu items in the main window has to be changed when a button on a dialog is pressed. i tried LoadMenu and SetMenu but the new mwnu getz loaded on the dialogbox itself instead on the main window.i'm sure that there must be a way to do this.could anyone help me in this please.thankyou.
rajeev
|
|
|
|
|
Have the button do this:
AfxGetMainWnd()->SetMenu(*MyMenu);
|
|
|
|
|
Hi!
in a Subclassed Cedit Control, I issued a SetWindowText() function many times in my program..
I traced my program, Now In the first call to SetWindowText(), the function succeeds and it sets the text .. Now on the second call the function asserts, and upon tracing, The ::IsWindow(hwndofCedit) returns FALSE.
My question when does an HWND becomes invalid? aside from window destruction?.. My Cedit's parent is not a CDialog, would that be an issue?
"geez i cracked myself off.."
|
|
|
|
|
A HWND becomes invalid when the windows is destroyed.
Sorry, but there is no 'aside', either the window exist or it does not. I will note however that the windows destruction has nothing to do with wether or not the destructor for a CWnd object is called. The handle belongs to the system and not the code using it. Therefore, you must be telling the system to destroy the window.
And no: the parent of the window is not an issue, unless the parent window was closed, in which case, all its child windows would also be closed (destroyed).
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
But why is it that when I test ::IsValidWindow(CEdit::GetSafeHwnd()), it returns FALSE in the middle of my program, and I have not destroyed the CEdit yet..
I have seen in some articles that there are some events that makes the window handles invalid..
|
|
|
|
|
There are only two things that can happen here, if IsValidWindow returns TRUE and then soon after returns false, either the window is destroyed or the value that CEdit::GetSafeHwnd() returns is now wrong. This can happen if the CWnd data structure gets trashed. Look at the m_hWnd value and see if it changes.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
I can tell you that the window was not destroyed.. so definiteyly my problem is GetSafeHWnd() changing to a wrong value.. My question is how did it changed value? how did the window structure get trashed? I Didn't do anything to it... I just set its text..
|
|
|
|
|
Hello...
I known only two situations where a window handle is invalid.
1. window isn't created
2. window destroyed
It's possible that window creation or subclassing failed...
|
|
|
|
|
Hi All!!!
hehe.. you know what, i found out the problem of my HWND being invalid... it turns out Im looking into a different CMainFrame pointer that holds the control bar that holds the CEdit.. I have implemented 2 Doc/View architectures in my program.. So I have 2 frames, 1 Mainframe and 1 Framewnd(inside another control bar)... It turns out i cast the Framewnd which has no CEdit variable, to CMainFrame.. So im looking in the framewnd which has no CEdit at all, not created.. So that solves my problem, I just got the pointer to the actual CMainframe which has the CEdit...
tnx for the replies!!
Maverick
"you can be my wingman anytime.."
|
|
|
|
|
I have deeply in search about Nikolai Teofilov's article called <<2D Graph ActiveX Control>> and codes here,but I can't use it because it is based on vc6.0.
I wanna know if some possess this kind of code of vc++.net!
And also I am glad that u can give me some advice on dynamic curve display!
thanks,sorry about my pool English!!!
|
|
|
|
|
I have read that article which I believe comes with the ActiveX control precompiled which you can use as is (ActiveX is supposed to be programming language independent). If you want to compile it your self, then you may need to modify the code (for your compiler).
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
looking to use a date time object like COleDateTime in a win32 dll.
What can i use?
Intellisense seems to work fine when i use COleDateTime and i have access to all the methods but when i compile, i get an error:
(33): error C2065: 'COleDateTime' : undeclared identifier
Any guidnce is appreciated...
Thanks
|
|
|
|
|
what i would like to do is get the current system date and time, time including the milliseconds
|
|
|
|
|
|
you have to included ATLComTime.h for using COleDateTime.
you can also try GetSystemTime() to obtain systme time.
Saurabh
|
|
|
|
|
saurgarg wrote:
you have to included ATLComTime.h for using COleDateTime.
afxdisp.h is needed for this MFC class.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Looking for the correct syntax to do the following.
I have a C++ dialog based application.
I would like to code a button to have the following functionality when pressed.
1. Launch a video player , like quicktime or mediaplayer
2. Play a video clip that i will supply.
Anyone know the syntax for this in C++ ?
|
|
|
|
|
Try here.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Does anyone know of a reliable formula that returns a text color that appropriately contrasts a background color? Even something as coarse as black or white will suffice - a la:
COLORREF getTextColor
(COLORREF rgbBkgColor)
{
if (...)
return (RGB (0, 0, 0));
return (RGB (255, 255, 255));
} Unfortunately the standard brightness formula doesn't appear to be accurate for all colors.
int nBrightness = (GetRValue (rgbBkg) * 299 +
GetGValue (rgbBkg) * 587 +
GetBValue (rgbBkg) * 114) / 1000;
Thanks,
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
well try this :
// r = red
// g = green
// b = blue
int i = 0;
if((r > b)&&(r > g))i = 1; // red is primary
if((g > r)&&(g > b))i = 2; // green is primary
if((b > r)&&(b > g))i = 3; // blue is primary
switch(i)
{
case 1:
SetColor(0,255,255);
break;
// and so on
}
// ofcourse there is other combinations, just think of them and define their contrast
CRPG, FRPG, Oblivion Fan
Hater of Counter Strike ( i hate it soo much damn it );
|
|
|
|
|
Unfortunately this doesn't work too well. I ended up using a modified version of the brightness algorithm (see my later post).
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
Have you tried this: rgbBkgColor = ~rgbBkgColor;
You may not like the results, but it should work. Your only other (reasonable) choice would be to let the user decide (better), but that is not always possible.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Unfortunately this doesn't work too well. I ended up using a modified version of the brightness algorithm (see my later post).
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
I ended up using a modified version of the brightness algorithm.
COLORREF CDlgWeatherMate::getTextColor
(COLORREF rgbBkgColor)
{
COLORREF rgbText = RGB (255, 255, 255);
int nRed = GetRValue (rgbBkgColor);
int nGreen = GetGValue (rgbBkgColor);
int nBlue = GetBValue (rgbBkgColor);
int nBrightness = (nRed*299 + nGreen*587 + nBlue*114) / 1000;
if (nBrightness > 150)
rgbText = RGB (0, 0, 0);
if (rgbText == RGB (255, 255, 255)) {
if ((nRed == 0) && (nBlue == 0) && (nGreen > 153))
rgbText = RGB (0, 0, 0);
}
return (rgbText);
} /ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|