|
I doubt anyone who reads this will have any idea what you mean. Do you mean a dialog box that has a section that can be shown or hidden ? The trick is just to use ::SetWindowPos to resize the dialog to hide/show the section you want to toggle, and set the text on the button you use to reflect the current state. If that's not what you mean, try to explain a bit better.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Like christian said. i am confused..
Which VC dialog ??
|
|
|
|
|
I was design a typeset software, so i want my user can auto change layout like "vc dialog layout"
|
|
|
|
|
Hello,
Does anyone knows how to interpret Standard Test Data Format(STDF) file using VC++ program?
Thanks,
Mar
Mar Solero Jr.
|
|
|
|
|
Sorry about a non MFC question, but I thought we should have some good C++ Programmers here.
I have a base class and a inherited class.
class base<br />
{<br />
base()<br />
Initialise();<br />
};<br />
class derived : public base<br />
{<br />
derived();<br />
Initialise();<br />
}<br />
base *root;
Within my view class I want to initialise root as either the base or derived class. I do this with the following code.
switch(version)<br />
{<br />
case 0 : root = new base; break;<br />
case 1 : root = new derived; break;<br />
}<br />
root->Initialise();
This howerver always calls base::Initialise instead of the derived even for case 1.
What can I do to call derived::Initialise ?
Of course I could create a pointer to derived and typecast chamber_root, but I dont want to do that. Also I could derive another class from base and use that instead of base.
---
|
|
|
|
|
Coremn wrote:
What can I do to call derived::Initialise
Declare Initialise() as virtual in the base class:
virtual Initialise(); BTW, it's always a good idea to specify a return type for the method, even if it returns nothing. Not specifying it is non-portable and susceptible for misinterpretation by others.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Thankyou, that was easy and quick. (quick *slap* to the forehead)
(and yes I do actually have a return type)
---
|
|
|
|
|
Hi,
Just a quick question. I have a bitmap resource in my project and I load it by calling
LoadBitmap but how can I resize it on the fly so that it fits neatly into my window?
I need to do it before I display as I don't have control over the BitBlt display code in the MFC control.
Thanks.
|
|
|
|
|
You need to create a new bitmap that is the right size, then stretchblt your bitmap into it.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Do you have an example?
Thanks
|
|
|
|
|
If you look up stretchblt in the MSDN, I'm sure it will have an example.
Just make sure you set the correct mode ( COLORONCOLOR is the high quality one, from memory )
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
awesome
so I have done that and it works great.
With regard to releasing GDI resources I get a little confused about what I have to put back.
I have two device contexts in which I SelectObject the two bitmaps.
I re select the old bitmaps back. Is this all I have to do?
Do I need to call DeleteObject as well?
Thanks
|
|
|
|
|
Anonymous wrote:
so I have done that and it works great.
Terrific
Anonymous wrote:
I have two device contexts in which I SelectObject the two bitmaps.
I re select the old bitmaps back. Is this all I have to do?
If you're using MFC, the CDC and CBitmap classes will clean up after you once you've done the above. If you're using straight handles then you'll need to call DeleteObject yourself.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Christian Graus wrote:
If you're using MFC, the CDC and CBitmap classes will clean up after you once you've done the above. If you're using straight handles then you'll need to call DeleteObject yourself.
Not quite Christian, you do have to select the bitmaps out of the DC before you let the destructors clean up. The easiest way to call CDC::SaveDC before you select any objects in, and CDC::RestoreDC when you are finished with the DC.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
PJ Arends wrote:
you do have to select the bitmaps out of the DC before you let the destructors clean up.
Um.. if you follow the conversation, what I meant by 'once you've done the above' is that the original poster indicated that he had selected the bitmaps out of the DC, and asked if he needed to call 'DeleteObject', having done that.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Ok, my bad. It is just that I have used code that leaked resources like crazy because people didn't restore the DC, they just let the destructor do it's thing. Then they would say it doesn't matter, because Win2K / XP has no limit on resource usage.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
I wrote a small program to shutdown my computer at a scheduled time (using the task scheduler to run the program at the end of the day). The program works except when I'm logged off from the computer (i.e. the welcome or login screen is displayed). The program still runs and terminates will an exit code of 0, but the shutdown never happened. Here's a sample of the code:
void CPowerdownDlg::OnOK() <br />
{<br />
if (!mode)
{<br />
HANDLE procHnd, tokHnd;<br />
<br />
procHnd = GetCurrentProcess();<br />
<br />
if (!OpenProcessToken(procHnd,TOKEN_ADJUST_PRIVILEGES,&tokHnd))<br />
return;<br />
<br />
TOKEN_PRIVILEGES tp;<br />
LUID luid;<br />
<br />
if (!LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &luid))<br />
return; <br />
<br />
tp.PrivilegeCount = 1;<br />
tp.Privileges[0].Luid = luid;<br />
tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;<br />
<br />
AdjustTokenPrivileges(tokHnd, FALSE, &tp, 0, NULL, 0); <br />
<br />
InitiateSystemShutdownEx(NULL, NULL, 15, TRUE, FALSE, SHTDN_REASON_FLAG_PLANNED);<br />
<br />
}<br />
else if (mode == 1)
SetSuspendState(FALSE,TRUE,FALSE);<br />
else if (mode == 2)
SetSuspendState(TRUE,TRUE,FALSE);<br />
<br />
OnClose();<br />
}
This is an MFC app where the dialog displays a countdown to auto-shutdown or the user can force it manually (by clicking the OK button). Of course when no one is logged on, the program will shutdown the computer without user intervention. I've tried using ExitWindowsEx() but the results were the same. Strange though that hibernating (mode 2) works when I'm logged off. I'm using XP Pro.
I'm puzzled
reymano
|
|
|
|
|
Not really a VC++ question, but can someone point me to a link that describes how to do simple string parsing in a .cmd script. I'd like to parse an incoming arg like "1.2.3" into "1", "2" and "3".
Thanks!
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Try here[^]. They've got a lot of information on batch file 'programming', in addition to an immense pile of registry hacks.
For the basics, you can read the help for the SET, IF, and FOR commands from the command line using this:
C:\> set /? | more
Software Zen: delete this;
|
|
|
|
|
Hi all,
As you know we have an interface in windows called ICOPYHOOK.
With this interface you can only monitor Copying of FOLDER(S) and PRINTER objects.
Could any one tell me how can i write an application to monitoring FILE Copying.?
Is there any resourec for this purpose on the web.please show me.
Thanks.
|
|
|
|
|
|
Hi, I'm currently developing a program which is supposed to run on Windows 98/NT4/ME/2000/XP/whatevercomesafterthis and I was wondering what messing with WINVER might have a result on the program. By that I mean, does the program still work if I set it to like 0x500 or something?
I suppose that if it works, the feature used for this version won't be available on Windows 98.
MSDN doesn't really enlighten me on this matter, but I was just wondering if this would break the program when running on Windows 98 or anything.
|
|
|
|
|
For 95 and greater the two defines you use are:
#define _WIN32_WINDOWS 0x0400<br />
#define WINVER 0x0400
If you're willing to drop NT4 support, but retain 98/ME you'd use:
#define _WIN32_WINDOWS 0x0410<br />
#define WINVER 0x0500
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Right, I did understand that part. But what isn't clear to me is the fact that if I would, e.g. drop NT4 support, would the application still work in NT4? Or will it just fail to run?
|
|
|
|
|
If you call a function that is not supported on NT4, your application will fail to start; typically with an entry point not found error (or something similar.)
If you use a structure that is extended for other versions of windows, generally the app will work on NT4, but that function may fail or exhibit odd behavior.
If you use constants that are not meant for NT4, some functions will fail, others will ignore the new constants.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|