Solved

Delphi 7 How can I programatically suppress Windows advisory messages?

Posted on 2008-10-03
8
355 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
[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
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to PXE Boot both BIOS & UEFI machines with DHCP Policies and Custom Vendor Classes
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

756 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