|
Please excuse this crude example...
******* App Window *****
* *
* * Group Box ******** *
* * * *
* * **************** * *
* * * My Control * * *
* * **************** * *
* * * *
* ******************** *
* *
************************
My control and the group box both have the application window as their parent.
I cannot drag a file to my control as windows thinks the group box is the top window when the mouse moves over it. I have proved this using a global hook and calling WindowFromPoint() to determine the window under the mouse as you move the cursor around the screen. Also if I remove the group box, my control receives notification taht a file has been dropped onto it. My question is: Should my control be a child of the group box, or is there another way around the problem to make windows think my control is on top?
Thanks for any help you can provide.
Steve.
|
|
|
|
|
Check your tab order - your control should be after the group box in the tab order.
--Mike--
http://home.inreach.com/mdunn/
A recent survey reports that 1/4 of all internet users in England surf for porn.
The other 3/4 just didn't want to admit it.
|
|
|
|
|
I beg to differ. I had the same problem and I fixed it by placing my control before the group box in the tab order.
---
Multitasking: Screwing up several things at once.
|
|
|
|
|
Thanks very much for replying I have got it working now. According to spy the window order before was:
App Window
Group Box
My Control
After a cal to SetWindowPos () to put my window on top the window order is now:
App Window
My Control
Group Box
|
|
|
|
|
I know this sounds like a stupid question...
I need to convert a double to a string to output it with SetWindowText().
I know how to get the string into the double (using atof() ), is there a better way to do it though?
Thanks... i'm just getting into C++ and windows programing from Perl and PHP and would appriciate any help.
|
|
|
|
|
strDouble.Format(_T("%2f"), dDouble);
This will work just fine, it will give you a precision of 2. Replace the 2 with however many numbers after the decimal you want it to be precise to.
Bret Faller
Odyssey Computing, Inc.
|
|
|
|
|
Actually I believe you need to use %.2f to get a precision of 2...what you have will produce a string that containts a number with 2 overall digits
-Jesse
|
|
|
|
|
Actually I believe you need to use %.2f to get a precision of 2...what you have will produce a string that containts a number with 2 overall digits.
-Jesse
|
|
|
|
|
To get a double into a string:
double num = 10.0;
CString str;
str.Format("%d", num);
something.SetWindowText(str);
The syntax for Format probably looks really ugly if you've never programmed in C, but that %d grabs a double from after the comma and sticks it in there as a string. enjoy
Jake
|
|
|
|
|
Thanks... I do have some C experience, just not enough to know any of the prinf and formatting stuff.
|
|
|
|
|
How can you specify the accuracy (places after the decimal place) with str.Format()?
Thanks
Greg
|
|
|
|
|
you could eaven if you dont want to use the CString class
char buf[32];
double d = 123;
wsprintf(buf, "%d", d);
|
|
|
|
|
The examples so far have been wrong, %d is the format string for ints. Use %lf ("long float") for doubles.
--Mike--
http://home.inreach.com/mdunn/
A recent survey reports that 1/4 of all internet users in England surf for porn.
The other 3/4 just didn't want to admit it.
|
|
|
|
|
Hi, I'm wan't to get the color windows is using at run time. Every object in windows use these color, to draw the back ground of a view, the color of the frame, text, title bar, button color etc. So it's the color that we set in the control panel\Display\Appearance.
I wan't to access these color to let my application to be like any other window program, so... someone can tell me what familly of function or witch class or library. It must be simple, I can think something else that simple...
thanks
Remi Morin
Rmorin@Operamail.com
Remi.Morin@Lyrtech.com
|
|
|
|
|
I think you want to look at the docs for GetSysColor.
|
|
|
|
|
Thank you!!! It is what I'm seraching for!!!
Remi Morin
Rmorin@Operamail.com
Remi.Morin@Lyrtech.com
Don't forget that some miracle come from hell
|
|
|
|
|
I think what you may be looking for is
GetSysColor(COLOR_BTNFACE) which will return the COLORREF for the buttons face colour.
If you have a look at the help topic for that API it will list the other colours you retrieve with it.
Happy programming!!
|
|
|
|
|
Microsofts documentation says that this function returns 0 (AVIERR_OK)if successful, or an error otherwise. I'm trying to figure out why this paste operation fails in my code, but I can't find anything out about the errors this function returns or what causes them. Any ideas?
Thanks,
Jake
|
|
|
|
|
After my CMainFrame calls goes through OnCreate(), I need to display a dialog window. Where can I do that from so that the main frame is completely loaded before I show this window?
|
|
|
|
|
How about after the UpdateWindow call in your InitInstance?
|
|
|
|
|
Hello there,
I have an ActiveX control that contains a TreeCtrl. However, I don't seem to be able to catch the Backspace Key event. I can catch DELETE or ESCAPE, but even when I watch the action using SPY++, there appears to be no messages sent to the TreeCtrl when the backspace key is pressed.
Could anyone enlighten me on this problem?
thanks
|
|
|
|
|
We have a DebugBreak call at the start of one of our VC++ programs. When it is hit it brings up a dialog box telling you so.
Only problem is, on one machine the dialog box has an Ok and Cancel button. On another machine only the Ok button is displayed. No Cancel button - no debugger.
Both machines are nearly identical in hardware and software. NT 4, Visual C++, Visual Basic, etc. We are looking at environment settings, project settings, etc.
Any ideas on where the cancel button is?
Thanks,
David
"I don't have a catchy saying to put here yet."
|
|
|
|
|
This is from Enabling Just-in-Time (JIT) Debugging
Editing the Registry
The Just-in-Time debugging settings are stored in the registry, under \\HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\AeDebug\. The two relevant keys in this directory are Debugger and Auto.
The Debugger key's value shows the name of the debugger specified to analyze application errors. The Auto key is either zero or one.
When an unhandled application error occurs, Windows checks to see if the Debugger and Auto keys exist.
If the Auto key equals zero and the Debugger value contains the name of a valid debugger (such as WinDbg or NTSD), the message box will have two buttons: OK and Cancel. If the OK button is pressed, the application is terminated. If the Cancel button is pressed, the debugger specified in the Debugger key is started.
If the Auto key equals zero, but the Debugger key value is empty, the message box will have only an OK button and no debugger will start.
If the Auto key equals one, no message box appears. The debugger referred to in the Debugger key is automatically started.
|
|
|
|
|
That worked great! Many thanks. Did some searching on MSDN etc. and no luck. I figured somebody out in Codeproject land would know (and in 6 minutes!).
Thanks Again!
David
|
|
|
|
|
We never sleep!
Actually, I just realized that the article quoted is not in the MSDN help - I found it in the help file under Debugging Tools (aka WinDbg) - installed from the platform SDK, I think.
If you've got the MSDN CDs, might want to check it out.
And thanks for the thanks!
|
|
|
|