Solved

Delphi 7 How can I programatically suppress Windows advisory messages?

Posted on 2008-10-03
8
348 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
 

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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Our Group Policy work started with Small Business Server in 2000. Microsoft gave us an excellent OU and GPO model in subsequent SBS editions that utilized WMI filters, OU linking, and VBS scripts. These are some of experiences plus our spending a lo…
NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

757 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

22 Experts available now in Live!

Get 1:1 Help Now