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

HOWTO: hide a component at runtime?

14 views
Skip to first unread message

Antonio Carballo

unread,
Feb 10, 1998, 3:00:00 AM2/10/98
to

I have an installation where by default a particular component (ODBC)
can be installed if the user has NT 4.0 or Windows '95 as the host OS. If
the user has NT 3.51, I want to hide the ODBC component from the user. How
can I do so?

A work-around can be to simply put up a message to the user saying that
this version of ODBC will not be installed on the workstation. This is a
sensible solution but a more elegant one would be to deselect and hide the
ODBC component. Any ideas?


/Antonio


Scott Smith

unread,
Feb 10, 1998, 3:00:00 AM2/10/98
to

This piece of code is assuming that you've set up the following variables:
bIs32BitSetup
bIsShellExplorer

They are part of Template2 I believe. If you have questions on how to
set them up, create a Template2 install and look in the CheckRequirements
function. Code follows.

--
if ((bIs32BitSetup) && (bIsShellExplorer) then
szComponent = "ODBC";
ComponentSelectItem(MEDIA, szComponent, FALSE);
endif;
-
Scott Smith
Compass Data Systems, Inc.
Salt Lake City, Utah


Antonio Carballo wrote in message <34e07...@news.installshield.com>...
:
: I have an installation where by default a particular component (ODBC)

:
:
:

Stefan Krüger

unread,
Feb 10, 1998, 3:00:00 AM2/10/98
to

Additionaly, after ComponentSelectItem, call ComponentSetData:

if ((bIs32BitSetup) && (bIsShellExplorer) then
szComponent = "ODBC";

ComponentSelectItem(MEDIA, szComponent, FALSE); // unselct component,
so it dowsn't get installed
ComponentSetData (MEDIA, szComponent, COMPONENT_FIELD_VISIBLE, FALSE,
""); // hide component
endif;

Stefan Krueger
skru...@usa.net

*** InstallSite provides free resources for setup developers
*** http://come.to/installsite


Scott Smith schrieb in Nachricht <34e07...@news.installshield.com>...

Scott Smith

unread,
Feb 10, 1998, 3:00:00 AM2/10/98
to

Stefan Krüger wrote in message <34e08...@news.installshield.com>...
:Additionaly, after ComponentSelectItem, call ComponentSetData:

:
:if ((bIs32BitSetup) && (bIsShellExplorer) then
: szComponent = "ODBC";
: ComponentSelectItem(MEDIA, szComponent, FALSE); // unselct component,
:so it dowsn't get installed
: ComponentSetData (MEDIA, szComponent, COMPONENT_FIELD_VISIBLE, FALSE,
:""); // hide component
:endif;
:

Thanks for the snippet...our installations don't give the ability to select
different
components and subcomponents, so I was unaware of te ComponentSetData
function call. I'll file that under need to know for future installs..
-
-scott smith
-Compass Data Systems, Inc.
-salt lake city, utah

James Frater

unread,
Feb 11, 1998, 3:00:00 AM2/11/98
to

Antonio, IS has functions in script to turn off components as well as make
them invisible. You can find this in the on line help -- you should make
better use of on line help. But here's your answer:

You also want to make sure and turn off the component:

svMyComponent = "MyComponent";
_ComponentSelectItem ( svMyComponent, FALSE, "Pass the name of calling
function here" );

Then also set it to be invisible:

_ComponentSetData ( svMyComponent,
COMPONENT_FIELD_VISIBLE, FALSE, szDummy, "Pass the name of calling
function here" );

Declarations: ----------------------------------

#define FN_ComponentSetData "_ComponentSetData"
prototype _ComponentSetData ( STRING, LONG, LONG,
STRING, STRING );

#define FN_ComponentSelectItem "_ComponentSelectItem"
prototype _ComponentSelectItem ( STRING, BOOL, STRING );

function _ComponentSelectItem ( szComponent, bSelect, szFuncName )

NUMBER nResult;

begin
nResult = ComponentSelectItem (MEDIA, szComponent, bSelect);
if(nResult < 0) then
_ComponentError ( nResult, "ComponentSelectItem", "",
szComponent, szFuncName ^ FN_ComponentSelectItem );
endif;
return nResult;
end; // function _ComponentSelectItem

function _ComponentSetData ( szComponent, nInfo, nvResult, svResult,
szFuncName)
LONG nResult;

begin
nResult = ComponentSetData ( MEDIA, szComponent, nInfo, nvResult,
svResult );
if(nResult < 0) then
_ComponentError ( nResult, "ComponentSetData", "",
szComponent, szFuncName ^ FN_ComponentSetData );
endif;
return nResult;
end; // function _ComponentSetData

prototype _ComponentErrorDesc ( LONG, BYREF STRING );

function _ComponentErrorDesc ( lErr, szDesc )
begin
switch ( lErr )
case -101: szDesc = 'ComponentAddItem was unable to add a component to
the script-created component set.';
case -102: szDesc = 'Specified component already exists.';
case -103: szDesc = 'ComponentSelectItem tried to select a component
that was grayed out.';
case -104: szDesc = 'Specified component name is not valid.';
case -105: szDesc = 'Specified component cannot be found in the
media.';
case -106: szDesc = 'Unable to decompress a file.';
case -107: szDesc = 'Disk ID specified in call to ComponentMoveData is
not valid.';
case -108: szDesc = 'Target disk does not have enough space. svFile
will contain target path.';
case -109: szDesc = 'EnterDisk function call failed. svFile will
contain tag file name (name of next library).';
case -112: szDesc = 'Specified file cannot be found. If svComponent and
svFileGroup are empty, svFile contains the name of the file media library
that cannot be found. If svComponent and svFileGroup are not empty, then
svFile contains the name of the file (inside the f' + 'ile media library)
that cannot be found.';
case -113: szDesc = 'Specified file cannot be opened as read-only. If
svComponent and svFileGroup are empty, svFile contains the name of the file
that cannot be opened as read-only. If svComponent and svFileGroup are not
empty, then svFile contains the name of the file' + ' (inside the file
media library) that cannot be opened as read-only.';
case -114: szDesc = 'Specified file cannot be opened as read/write. If
svComponent and svFileGroup are empty, svFile contains the name of the file
that cannot be opened as read/write. If svComponent and svFileGroup are not
empty, then svFile contains the name of the fi' + 'le (inside the file
media library) that cannot be opened as read/write.';
case -115: szDesc = 'Specified file cannot be opened as write. If
svComponent and svFileGroup are empty, svFile contains the name of the file
that cannot be opened as write. If svComponent and svFileGroup are not
empty, then svFile contains the name of the file (inside' + ' the file
media library) that cannot be opened as write.';
case -116: szDesc = 'File specification made in ComponentFileInfo is
not valid.';
case -117: szDesc = 'Cannot read the specified file. If svComponent and
svFileGroup are empty, svFile contains the name of the file that cannot be
read. If svComponent and svFileGroup are not empty, then svFile contains
the name of the file (inside the file media libra' + 'ry) that cannot be
read.';
case -118: szDesc = 'Attempted operation not allowed with script
media.';
case -119: szDesc = 'Unable to self-register a file in
ComponentMoveData. Make sure that the self-registering file self-registers
properly.';
case -120: szDesc = 'Unable to update a shared file in
ComponentMoveData.';
case -121: szDesc = 'Unable to write to a file. If svComponent and
svFileGroup are empty, svFile contains the name of the file that cannot be
written to. If svComponent and svFileGroup are not empty, then svFile
contains the name of the file (inside the file media libr' + 'ary) that
cannot be written to.';
case -123: szDesc = 'Unable to find a file group.';
case -125: szDesc = 'The list specified in call to ComponentFileEnum is
not valid.';
case -126: szDesc = 'Attempted operation not allowed with file media
library.';
case -127: szDesc = 'Media is already initialized. svFile contains the
file media library name.';
case -128: szDesc = 'Specified file media library was not generated by
the InstallShield Media Build Wizard.';
case -129: szDesc = 'Specified media name was a null string ("").';
case -132: szDesc = 'Specified media cannot be found.';
case -133: szDesc = 'An error occurred with the specified media. Must
reset the media by calling ComponentMoveData with first parameter set to a
null string ("") and remaining parameters set to values used in previous
call to ComponentMoveData.';
case -136: szDesc = 'Unable to allocate memory. svFile contains the
string for which memory was to be allocated, if applicable.';
case -137: szDesc = 'Specified option is not valid.';
case -139: szDesc = 'Specified password does not match the password
stored in the specified file media library or the component. svFile will
contain the specified password.';
case -140: szDesc = 'Tried to get password using ComponentGetData,
which is not allowed!';
case -141: szDesc = 'Specified password cannot be found. The specified
media or component does not have a password.';
case -142: szDesc = 'The media or the component password was not
validated. Make sure you validate the media or component password using
ComponentValidate. ';
case -145: szDesc = 'Target path for the component or file group cannot
be found.';
case -147: szDesc = 'Invalid value passed to a component-related
function.';
default: szDesc = 'Unknown error, probably internal error.';
endswitch;
end; // function _ComponentErrorDesc

prototype _ComponentError ( LONG, STRING, STRING, STRING, STRING );
#define _const_NOCOMPONENT "<no component parameter for this
function>"

function _ComponentError ( lRetVal, svComponentFuncName, svMiscMessageSnip,
svActualComponent, svContextFuncName )

// ComponentError parms:
STRING svMedia, svComponent, svFileGroup, svFile, szDesc;
LONG nvError;

begin
if ( lRetVal < 0 ) then
ComponentError ( svMedia, svComponent, svFileGroup, svFile, nvError
);
_ComponentErrorDesc ( nvError, szDesc );
SprintfBox( INFORMATION, "Component Function Error Information",
'%s' +
'Component Function "%s" had the following error:\n\n' +
"Media Name: %s\nActual Component: %s [Component reported by
InstallShield: %s]\nFile Group: %s\n" +
"File: %s\nError Number reported by ComponentError:
%ld\n[Original Error Number: %ld]\n" +
"Called from function: %s\n\nExtended Description: %s",
svMiscMessageSnip,
svComponentFuncName,
svMedia, svActualComponent, svComponent, svFileGroup,
svFile, nvError, lRetVal,
svContextFuncName, szDesc );
return lRetVal;
else
return 0;
endif;
end; // function _ComponentError

Antonio Carballo <acar...@mantissa.com> wrote in article

0 new messages