|
I tried moving the blending window over the screen,
it did not work well.
(>-<)
|
|
|
|
|
This trick is actually not 100% under Win98 (and maybe other versions as well). Just move a window under the splash and move it while the splash fades in. You will see the window containing remnants of the splash which are not cleared (you can restore the window contents by minimizing and then maximizing though. The reason is that it involves dirty drawing, and only win2000 and up support 'correct' transparency taking into account other windows !
|
|
|
|
|
I am building an ActiveX control that has 2 layered windows, i need to make the top window transparent, i tried to call this function on OnDraw but it didn't work, What should i do?:
|
|
|
|
|
This two-liner achieves the very same effect:
SetWindowLong(GetSafeHwnd(), GWL_EXSTYLE,GetWindowLong(GetSafeHwnd(), GWL_EXSTYLE) | WS_EX_LAYERED);
SetLayeredWindowAttributes(GetSafeHwnd(), 0, 255 * alpha, LWA_ALPHA);
where alpha is between 0.0 and 1.0
|
|
|
|
|
But wouldn't the Alpha-blending features of the SetWindowLong function only work in Windows 2000? Or am I just confused...?
|
|
|
|
|
A quick lookup in the MSDN help shows that this is indeed only available in Win2000 and up..
|
|
|
|
|
Is there any way this function can be used with TRUE color bitmap (24 bit) ?
|
|
|
|
|
You can put any bitmap you like on a plain window and use SetLayeredWindowAttributes (cf. my other post)...
Maybe you meant 32 bit bitmaps (with per pixel alpha?), it is perfectly possible, just a bit more involved to get it working, I have not taken the time to wrap some code around that... sorry !
|
|
|
|
|
It's built in as part of the AlphaBlend function, actually--so you shouldn't really need to get any more complex at all. To use 32 bpp bitmaps, just set the AlphaFormat member of the BLENDFUNCTION structure you pass to the AlphaBlend function to AC_SRC_ALPHA. This will tell the AlphaBlend function to use the per-pixel alpha attributes of the bitmap.
Example Code Snippet
'
' This code is for VB only. Sorry, I'm not experienced
' enough in Visual C++ to give you guys a C example.
'
' Hopefully, though, you should get the gist of it even
' if you don't understand the inner workings of VB...
'
Dim MyAlphaFormat As BLENDFUNCTION
With MyAlphaFormat
Let .BlendOp = AC_SRC_OVER
Let .BlendFlags = 0
Let .SourceConstantAlpha = 192 '...or whatever you want
Let .AlphaFormat = AC_SRC_ALPHA
End With
Call AlphaBlend(DestPic.hDC, 0, 0, 320, 240, _
SrcPic.hDC, 0, 0, 320, 240, MyAlphaFormat)
Hope this helps you,
Eric (eslindsey@hotmail.com)
|
|
|
|
|
Is there any way this function can be used to blend an entire movable form
|
|
|
|
|
There might be. It'd probably use a good amount of resources, but in theory, Windows would compensate with enough virtual memory to get by. Oh yeah, it'd also take some ingenuity and experimenting.
(By the way, I'm a VB programmer that happens to know a little bit about C, so if I'm confusing you by using VB terminology, let me know; I'd really like to learn better how to program in Visual C++ but haven't found a decent website or instructor yet...)
Here's what I think might work. First, create a standard form, and get rid of the standard Windows border, so you've just basically got a giant canvas. Next, on every resize or move event (for the form, that is), take a screenshot of the area behind the form (I'm not quite sure exactly how you'd go about taking a screenshot of what's *behind* you're form, but that's why I said it'd take some experimenting). Next, take a screenshot of your form at full opacity (again, how you'd do this without actually setting the opacity and taking the screenshot, I don't know--you'd want to hide it from the user; perhaps there's a way to do all this graphics management in a memory buffer?), and blend the two of them, passing the hDC of your borderless "canvas" to the hdcDest parameter of the AlphaBlend function.
Like I said, it'd take a *lot* of ingenuity and experimenting, but if you _really_ want to blend a form, you may want to look in to how you might go about this; it's the only thing I can think of, anyways.
Hope it helps!
Eric (eslindsey@hotmail.com)
|
|
|
|
|
Can you supply me with some code that doesnt use MFC. So I write this in C
|
|
|
|
|
I tested it with NT 4.0 SP5. To get it running I copied the msimg32.dll from a Windows 2000 system. It works fine!!
|
|
|
|
|
Hello.
Sorry, but i'm a frensh student and i don't speak a good english.
My problem is:
When i compile your example, no pb, but if I look in the debug window during your alphablend function is running, i see an error message like : ...(GDI32 error) exception 0xC0000005 ! this is a little problem and the program don't stop ! I don't understand why this error is coming randomizly ! never at the same time !
(if you don't understand what i said, email me please !)
bye, and thank if you are a reponse !
ktx
|
|
|
|
|
A technical programmer ( write 'Debugging Applicatio') send mail about that.
--------
Your English is much better than my Korean.
What you are seeing are first chance exceptions. They just mean that SEH
exception handling is being invoked but the __except handlers are handling
the problem. You might see a few of the notifications in normal operation.
However, if you are seeing many of them, you are probably passing an invalid
parameter. You can have the debugger stop on all first chance exceptions
from the Debug Exceptions menu option.
Hope it helps!
John.
www.jprobbins.com
|
|
|
|
|
The simplest way to run it in any Windows platform is to install with you programm also MSIMG32.DLL.
You can find it in Win98.
Only one problem: I cannot find a way to use colored images.
If somebody know - mail me
|
|
|
|
|
Is it legal to install MSIMG32.DLL on Win95? Probably not...
|
|
|
|
|
If you find it in redistributables of MS - it legal, else - ask Microsoft.
Another question: "Is it works with win95?".
With my win95 it works
|
|
|
|
|
Not having Windows 95 (I've got Millenium; which, by the way, it works fine on, as one would expect--but then again, we're talking about Microsoft here, and they don't always make much sense), I would have no way of checking this, but has anybody checked to see if there is a service pack upgrade or something that will upgrade the version of Wingdi.dll to a version that includes the AlphaBlend function?
|
|
|
|
|
The msimg32.dll that comes with Win98/ME INCLUDES the actual code that does the alpha blending, so if you include this file with your distribution, it would work on Win95/NT. The msimg32.dll that comes with Win2000/XP, on the other hand, is a wrapper dll that calls a function named gdiAlphaBlend contained in the gdi32.dll. So including this file won't work because the gdi32.dll of Win95/NT, as you'd expect, does not contain the gdiAlphaBlend function.
Henry P.
http://www.allersoft.com
|
|
|
|
|
Is there no way to get it to work
|
|
|
|
|
Not unless you want to hand-code a version of the function yourself to run under Windows 95, in which case you wouldn't need the API call in the first place. The reason this function doesn't work under Windows 95 (or the other versions listed as being incompatible) is because the AlphaBlend function is called from the Wingdi.dll file, which only started to include the AlphaBlend function starting in Windows 98 and Windows 2000 (according to Microsoft, at least; apparently it works sometimes in NT 4.0, but that may be due to a service pack update or something, I don't know much about NT).
So in short, no.
Sorry
Good luck!
Eric (eslindsey@hotmail.com)
|
|
|
|
|
I know I can't use the splash in W95/NT 4, but I thought if I put some code in to stop it being run under those OS's, that it would work OK, just without the splash. My app is crashing under '95, is this because I am wrong ? Does this code make an app W98/2000 only, even if it is not called ?
Christia
|
|
|
|
|
If you are using C, be sure to do a conditional compilation for the inclusion of the function itself; the project may be crashing because it can't find the AlphaBlend function where it expects to in Wingdi.dll. To do this, you'll need to use a #if block that checks the windows version around the function call and/or function declaration. Also, you may need to set WINVER to something above what it's at; I'm not expert in C, so I couldn't tell you for sure, but from what I do know, try making sure you're using #if instead of just plain if (C programmers help me if I'm wrong here).
As for Visual Basic (which I do have extensive experience in), there is no (easy) way to conditionally declare (or, to be more accurate, "dynamically link") a function from an API; when you compile, it's statically linked to the API call, and if that particular function isn't found in the DLL (in this case, AlphaBlend in the Wingdi.dll file), the program will just die with a message box saying "Dll entry point ... not found", etc.
Hope this helps!
Eric (eslindsey@hotmail.com)
|
|
|
|
|
Hiya,
You are better of doing a runtime check on the OS and depending on it calling the fucntion or not. This is better than conditional compilation considering it avoids resulting in multiple executables for each OS in the end..
|
|
|
|
|