Solved

VB6 -  How to "dim" a screen?

Posted on 2007-03-26
7
488 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to open Waze.com/livemap from address saved in DB? 26 177
Access 2016 VB code 9 102
Excel - Save a copy of work book 13 82
Add and format columns in vb6 7 46
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

911 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

16 Experts available now in Live!

Get 1:1 Help Now