|
Use CWindowDC dc(NULL) to get a device context of the screen. Then you can copy off the old image, draw your new one on, etc. I dunno if there is a better way to do animation than this, as I've never tried.
Christian
Secrets of a happy marriage #27:
Never go to bed if you are mad at each other. It's more fun to stay up and fight.
|
|
|
|
|
Hey!
In Win2k, if I call SetCurrentDirectory() with a specific directory,
it appears to work until I use a CFileDialog.
When the file open dialog appears, it usually opens in "My Documents".
SetCurrentDirectory() doesn't seem to fail, and calling GetCurrentDirectory()
returns the right directory name, but CFileDialog just seems to be
completely oblivious of my directory change. This doesn't happen in Win98,
so I'm wondering if there's a reason why the behaviour changed in Win2k.
Another question would be: if SetCurrentDirectory() doesn't work in
Win2K, what does?
Thanks!
Steve
|
|
|
|
|
Use this...
CFileDialog dlgFile;
dlgFile.m_ofn.lpstrInitialDir = _T("C:\\Winnt\\System32");
the lpstrInitialDir variable is what controls where the file dialog starts in, and if its empty it will start in My Documents or whatever the default is.
Bret Faller
Odyssey Computing, Inc.
|
|
|
|
|
Cool, it worked!
Thank you much.
Steve
|
|
|
|
|
I can't seem to disable a button, so that it is showed as grayed-over. However, if I call IsWindowEnabled() after attempting to disable it, it says that it is disabled. Disabling it by setting its property to disabled doesn't work either. It still shows itself as enabled when the app launches.
The button is on a dialog-bar, and I attempt to disable it via the following:
m_wndDialogBar.GetDlgItem(IDC_MY_BUTTON)->EnableWindow(FALSE);
Calling UpdateWindow() doesn't seem to help at all either.
- John
|
|
|
|
|
I may be wrong here...as always. But...
I think your on the right track, but using the wrong thinking. A dialog bar is a dialog...but its not really a Dialog in the normal sense of things. Its really derrived from CControlBar like CToolbar. I think.
Try treating your CButton's like standard everyday toolbar buttons and use GetToolbarCtrl. ie:
CToolBarCtrl& myControl = m_wndToolBar.GetToolBarCtrl();
myControl.EnableButton(IDC_MYBUTTON, FALSE);
I'm really stabbing at shadows here, so if I'm wrong I never posted this. If I'm right...you bet I posted it.
Frank
|
|
|
|
|
Unfortunately, that is not correct. You need to ON_UPDATE_COMMAND_UI handler for each button in the dialog bar, just like you would for a button on a control bar.
|
|
|
|
|
Yeah, Frank had the right idea. Because the button is on a dialog bar, you need to enable/disable it like it was a toolbar button. That is, you need to create an Update UI handler for it in your message map:
ON_UPDATE_COMMAND_UI(IDC_MY_BUTTON, OnUpdateMyButton)
And then in the handler, set the state of the button:
void CMyClass::OnUpdateMyButton(CCmdUI* pCmdUI)
{
if (i_want_the_button_to_be_enabled)
pCmdUI->Enable();
else
pCmdUI->Disable();
}
Hope this helps.
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
Hi,
Just having a quick play around with install shield. This has got to be a stupid question! I have added files to file groups. For example i added a link to notepad.exe to 'program executable files' group. Yet when i compile and run the installation, no files are installed, And zero K appers in the total file size for custom installation.
Anyone know where i am going wrong?
Cheers
Dave
|
|
|
|
|
We should add this to the FAQ, it gets asked so often. But it's a ftrstrating problem. In Installshield you essentially add your files twice - once to create a file group and another to add them to the current installation. I forget where, it's over a year since I used it, but if you've added them once, you've probably created a group but not made it part of the installation.
Christian
Secrets of a happy marriage #27:
Never go to bed if you are mad at each other. It's more fun to stay up and fight.
|
|
|
|
|
Hi,
Just having a quick play around with install shield. This has got to be a stupid question! I have added files to file groups. For example i added a link to notepad.exe to 'program executable files' group. Yet when i compile and run the installation, no files are installed, And zero K appers in the total file size for custom installation.
Anyone know where i am going wrong?
Cheers
Richard
|
|
|
|
|
I want to konw how to load a picture from a file and then displace it onto a picture control!!!Thanks
|
|
|
|
|
My program displays a complex layout of BMPs in the client window. When the client is inactive (i.e. when my program is out of focus), other window/folders which are being dragged in front of the client "smears" the window, leaving the ghost image of it.
As a "work around", I made a variable 'clientActive, and flag it when the window is active, and unflag it when the client goes out of focus. Then, in OnDraw, I set it so it redraws the client window when 'clientActive' is unflagged.
This "work-around" works, but the thing is that even a mouse cursor passing by the client window makes it redraw. The end result is that moving mouse over the inactive client causes major flickering as it's refreshing (redrawing) the client window everytime mouse moves.
How can I correct it so that mouse movement doesn't cause refresh to occur, and still not have other applications' windows leave "smears" in my client?
Thank you
|
|
|
|
|
Moving the mouse pointer will always cause Invalidation - the probable question you need to ask is how are you handling your drawing ? Are you drawing your bitmaps to a memory DC and copying to the screen all in one go, or are you copying them a bit at a time ? Is the nature of the drawing such that you'd be better doing it in OnEraseBackground ( I assume you're using OnPaint because of the flicker ).
Christian
Secrets of a happy marriage #27:
Never go to bed if you are mad at each other. It's more fun to stay up and fight.
|
|
|
|
|
I'm actually "drawing them a bit at a time", as you put it.
The picture displayed consists of "tiles", and there are 3 to 5 layers of them, overlapping each other. Any of the layers can be turned on and off anytime by the user. I have separate functions for drawing different layers. They take a pointer to CDC, and uses it to draw it on the fly, directly onto the client view. Scroll bars are used to move the client view within this massive "field" of tiles and layers.
I've tried to use a "backbuffer" of a sort in the past, but all failed miserably. I've even tried to store a memDC pointer and always use it to draw all the active layers, then copy it onto the actual DC. But it seems DC is only temporary and can't be reliably used loop after loop. I've also tried to use CBitmap as a "backbuffer", but I couldn't quite figure what was going wrong with it, I think it was something to do with the fact that in windows the client size is variable and the size of the buffer has to change constantly depending on the client size (as opposed to the concept of "backbuffer" like it was in DOS/DirectX, where the size of the backbuffer was always constant, just as the primary buffer was of constant size).
When new tiles are plotted in one of the layers, only the affected tile area is redrawn. So it's usable... I know it's a major work-around, something one should avoid. I just can't seem to find an appropriate way to do this properly (and no, I'm nowhere close to being a MFC guru)
When the layers are turned on, OnErase isn't clearing window. It doesn't need to, so I've overriden it. On a side note, I'm using OnDraw. I'm not catching OnPaint message directly.
Anything to enlighten this situation would really help... it's close to a nightmare trying to solve it, so up until now I haven't bothered (the app is perfectly usable... while it has all the flaws). I really do want to solve it though, given the chance.
|
|
|
|
|
instead of ondraw, draw to the dc in onpreparedc.
Christian
Secrets of a happy marriage #27:
Never go to bed if you are mad at each other. It's more fun to stay up and fight.
|
|
|
|
|
Hi,
How do you obtain the width of a vertical bar?
thanks
|
|
|
|
|
use GetSystemMetrics(SM_CXVSCROLL);
Bret Faller
Odyssey Computing, Inc.
|
|
|
|
|
|
Need help! How can I remove the program button from the taskbar?
|
|
|
|
|
Need help! How can I remove the program button from the taskbar?
|
|
|
|
|
Explain: "The program button"
--Bar Cochva--
|
|
|
|
|
With Program Button I mean the button in the taskbar.. where the start button is... in the buttom of the screen
but I have a solusion.... I replaced _EX_APPWINDOW with _EX_TOOLWINDOW
|
|
|
|
|
With Program Button I mean the button in the taskbar.. where the start button is... in the buttom of the screen
but I have a solusion.... I replaced _EX_APPWINDOW with _EX_TOOLWINDOW
|
|
|
|
|
Paul DiLascia addresses this question in the May 2000 issue of MSDN magazine. Search MSDN for May 2000.
Frank
|
|
|
|