Solved

VB6 -  How to "dim" a screen?

Posted on 2007-03-26
7
509 Views
Last Modified: 2008-02-01
VB6

There is a process of "dimming" the overall screen, using a boolean AND, or a boolean OR to blend the currently displayed overall monitor screen with a grid of gray dots. This technique is used by some versions of Windows when you click Start>Shutdown. Does anyone have some sample code to do this?

Thanks,

Dennis
0
Comment
Question by:dtleahy
  • 4
  • 2
7 Comments
 
LVL 51

Accepted Solution

by:
Ryan Chong earned 401 total points
ID: 18797304
Not too sure but this may be useful:
http://msdn2.microsoft.com/en-us/library/ms997507.aspx
0
 
LVL 51

Expert Comment

by:Ryan Chong
ID: 18797354
0
 

Author Comment

by:dtleahy
ID: 18797639
Thanks for the replies, ryancys.

This may be what I need, but interestingly, it is the opposite implementation of what I want to do. They are using it to create a semi-transparent window on top, and I want to semi-obscure the screen below. I have some screens that are visually busy, and when I pop a smaller dialog in front of that, I'd like the busy background to drop further "into the background", to help focus the user.

I'll keep reading through those pages you linked to, but in the meantime maybe someone will have a simple boolean ANDED implementation of the window that I can check out.

Dennis
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:dtleahy
ID: 18797664
...which leads me to the term "Alpha Compositing", and a VB specific implementation:

http://www.vbaccelerator.com/home/vb/code/vbmedia/Image_Processing/Compositing/article.asp

still looking...

Dennis
0
 
LVL 12

Expert Comment

by:viralypatel
ID: 18806756
DimmerDialog is a .NET class that shows a modal dialog which grays out the rest of the background, just like the Windows XP Shutdown dialog. This can be used when your application needs to show a very important message box or form that requires immediate user attention. The class allows you to show either a message box (where you can set the text, title and icon), or a Form instance.

download source here: http://www.codeproject.com/dotnet/DimmerForm.asp
0
 

Author Comment

by:dtleahy
ID: 18810584
Hi viralypatel, and thanks for the reply

This is indeed the effect I'm looking for, but is is .NET, and I need the same effect for a classic VB (VB6) application. I'm hoping I can find some VB code, rather than sample code in C++, or C#, or VB.NET.

Dennis
0
 

Author Comment

by:dtleahy
ID: 18810623
ryancys provided the correct answer in his first post. In fact, I may go back to the MSDN article and check out how to apply the partial transparency gradually (a true "fade-in" effect), using a timer. I was thinking too much "inside the box" and just because the article deals with making the top window in a layer transparent (not what I want), I didn't see that the code was right there in front of me. You can apply that functionality to any window, not just the top one!

As is pretty typical for the technical writers at Microsoft, the article gives more information than I wanted to swallow. They write with broad strokes.

So, when I kept looking, I found a more focused article: http://www.codeguru.com/vb/gen/vb_graphics/transparency/article.php/c6979/

...and, in following that code (which helped me accomplish my goal), I realized that the SetLayeredWindowAttributes was the key, and that ryancys had already led me to the info I needed.

For anyone else that finds this thread, looking for specifics on how to "dim" or "fade" the background, think about a strategy where you have 2 forms loaded, and that the first form loaded is a maximized borderless dialog, and has transparency applied to it, in its Form_Load event. The form popped above that could also have a degree of transparency, but if left opaque it does exactly what I wanted: focus the user on the topmost dialog.

The maximized form used for transparency could be a single color (like gray), but I used a graphics application to create an image with random monochrome noise added to it, and made that image the picture property of the form. Added a nice texture effect to the faded background.

Thanks again, ryancys!

Dennis
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question