Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using SendMessage with Windows NT

63 views
Skip to first unread message

Bill Keane

unread,
Aug 18, 1999, 3:00:00 AM8/18/99
to
I'm having a problem in my script when I use the SendMessage to tell
Windows NT that the environment has changed after I do serveral registry
additions/changes. I found many examples on how to do this function but
everything I try locks up my install program and the NT OS states that
my setup program is no longer responding. I just including the code that
pertains to the SendMessage function that I am using. Here is that code:

#define WM_SETTINGCHANGE 0x001A
#define HWND_BROADCAST 0xffff

POINTER pEnv;

program

//
//
//
This is where I add several environment varible to the registry like
MY_HOME, LIB, and additions to the PATH statement.
//
//
szEnv = "Environment";
pEnv = &szEnv;

SendMessage (HWND_BROADCAST, WM_SETTINGCHANGE, 0, pEnv);

//
//
endprogram

During the installation when it gets to the SendMessage command the
setup program just hangs. If I look in Task Manager the setup program is
no longer responding so I have to End Task. When I go to the Command
Prompt I noticed that the environment varibles have been set and sent to
the Windows NT OS. I believe that the install program is not getting a
response back from the Windows API and then therefore it hangs. Then
again, I'm not a programmer.

Am I doing something wrong or did I hit a bug. Any help is greatly
appreciated. Thanks in advance.

Bill
P.S.
I'm using Professional version 5.51 of InstallShield and here are the
dates of my files:
---Redistributable Files\English-Windows 3.x---
setup.exe-5.50.137
_setup.dll-5.50.134
_isres.dll-5.50.131
_inst16.ex_-5.50.137
isun16.exe-5.51.138
---Redistributable Files\English-Windows 95/98 & NT 3.51/4.0---
setup.exe-5.50.137
_setup.dll-5.50.134
_isres.dll-5.50.131
_inst32i.ex_-5.50.137
isuninst.exe-5.51.138
---Program Files---
IDE.exe-5.50.136
BuildWiz.dll-5.50.135
Compiler.dll-5.50.134
ZDataI51.dll-5.50.131
ISEdt.dll-5.50.134
ISCore.dll-5.50.135
Build.dll-5.50.135
ISBuild.exe-5.50.134
ISCAB.exe-5.50.134
Compile.exe-5.50.134

Fred Bleuzet

unread,
Aug 18, 1999, 3:00:00 AM8/18/99
to
Well, it looks like your installation behaves better than mine (IS5.53).
I assume that you try to broadcast the change in the System Path. For me,
when I access (read for example) a long System Path (not even the 512
character limit mentioned in the knowledge base), I can get randomly hanging
problems, GPFs, empty message boxes anywhere in the code after the registry
access.
Fed up with this discouraging behavior, I decided to export all accesses to
the System Path to a custom DLL. It's so painful, but at least it works.
I sincerely don't recommend to touch the environment variables from within
IS script.

Fred


Bill Keane wrote in message <37BB36C6...@Cyborg.com>...

InstallShield Software Corp.

unread,
Aug 19, 1999, 3:00:00 AM8/19/99
to
This is definitely not an IS bug. The nature of SendMessage is that it will
not return until all running applications handle the Message.
If you have an application that is not processing its message queue, then
you can expect this behavior. For this reason, I would recommend calling the
PostMessage instead. PostMessage is exported from user32 it takes the same
parameters that you are calling SendMessage with.
It places the message into the queues and returns back to you immediately.

Kind regards,

Eric
InstallShield Support

Bill Keane

unread,
Aug 23, 1999, 3:00:00 AM8/23/99
to
I used PostMessage with the same parameters as you suggested but that still
does not work!!! Although the install program does not lock up on me but to
me it seems that PostMessage does nothing. Once the install program is
finished I exit to the command prompt and echo %MYAPP_HOME% and it shows
that the environment varible is not set. So it did not broadcast to the OS
that changes were made to the system environment varibles. Am I doing
something wrong? You mentioned that PostMessage is exported from user32.dll
and since this is a standard dll the install automaically opens I am not
using UseDLL, or should I????

I got this idea originally from a Knowledge Base article Q100090 which gives
examples for SendMessage in the attached rul files. I originally wanted to
launch a series of batch files that referanced the MYAPP_HOME varible and I
wanted to lauch these before a reboot. I do not want to modify each of the
batch files in order to launch them. and the batch files are doing things
that themselves require a re-boot (Updateing service file, create an Orbix
Naming Service, registering applications to the Orbix daemon, for example).
So I do not want to launch these batch files after a re-boot because that
would require my users to re-boot twice.

Is this a function (SendMessage/PostMessage) that really works? Or should I
just bit the bullet and have them re-boot twice.

Any help is greatly appreciated.

Bill


InstallShield Software Corp. wrote in message
<37bc6...@news.installshield.com>...

Michelle Mc Sharry

unread,
Sep 7, 1999, 3:00:00 AM9/7/99
to
define your parameter, WM_SETTINGCHANGE as 0x0187 to fix the hex problem
with NT
0 new messages