Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

MessageBox(?) needed to persist beyond application death

Posted on 2002-03-12
3
Medium Priority
?
199 Views
Last Modified: 2013-11-20
We have applications that must kill themselves so that their .exe files can be updated/overwritten. This code is complete and works.

What is needed now is a way for the application to tell the user that it closed on them to be updated.

Granted, we can always start a new process, mayhaps 'net send' or our own custom app, but I would really like a way to display the message box to the user without depending on external applications that will live beyond the complete exit of the application. Something like maybe PostMessage to the windows desktop and have it display the message box.

Summary: Must display a message to the user while overwriting the .exe file that triggered the display of the message. Prefer to not depend on any new .exe files.
0
Comment
Question by:Crius
[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
  • 2
3 Comments
 
LVL 49

Accepted Solution

by:
DanRollins earned 600 total points
ID: 6859729
Here is one way.  
Save this into a file named PlzWait.js
//------------------------------ start of file
oShell= new ActiveXObject("WScript.Shell")
var nSecsToWait= 10; // 0=wait forever

var nRet= oShell.Popup(
  "Updating your UltraZippityDooDahWhizBang Pro Gold Plus \n"
  +"application program file to Version 7.325.122\n"
  +"\n"
  +"Please wait...",  nSecsToWait,
  "Updating...", 0 | 64
);
//------------------------------ end of file

Then launch it using ShellExecute.

Windows Scripting Host is kind of like a batch file in that it is a text file that is easily written and executed.  It is better than DOS-style batch files because there is no ugly DOS prompt involved.

It is very flexible.  You can pass it command-line arguments, use any available COM objects, launch programs, get user input,... you name it.

Caveats:  I'm not certain that WSH is always available on every computer (but I think it is installed by default) and I'm not certain that .js has always been associated with WSCRIPT.EXE (if not, you can just launch WSCRIPT.EXE and pass the name of the JS file to it).

=-=-=-=-=-=-=-
One more thought:  You could create a very small application program (all it does is show the message box) and store it as a resource in your EXE.  Your program reads the resource and writes it as DoMsgBox.Exe in the user's temp directory.  You could then launch it and quit your program.
 
-- Dan
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 6859737
Incidently, if you are modifying an EXE (even if it is your own), there are many virus-detection programs that will go nuts on you.  Just a heads-up.

-- Dan
0
 
LVL 3

Author Comment

by:Crius
ID: 6869428
Awesome! Thank you for these alternatives. There is currently talk of ShellExec on iexplore.exe since everyone seems to have that (and load up a web page), but these are also worth discussion. :)
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

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

670 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