Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Delphi 7 How can I programatically suppress Windows advisory messages?

Posted on 2008-10-03
8
Medium Priority
?
375 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
Independent Software Vendors: 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

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!

Question has a verified solution.

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

Windows 10 Creator Update has just been released and I have it working very well on my laptop. Read below for issues, fixes and ideas.
It is a real story and is one of my scariest tech experiences. Most users think that IT experts like us know how to fix all computer problems. However, if there is a time constraint and you MUST not fail the task or you will lose your job, a simple …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

886 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