Solved

VB6 -  How to "dim" a screen?

Posted on 2007-03-26
7
479 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 49

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 49

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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Vb.net Listview 9 78
VB6 add a minute to the date time value 8 45
Adding to a VBA? 6 48
Access query that references subform 5 35
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now