|
John,
When you ask for help it is very important to use the same verbiage as your peers and be very detailed.
john5632 wrote: When I Destroy that view using Back button, control does not come back from
DestroyWindow() function.
When you say that 'control does not come back' are you referring to application focus or something more?
Best Wishes,
-David Delaune
|
|
|
|
|
Have you initialized COM (using something like CoInitialize() or OleInitialize() )?
john5632 wrote: szPath= path;
Should you be calling SHGetPathFromIDList() here?
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
I've got a dialog-based app that has two buttons: one button spawns a modal dialog, the other button spawns a property sheet (with multiple pages). The background color of the dialog is RGB(240,240,240) . The background color of the property pages are RGB(255,255,255) . Why the difference? I know there are a few settings in the .rc file that need to be changed when creating a property page, but so far none of the ones I've changed have made a difference.
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
It's not clear what you want to do. Do you want to make them both the same, and no matter how you adjust the RC file, they don't come out the same?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Yes, I'd like them both to be the same as the dialog. I can add a WM_CTLCOLOR handler to each of the property pages, but that seems like overkill.
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
These are the default colours for the controls in question. If you want them changed then you will need to subclass them and add your own handler for background paint events.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Hi Richard. I'm not wanting to change the color of the controls, only the background color of the property page. I can do this in the page's WM_CTLCOLOR handler, but it just didn't feel right. Since CPropertyPage is derived from CDialog , I guess I was just expecting them to have the same background color.
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
DavidCrow wrote: Since CPropertyPage is derived from CDialog ,
And its 'parent' CPropertySheet [^] derives from CWnd , which is probably why they take the colour that they do. I agree it's somewhat confusing, but I'm sure Microsoft can explain why they did it this way.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
David,
I don't understand your question. Those colors have always been a part of your window theme[^]. Microsoft window controls use the GetSysColor function[^] for choosing colors for the controls associated with the default window classes.
DavidCrow wrote: The background color of the dialog is RGB(240,240,240) .
I am not on your computer so I do not know what window theme you are using. However for the last 20 or so years the dialogs have always used the GetSysColor(COLOR_3DFACE) for the dialog background.
DavidCrow wrote: The background color of the property pages are RGB(255,255,255) .
Again, this has always been dependent on your windows theme and the property pages are probably using GetSysColor(COLOR_WINDOW) which happens to be 255,255,255 (or a softer shade of white) in most of the window themes I have seen.
Who are you and what have you done with the real David Crow? We demand that you release him.
Best Wishes,
-David Delaune
|
|
|
|
|
This is mixture of a C and a Visual Studio (2008 SP1) question. On a dialog I have a static control that is 1 DLU tall (I have to use Notepad to obtain this height) by several DLUs wide. It is acting as a horizontal line. It has an ID of IDC_STATIC_LINE . When I do certain things on that dialog (e.g., add other controls, move controls around, change tab order), the static control reverts back to 8 DLUs tall. Any ideas why?
- DC
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
modified 9-Mar-12 9:22am.
|
|
|
|
|
I've never seen that.
(in the resource editor)
Is it possible that it gets "glued" to some guidelines ?
Check in notepad if there's a "GUIDELINES" section in the resource file, and remove all the section.
for example :
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_ABOUTBOX, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 163
TOPMARGIN, 7
BOTTOMMARGIN, 55
END
IDD_TEST_DIALOG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 313
VERTGUIDE, 40
VERTGUIDE, 84
VERTGUIDE, 226
VERTGUIDE, 258
TOPMARGIN, 7
BOTTOMMARGIN, 193
END
END
#endif // APSTUDIO_INVOKED
Watched code never compiles.
|
|
|
|
|
The control is just out in the open, all by itself. It's several DLUs away from any edge.
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
What is the actual definition of the control as it exists in your .rc file? It may help if you paste the entire dialog definition here.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Here it is. The 1 in the highlighted line will change to an 8 on occassion.
IDD_USERBUTTONS_PAGE DIALOGEX 0, 0, 274, 298
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Buttons"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
PUSHBUTTON "Load New User defaults",IDC_BTN_LOAD,94,7,86,14
LTEXT "",IDC_STATIC_LINE,7,27,260,1,SS_SUNKEN
LTEXT "Current buttons:",IDC_STATIC,7,34,55,8
...
END
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
In VS2008.
just pasted that line in one of our dialog and I observe the same behaviour; and when I edited the resource in the resource editor, I cannot resize it to one line (even after setting the SS_SIMPLE property.
Watched code never compiles.
|
|
|
|
|
David,
You failed to mention which version of the Microsoft IDE you were using. Therefore I have tested both (fully patched) VS2008-SP1 and VS2010-SP1 and do not experience the behavior you are describing. My test method is to simply create a default MFC dialog project... paste your dialog resource fragment into the .rc file and #define all of the control ID within the resource header. I am able to add/subtract controls and modify the tab order and the static control keeps its height.
It looks like I have added 24 HotFixes to the VS2008 along with latest SP1. You might want to browse all of the HotFixes to see if this issue has been previously addressed: http://connect.microsoft.com/VisualStudio/Downloads[^]
Best Wishes,
-David Delaune
|
|
|
|
|
Randor wrote: ...and the static control keeps its height.
Mine did too for quite a while. Out of the blue, however, it would revert back to its original size.
This is also an issue with VS6. I guess ~10 years is not enough time to get it fixed!
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
David,
How do you know it is a bug? Considering that you have declared a static control as LTEXT (left aligned text) it makes perfect sense for the IDE to resize it so it will correctly draw the default system font. I would suggest that you try changing from LTEXT to CONTROL with the SS_ETCHEDHORZ property set. If you are not comfortable modifying the .rc file directly... from the toolbox in the IDE this is actually "Picture Control" with the "Etched Horz" set to true.
If after making this change you see the same behavior then I would agree that it is a bug.
Best Wishes,
-David Delaune
|
|
|
|
|
Randor wrote: How do you know it is a bug? What else could it be?
Randor wrote: Considering that you have declared a static control as LTEXT (left aligned text) it makes perfect sense for the IDE to resize... The IDE should never make such an assumption. If I want a control to be a certain size, so be it. I can make edit controls too small all day long and assign a huge font to them, all without the IDE's or Windows' interference.
If the IDE was trying to be helpful, why would it not resize a static control that is 8 DLUs high with the SS_SUNKEN style? The default dialog font will not fit in such a control without the bottom of the text getting cropped. You have to make the control 1-2 DLUs taller.
Randor wrote: If after making this change you see the same behavior then I would agree that it is a bug.
I put the change in place. It may take a bit for the problem to surface, if at all.
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Hi David,
Well I have never seen anyone attempt to use a static control in such a way. A single pixel is not even enough room to draw the LTEXT SS_SUNKEN static control. I suspect that the IDE is attempting to do something intelligent and the result is failing to meet your expectations. If you believe that this is a bug then I would suggest that you report it over at http://connect.microsoft.com/VisualStudio[^] and perhaps one of the guys on the Visual Studio team will explain the logic behind it.
The sunken border effect that you were looking to achieve should probably be done with the CONTROL static with the SS_ETCHEDHORZ set. Now that you have made this change I suspect that the problem you were having will go away. Please update the forum thread if the problem reappears.
Best Wishes,
-David Delaune
|
|
|
|
|
Randor wrote: Well I have never seen anyone attempt to use a static control in such a way.
That's the way I learned how to do it way back in the early 90s (with Petzold's book). Old habits are hard to break. Back then MS did not have a resource editor. I routinely used Notepad, and then started using the one from Borland.
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Hi David,
It sounds like we are around the same age. I was also programming with C/C++ back in the mid 80's and early 90's.
DavidCrow wrote: Back then MS did not have a resource editor.
Sure they did. The resource editor back then was called 'App Studio'. I still have my copy of Visual Studio 1.0 and I also have installed in a VM image. I made a screenshot of the resource editor for you.
Screenshot of the Visual Studio 1.0 resource editor[^]
DavidCrow wrote: I routinely used Notepad, and then started using the one from Borland.
I was mostly doing Unix (SunOS) development back then... the closest thing we had to notepad was pico (although most Unix C/C++ software engineers used emacs/vim). I moved permanently to Linux development around 1994/1995. Windows programming was only a hobby born out of curiosity at that time. I did not begin doing full-time Windows development until around 1999/2000 soon after RedHat bailed out of desktop development when they had a dispute with the Gnome developers.
Best Wishes,
-David Delaune
|
|
|
|
|
I had a similar behaviour with the VS 2003 resource editor some years ago:
Whenever I changed something in a dialog using the resource editor, the style of a datetime control set to the time picker format changed to the date format. The DTS_TIMEFORMAT mask was removed while the DTS_UPDOWN mask was still present.
Finally, I hard coded the style in the PreCreateWindow override of my already existing CDateTimeCtrl derived time picker class.
|
|
|
|
|
Hi Everyone.
Not sure if anyone met this situation.
I have a program (client) sitting one one computer (WinXP) and a server sitting on another computer (win7). My programs works fine and will not crash when the ethernet cable is pulled out, when the server program is shutdown etc. BUT when the server computer turns off, the client program will crash when trying to connect (it will try to connect to a server every 3 seconds). If the computer is on and even if the server program is not running, the client is fine and will just continue to connect. Not sure what is happening when a computer is off but the ethernet cable is still plugged in.
Has anyone seen this kind of thing? Is there something that I need to do or check for in the client that will prevent this crashing from occurring?
THanks !
Stan the man
|
|
|
|
|
Stan the man wrote: Is there something that I need to do
The first thing I would do is to try some debugging to find out what is causing the crash; and what sort of crash it is. Is it a bug in the client code, something in the system libraries etc? Without that information it's not easy to suggest how to fix it.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|