Solved

Delphi 7 How can I programatically suppress Windows advisory messages?

Posted on 2008-10-03
8
353 Views
Last Modified: 2013-11-23
D7 XP
Hi,
I need to run an application so that only the main form of the application  is always displayed. I wish to temporarily suppress all Windows messages (I hope all exceptions are handled within the app!!) whilst the app. is running. Can I do this programatically?
e.g.
'hiding your inactive icons'
'your hardware is ready;' (USB)
'Windows has altered time to BST'
etc.
etc.
Chris
0
Comment
Question by:chrislock
  • 5
  • 2
8 Comments
 
LVL 17

Expert Comment

by:TheRealLoki
ID: 22639925
I think if you created another desktop, and specifically did not run explorer, then you would be ok.
all system messages should go to the main desktop.
just make sure you close your created desktop when your app ends or you will be stuck in a limbo desktop :-)

something like ...

var Desk: HDESK;

  Desk := Windows.CreateDesktop(PChar(DesktopName), nil, nil, 0, MAXIMUM_ALLOWED, nil);
...

  Desk:=OpenDesktop(PChar(DesktopName), DF_ALLOWOTHERACCOUNTHOOK, False, MAXIMUM_ALLOWED);
  Sleep(100);
  SwitchDesktop(Desk);
...
  CloseDesktop(Desk);
...
might pay to read up on them first so you know what you're getting into, but not too bad
0
 
LVL 3

Expert Comment

by:big_one01
ID: 22650823
You can try the 3rd party component MadExcept.
Check http://www.madshi.net/madExceptDescription.htm
This component is very easy to use and can handle any kind of exception, inside your application or from the OS.
Very useful for this cases.
0
 

Author Comment

by:chrislock
ID: 22676992
big_one01

I dont really understand what MadExcept has to do with the question!!!!!????

Chris
0
Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

 

Author Comment

by:chrislock
ID: 22678054
TheRealLok

Your code certainly works in part. How do I return to the original desktop?
I save the existing desktop
create the new desktop.
get a handle by calling opendesktop
switch desktop to desk
delay
then switch back
then ....

If the software closes the desktop (CloseDesktop(Desk);)  then nothing seems to happen and I'm still stuck with the blank desktop and its a hard reboot. Am I missing something?

 olddesk:=windows.getdesktopwindow();
  Desk := Windows.CreateDesktop(PChar('DesktopName'), nil, nil, 0, MAXIMUM_ALLOWED, nil);
  Desk :=OpenDesktop(PChar('DesktopName'), DF_ALLOWOTHERACCOUNTHOOK, False, MAXIMUM_ALLOWED);
  Sleep(100);
  SwitchDesktop(Desk);// activate the new desktop
  sleep(2000);
  SwitchDesktop(oldDesk);// activate the old desktop
  CloseDesktop(Desk);

Chris
0
 

Author Comment

by:chrislock
ID: 22678127
I've just found this:

http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_10688741.html

I think theres a bit more to it than this!!!

There must be another way to suppress windows messages !

Chris
0
 

Accepted Solution

by:
chrislock earned 0 total points
ID: 22678300
I'm going to try this - it looks simpler!
http://msdn.microsoft.com/en-us/embedded/aa731206.aspx

Chris
0
 
LVL 17

Expert Comment

by:TheRealLoki
ID: 22685001
if you do decide to go the desktop way, and get stuck in a limbo desktop, just do a ctrl-shift-escape, then "new task" explorer.exe
I think the main desktop is called "default" try switching to that,
I can't look it up right now, away from dev pc sorry
0
 

Author Comment

by:chrislock
ID: 22970406
Sorry - forgot to say thanks for all the help anyway.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi Yen format 3 45
Windows 10 in-place ugprade stuck on 0% 6 32
AD architecture diagram 5 34
SCCM 2012 R2, Rollback KB updates 4 23
Storage devices are generally used to save the data or sometime transfer the data from one computer system to another system. However, sometimes user accidentally erased their important data from the Storage devices. Users have to know how data reco…
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

856 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