?
Solved

VB6 -  How to "dim" a screen?

Posted on 2007-03-26
7
Medium Priority
?
537 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 53

Accepted Solution

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

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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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 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…
Suggested Courses
Course of the Month11 days, 3 hours left to enroll

770 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