|
Hi,
for those who know 'WinRar', when you select a file which has been compressed and right click and select Properties > Archive, you get a nice column showing the compression Ratio in %.
Can someone provide a URL to a sample that implements such a type of column bar? I need such column bar for a Ratio representation in an MFC-based app (aka. C++ based-app, NO .NET).
Thanks in advance for any hint.
Marc
|
|
|
|
|
I don't have WinRar installed but just an idea: use Spy++ to find out the class of that control and then try googling it up, maybe it turn up something usefull...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Leela: Fry, you're wasting your life sitting in front of that TV. You need to get out and see the real world.
Fry: But this is HDTV. It's got better resolution than the real world <
|
|
|
|
|
It shows in the property window of compressed files.
So it must be a shell extension.
You may not be able to get to pick only the control out with spy.
It may not even be a control.
It could be simply drawn.
You never know.
|
|
|
|
|
|
|
«_Superman_» wrote: You never know.
...unless you try. Was just an idea, maybe it works, maybe it does not.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Leela: Fry, you're wasting your life sitting in front of that TV. You need to get out and see the real world.
Fry: But this is HDTV. It's got better resolution than the real world <
|
|
|
|
|
very good idea. Thanks. I have tried with Spy++ and it is NOT an OCX control, it is pure drawing functions. This IS the kind of Drawing functions I am looking for!
modified on Thursday, October 28, 2010 1:44 AM
|
|
|
|
|
I have a button that I want an image in, a basic colour swatch. I liked the idea of having a partially transparent shadow around it, so in GIMP, I created a 32 bit BMP with the desired alpha shadow, and a white, totally non-transparent square in the middle. The intention was to fill the white area in with the colour that the user chooses. Sounds simple enough. So, the basic code is such:
HDC hDC;
HANDLE hOldBmp;
HBRUSH hBrush;
LOGBRUSH zLogBrush;
HBITMAP hColourShadowBmp_ = ::LoadBitmap( hInst, MAKEINTRESOURCE(IDB_COLOUR_SHADOW) );
zLogBrush.lbStyle = BS_SOLID;
zLogBrush.lbColor = RGB( m_Props.uiRed, m_Props.uiGreen, m_Props.uiBlue );
zLogBrush.lbHatch = NULL;
hBrush = ::CreateBrushIndirect( &zLogBrush );
CImage zFinalImage;
CImage zSwatchImage;
zFinalImage.Attach( hColourShadowBmp_ );
zSwatchImage.Create( 20, 20, 24 );
hDC = zSwatchImage.GetDC();
::SelectObject( hDC, hBrush );
::Rectangle( hDC, 0, 0, 20, 20 );
zSwatchImage.ReleaseDC();
hDC = zFinalImage.GetDC();
zSwatchImage.AlphaBlend( hDC, 2, 2, 255 );
zFinalImage.ReleaseDC();
hOldBmp = (HANDLE)
::SendMessage( ::GetDlgItem( m_hWnd, IDC_COLOUR ),
BM_SETIMAGE,
(WPARAM)IMAGE_BITMAP,
(LPARAM)zFinalImage.Detach() );
::DeleteObject( hBrush );
All I end up with is the source shadow image, with a lovely fully transparent square where the swatch should be. I know the swatch painting is working, as I can send that image and get the colour square I expect.
Yet nothing I do seems to be able to make the colours get transferred. Crazily enough, the alpha is, if I set the alpha in the AlphaBlend() call to 0, I get the original shadow image unchanged. So I know that it is modifying the alpha channel properly at least. The source is opaque, so no amount of pre-multiplying will help.
FWIW, I also tried making the zSwatchImage a 32 bit with alpha, but it made no difference.
The only solution I can see now is jumping into the bits for the shadow image and changing the RGB values to what I want.
But surely I'm doing something wrong? It's hard to believe that a simply blend like this fails.
Thanks,
CraigL
|
|
|
|
|
Don't be surprised, GDI drawing methods zero out the aplha channel. When you call Rectangle it "makes a hole" in your alpha channel. Use GDI+ or fill the pixels by writing memory directly.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Leela: Fry, you're wasting your life sitting in front of that TV. You need to get out and see the real world.
Fry: But this is HDTV. It's got better resolution than the real world <
|
|
|
|
|
I can see that being a problem if I had an alpha channel in the zSwatchImage . And at one point I did, so I guess I'd expect the behaviour I saw.
But it's absurd to me that an "alpha blend" function can't take a 24bit image and "do the right thing" by copying it will the alpha channel opaque. Especially when you TELL it what the alpha value to copy with should be. If it isn't there, you'd think it would use the alpha provided as the source alpha, not just the blend alpha. But to take a 24bit image and assume the alpha is zero?
And, I had thought that CImage did use GDI+, so the 24 -> 32 bpp copy would make sense.
I guess I just expect too much from CImage .
Course, now I'm having fun trying to get the bits directly from a BMP loaded via ::LoadBitmap ... I guess graphics never really was a win32 strong point.
Thanks for the reply. Normally, I totally exclude win32 APIs wrt image handling, just needed the BMP to use the easy way one can put it on a button. This exercise has just cinched that opinion even more =)
|
|
|
|
|
OK, I stumbled upon the ::LoadImage() after thinking there must be a function more up-to-date that ::LoadBitmap() , and it lets me load a DIB from a resource, and then ::GetObject() gives me the bits.
Thanks,
CraigL
|
|
|
|
|
Cool
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Leela: Fry, you're wasting your life sitting in front of that TV. You need to get out and see the real world.
Fry: But this is HDTV. It's got better resolution than the real world <
|
|
|
|
|
Hi Craig,
Craig Longman wrote: Course, now I'm having fun trying to get the bits directly from a BMP loaded via ::LoadBitmap
From LoadBitmap[^] LoadBitmap creates a compatible bitmap of the display.
Use LoadImage()[^] with LR_CREATEDIBSECTION to use the xxxBlend GDI functions.
As was already answered GDI+ (not MFC CImage which uses it only for file exchanges) handles that correctly.
cheers,
AR
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
FYI:
GDI+ is not working properly under windows 7.
|
|
|
|
|
transoft wrote: GDI+ is not working properly under windows 7
Can you give an example... do you mean performance problems with alpha blending on Windows 7?
|
|
|
|
|
Hi all,
i need to restrict the tooltip within the dialog box.
when i tried the options like setmargin(), iam seeing the tooltip as flickering.
Obviously, the text in the tooltip will be a big sentence, which need to be displayed in multiline.
Please convey your suggestions.
Thanks in advance.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
|
Hi everyone. I have a program that plays audio files. I have a control that I want to use to control the volume. I have declared a HANDLE for the waveOut as
HWAVEOUT hWo;
that I use to write the audio samples. Now I want to control the volume. I used
waveOutSetVolume() and this affects the wave output volume of the system. How do I control the volume from my application without affecting the volume of the system, or what function is used for this task. Thanks in advance.
|
|
|
|
|
Dan_K wrote: How do I control the volume from my application without affecting the volume of the system...
I believe you'll need Vista for per-application volume control.
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
As David mentioned you might be looking for an OS specific type function. You might try the following, though and that is to obtain the current volume setting when your program starts up, then allow the user to change volume at will, and when the user closes your program you restore the volume back. It won't work quite like you are looking for, but it might be a nice addition.
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
|
|
|
|
|
Windows Media Player 9 on Windows XP for instance works without changing the system volume so I thought there could be a way out.
|
|
|
|
|
There are two ways to change the intensity of your output:
- Change the volume: on Xp and earlier systems you have only a general setting for it, starting on Vista has been provided a per-application setting
- Scaling the audio samples: in this case you have to get the audio data from your stream, modify them and send the modified one to the audio output
|
|
|
|
|
Can you please give me a brief idea about scaling the samples? I don't know much about digital sound processing but I learnt it has to do with the amplitude. I don't know if the amplitude is the value of a sample. If this is right, then I think if you give me a brief idea, I would be able to do it.
|
|
|
|
|
Windows Media Player -as far as i know- user DirectX/DirectShow to play sounds, not the waveOut API (i am not sure how it works with DirectShow, am just mentioning...)
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Leela: Fry, you're wasting your life sitting in front of that TV. You need to get out and see the real world.
Fry: But this is HDTV. It's got better resolution than the real world <
|
|
|
|
|
Hi all,
I have made a multiline edit control but the problem is when i try to use tab in it the focus shifts to next control. Is there any way to use tab inside edit control.
Thanks in advance
|
|
|
|