///////write it in separate .rul file and name it for example reboot.rul/////
#define TITLE_TEXT "reboot example"
// Include Ifx.h for built-in InstallScript function prototypes.
#include "Ifx.h"
prototype kRebootDialog();
function kRebootDialog()
NUMBER nvDefChoice;
begin
// Query to reboot computer.
RebootDialog (TITLE_TEXT, "", 0);
end;
///////////////////////////call this function in a separate .rul file. and include ........
#include "reboot.rul"
function OnFirstUIBefore()
begin
kRebootDialog();
end;
Tuesday, October 5, 2010
Monday, October 4, 2010
mail.rul
//===========================================================================
//
// File Name: Setup.rul
//
// Description: Blank setup main script file
//
// Comments: Blank setup is an empty setup project. If you want to
// create a new project via. step-by step instructions use the
// Project Assistant.
//
//===========================================================================
// Included header files ----------------------------------------------------
#include "ifx.h"
#include "diskspace.rul"
#include "addint.rul"
#include "concatenate.rul"
#include "createlist.rul"
#include "readwritetext.rul"
#include "listinfo.rul"
//---------------------------------------------------------------------------
// OnFirstUIBefore
//
// First Install UI Sequence - Before Move Data
//
// The OnFirstUIBefore event is called by OnShowUI when the setup is
// running in first install mode. By default this event displays UI allowing
// the end user to specify installation parameters.
//
// Note: This event will not be called automatically in a
// program...endprogram style setup.
//---------------------------------------------------------------------------
function OnFirstUIBefore()
number nResult, nLevel, nSize, nSetupType,listID, listInfo,nvVar, nSum;
number nFirst, nSecond;
string szTitle, szMsg,sconcat ,szOpt1,sfirststring,ssecondstring, svconcat, szOpt2, szLicenseFile,sthirdstring,szString, svSum;
string szName, szCompany, szTargetPath, szDir, szFeatures, szTargetdir;
BOOL bLicenseAccepted,bIsEnoughDiskSpace,hMSI,concatenate_example, list_add_example,list_info_example;
begin
list_info_example= list_info();
if(list_info_example) then
// SdShowInfoList (szTitle, szMsg, listInfo);
endif;
list_info();
readandwrite();
readline();
nFirst=2;
nSecond=3;
nSum = Addint(nFirst, nSecond);
NumToStr ( svSum, nSum );
MessageBox(svSum, INFORMATION);
////concatenate///
sfirststring="hello";
ssecondstring="Everybody";
sconcat=concatenate(sfirststring,ssecondstring);
//NumToStr( svconcat, sconcat);
MessageBox(sconcat, INFORMATION);
list_add_example= ListAddStrings();
if( list_add_example) then
szString = "Keyboard";
MessageBox (szString, INFORMATION);
endif;
// prototype BOOL ExFn_GetSystemInfo(hMSI);
//Add_to_int=Add_to_integer();
//if(Add_to_int) then
// MessageBox ("sum", INFORMATION);
//endif;
bIsEnoughDiskSpace=Get_disk_Space();
if!(bIsEnoughDiskSpace) then
MessageBox ("not enough space", SEVERE);
//abort;
endif;
nSetupType = COMPLETE;
szDir = TARGETDIR;
szName = "";
szCompany = "";
bLicenseAccepted = FALSE;
// ExFn_GetSystemInfo(hMSI);
// Beginning of UI Sequence
Dlg_Start:
nResult = 0;
Dlg_SdWelcome:
szTitle = "";
szMsg = "";
//{{IS_SCRIPT_TAG(Dlg_SdWelcome)
nResult = SdWelcome( szTitle, szMsg );
//}}IS_SCRIPT_TAG(Dlg_SdWelcome)
if (nResult = BACK) goto Dlg_Start;
Dlg_SdLicense2:
szTitle = "";
szOpt1 = "";
szOpt2 = "";
//{{IS_SCRIPT_TAG(License_File_Path)
szLicenseFile = SUPPORTDIR ^ "License.rtf";
//}}IS_SCRIPT_TAG(License_File_Path)
//{{IS_SCRIPT_TAG(Dlg_SdLicense2)
nResult = SdLicense2Rtf( szTitle, szOpt1, szOpt2, szLicenseFile, bLicenseAccepted );
//}}IS_SCRIPT_TAG(Dlg_SdLicense2)
if (nResult = BACK) then
goto Dlg_SdWelcome;
else
bLicenseAccepted = TRUE;
endif;
Dlg_SdRegisterUser:
szMsg = "";
szTitle = "";
//{{IS_SCRIPT_TAG(Dlg_SdRegisterUser)
nResult = SdRegisterUser( szTitle, szMsg, szName, szCompany );
//}}IS_SCRIPT_TAG(Dlg_SdRegisterUser)
if (nResult = BACK) goto Dlg_SdLicense2;
Dlg_SetupType2:
szTitle = "";
szMsg = "";
nResult = CUSTOM;
//{{IS_SCRIPT_TAG(Dlg_SetupType2)
nResult = SetupType2( szTitle, szMsg, "", nSetupType, 0 );
//}}IS_SCRIPT_TAG(Dlg_SetupType2)
if (nResult = BACK) then
goto Dlg_SdRegisterUser;
else
nSetupType = nResult;
if (nSetupType != CUSTOM) then
szTargetPath = TARGETDIR;
nSize = 0;
FeatureCompareSizeRequired( MEDIA, szTargetPath, nSize );
if (nSize != 0) then
MessageBox( szSdStr_NotEnoughSpace, WARNING );
goto Dlg_SetupType2;
endif;
endif;
endif;
Dlg_SdAskDestPath2:
if ((nResult = BACK) && (nSetupType != CUSTOM)) goto Dlg_SetupType2;
szTitle = "";
szMsg = "";
if (nSetupType = CUSTOM) then
//{{IS_SCRIPT_TAG(Dlg_SdAskDestPath2)
nResult = SdAskDestPath2( szTitle, szMsg, szDir );
//}}IS_SCRIPT_TAG(Dlg_SdAskDestPath2)
TARGETDIR = szDir;
endif;
if (nResult = BACK) goto Dlg_SetupType2;
Dlg_SdFeatureTree:
if ((nResult = BACK) && (nSetupType != CUSTOM)) goto Dlg_SdAskDestPath2;
szTitle = "";
szMsg = "";
szTargetdir = TARGETDIR;
szFeatures = "";
nLevel = 2;
if (nSetupType = CUSTOM) then
//{{IS_SCRIPT_TAG(Dlg_SdFeatureTree)
nResult = SdFeatureTree( szTitle, szMsg, szTargetdir, szFeatures, nLevel );
//}}IS_SCRIPT_TAG(Dlg_SdFeatureTree)
if (nResult = BACK) goto Dlg_SdAskDestPath2;
endif;
Dlg_SQLServer:
nResult = OnSQLServerInitialize( nResult );
if( nResult = BACK ) goto Dlg_SdFeatureTree;
Dlg_ObjDialogs:
nResult = ShowObjWizardPages( nResult );
if (nResult = BACK) goto Dlg_SQLServer;
Dlg_SdStartCopy2:
szTitle = "";
szMsg = "";
//{{IS_SCRIPT_TAG(Dlg_SdStartCopy2)
nResult = SdStartCopy2( szTitle, szMsg );
//}}IS_SCRIPT_TAG(Dlg_SdStartCopy2)
if (nResult = BACK) goto Dlg_ObjDialogs;
// Added in 11.0 - Set appropriate StatusEx static text.
SetStatusExStaticText( SdLoadString( IDS_IFX_STATUSEX_STATICTEXT_FIRSTUI ) );
return 0;
end;
//---------------------------------------------------------------------------
// OnMaintUIBefore
//
// Maintenance UI Sequence - Before Move Data
//
// The OnMaintUIBefore event is called by OnShowUI when the setup is
// running in maintenance mode. By default this event displays UI that
// allows the end user to add or remove features, repair currently
// installed features or uninstall the application.
//
// Note: This event will not be called automatically in a
// program...endprogram style setup.
//---------------------------------------------------------------------------
function OnMaintUIBefore()
number nResult, nType, nMediaFlags;
string szTitle, szMsg, szIgnore;
begin
// nType defaults to MODIFY.
nType = MODIFY;
//Initialize SQL
OnSQLServerInitializeMaint();
// Beginning of UI Sequence
Dlg_Start:
// Added in Version 9.5 - Support for REMOVEONLY option.
if( !REMOVEONLY ) then
// In standard mode show maintenance dialog
Disable( BACKBUTTON );
nType = SdWelcomeMaint( szTitle, szMsg, nType );
Enable( BACKBUTTON );
nResult = NEXT;
else
// Hide the initial progress dialog as otherwise the user can
// click on it, and hide the MessageBox.
Disable( DIALOGCACHE );
// In RemoveOnly mode, set to remove.
nType = REMOVEALL;
endif;
// Show Uninstall Confirmation Dialog
if ( nType = REMOVEALL ) then
nResult = MessageBox( SdLoadString( IFX_MAINTUI_MSG ), MB_YESNO );
if (nResult != IDYES ) then
if( REMOVEONLY ) then
// In REMOVEONLY mode, abort the setup.
abort;
else
// In non-REMOVEONLY mode, redisplay the previous dialog.
goto Dlg_Start;
endif;
endif;
endif;
Dlg_SdFeatureTree:
if ( nType = MODIFY ) then
szTitle = "";
szMsg = SdLoadString( SD_STR_COMPONENT_MAINT_MSG );
nResult = SdFeatureTree( szTitle, szMsg, TARGETDIR, "", -1 );
if ( nResult = BACK ) goto Dlg_Start;
endif;
Dlg_ObjDialogs:
nResult = ShowObjWizardPages( nResult );
if ( ( nResult = BACK ) && ( nType != MODIFY ) ) goto Dlg_Start;
if ( ( nResult = BACK ) && ( nType = MODIFY ) ) goto Dlg_SdFeatureTree;
switch(nType)
case REMOVEALL:
// Ensure that all previously installed features are removed
// for media that supports updating.
MediaGetData( MEDIA, MEDIA_FIELD_MEDIA_FLAGS, nMediaFlags, szIgnore );
if( nMediaFlags & MEDIA_FLAG_UPDATEMODE_SUPPORTED ) then
FeatureRemoveAllInMediaAndLog();
else
FeatureRemoveAllInMedia();
endif;
// Added in 11.0 - Set appropriate StatusEx static text.
SetStatusExStaticText( SdLoadString( IDS_IFX_STATUSEX_STATICTEXT_MAINTUI_REMOVEALL ) );
case REPAIR:
// Changed for DevStudio 9, Disk1 files are now always updated when installed
// so when running from ADDREMOVE we need to prevent these files from being
// updated since this will result in files being updated that are locked by the setup.
// Updating these files when running from ADDREMOVE should not be needed since updates
// are not run directly from Add/Remove.
if( ADDREMOVE ) then
// Reinstall all previously installed features, except
// disk1 features.
FeatureUpdate( "" );
else
// Reinstall all previously installed features.
FeatureReinstall();
endif;
// Added in 11.0 - Set appropriate StatusEx static text.
SetStatusExStaticText( SdLoadString( IDS_IFX_STATUSEX_STATICTEXT_MAINTUI_REPAIR ) );
case MODIFY:
// Added in 11.0 - Set appropriate StatusEx static text.
SetStatusExStaticText( SdLoadString( IDS_IFX_STATUSEX_STATICTEXT_MAINTUI_MODIFY ) );
endswitch;
end;
//---------------------------------------------------------------------------
// OnFirstUIAfter
//
// First Install UI Sequence - After Move Data
//
// The OnFirstUIAfter event called by OnShowUI after the file transfer
// of the setup when the setup is running in first install mode. By default
// this event displays UI that informs the end user that the setup has been
// completed successfully.
//
// Note: This event will not be called automatically in a
// program...endprogram style setup.
//---------------------------------------------------------------------------
function OnFirstUIAfter()
STRING szTitle, szMsg1, szMsg2, szOpt1, szOpt2;
NUMBER bvOpt1, bvOpt2;
NUMBER bShowUpdateServiceDlg;
begin
ShowObjWizardPages(NEXT);
szTitle = "";
szMsg1 = "";
szMsg2 = "";
szOpt1 = "";
szOpt2 = "";
bvOpt1 = FALSE;
bvOpt2 = FALSE;
// Set this to true if you have the update service enabled, and if you want to check for updates.
// Note: the ISUS Starter Edition does not support checking for updates programatically. So,
// only set this to true if you have at least the ISUS Professional Edition.
bShowUpdateServiceDlg = FALSE;
//{{IS_SCRIPT_TAG(Dlg_SdDinishEx)
if ( BATCH_INSTALL ) then
SdFinishReboot ( szTitle , szMsg1 , SYS_BOOTMACHINE , szMsg2 , 0 );
else
// If the update service is enabled, show finish dialog that includes
// update check option.
if( bShowUpdateServiceDlg && ( ENABLED_ISERVICES & SERVICE_ISUPDATE ) ) then
if( SdFinishUpdateEx( szTitle, szMsg1, szMsg2, szOpt1, szOpt2, TRUE ) ) then
// Don't check for updates in silent mode.
if( MODE != SILENTMODE ) then
UpdateServiceCheckForUpdates( "", FALSE );
endif;
endif;
else
SdFinish ( szTitle , szMsg1 , szMsg2 , szOpt1 , szOpt2 , bvOpt1 , bvOpt2 );
endif;
endif;
//}}IS_SCRIPT_TAG(Dlg_SdDinishEx)
end;
//---------------------------------------------------------------------------
// OnMaintUIAfter
//
// The OnMaintUIAfter event called by OnShowUI after the file transfer
// of the setup when the setup is running in maintenance mode. By default
// this event displays UI that informs the end user that the maintenance setup
// has been completed successfully.
//
// Note: This event will not be called automatically in a
// program...endprogram style setup.
//---------------------------------------------------------------------------
function OnMaintUIAfter()
STRING szTitle, szMsg1, szMsg2, szOpt1, szOpt2;
NUMBER bvOpt1, bvOpt2;
begin
ShowObjWizardPages(NEXT);
// Added - Version 9.5 - Use appropriate strings for complete
// uninstall.
if( REMOVEALLMODE ) then
szTitle = SdLoadString(IFX_SDFINISH_REMOVE_TITLE);
szMsg1 = SdLoadString(IFX_SDFINISH_REMOVE_MSG1);
else
szTitle = SdLoadString(IFX_SDFINISH_MAINT_TITLE);
szMsg1 = SdLoadString(IFX_SDFINISH_MAINT_MSG1);
endif;
szMsg2 = "";
szOpt1 = "";
szOpt2 = "";
bvOpt1 = FALSE;
bvOpt2 = FALSE;
if ( BATCH_INSTALL ) then
SdFinishReboot ( szTitle , szMsg1 , SYS_BOOTMACHINE , szMsg2 , 0 );
else
SdFinish ( szTitle , szMsg1 , szMsg2 , szOpt1 , szOpt2 , bvOpt1 , bvOpt2 );
endif;
end;
//
// File Name: Setup.rul
//
// Description: Blank setup main script file
//
// Comments: Blank setup is an empty setup project. If you want to
// create a new project via. step-by step instructions use the
// Project Assistant.
//
//===========================================================================
// Included header files ----------------------------------------------------
#include "ifx.h"
#include "diskspace.rul"
#include "addint.rul"
#include "concatenate.rul"
#include "createlist.rul"
#include "readwritetext.rul"
#include "listinfo.rul"
//---------------------------------------------------------------------------
// OnFirstUIBefore
//
// First Install UI Sequence - Before Move Data
//
// The OnFirstUIBefore event is called by OnShowUI when the setup is
// running in first install mode. By default this event displays UI allowing
// the end user to specify installation parameters.
//
// Note: This event will not be called automatically in a
// program...endprogram style setup.
//---------------------------------------------------------------------------
function OnFirstUIBefore()
number nResult, nLevel, nSize, nSetupType,listID, listInfo,nvVar, nSum;
number nFirst, nSecond;
string szTitle, szMsg,sconcat ,szOpt1,sfirststring,ssecondstring, svconcat, szOpt2, szLicenseFile,sthirdstring,szString, svSum;
string szName, szCompany, szTargetPath, szDir, szFeatures, szTargetdir;
BOOL bLicenseAccepted,bIsEnoughDiskSpace,hMSI,concatenate_example, list_add_example,list_info_example;
begin
list_info_example= list_info();
if(list_info_example) then
// SdShowInfoList (szTitle, szMsg, listInfo);
endif;
list_info();
readandwrite();
readline();
nFirst=2;
nSecond=3;
nSum = Addint(nFirst, nSecond);
NumToStr ( svSum, nSum );
MessageBox(svSum, INFORMATION);
////concatenate///
sfirststring="hello";
ssecondstring="Everybody";
sconcat=concatenate(sfirststring,ssecondstring);
//NumToStr( svconcat, sconcat);
MessageBox(sconcat, INFORMATION);
list_add_example= ListAddStrings();
if( list_add_example) then
szString = "Keyboard";
MessageBox (szString, INFORMATION);
endif;
// prototype BOOL ExFn_GetSystemInfo(hMSI);
//Add_to_int=Add_to_integer();
//if(Add_to_int) then
// MessageBox ("sum", INFORMATION);
//endif;
bIsEnoughDiskSpace=Get_disk_Space();
if!(bIsEnoughDiskSpace) then
MessageBox ("not enough space", SEVERE);
//abort;
endif;
nSetupType = COMPLETE;
szDir = TARGETDIR;
szName = "";
szCompany = "";
bLicenseAccepted = FALSE;
// ExFn_GetSystemInfo(hMSI);
// Beginning of UI Sequence
Dlg_Start:
nResult = 0;
Dlg_SdWelcome:
szTitle = "";
szMsg = "";
//{{IS_SCRIPT_TAG(Dlg_SdWelcome)
nResult = SdWelcome( szTitle, szMsg );
//}}IS_SCRIPT_TAG(Dlg_SdWelcome)
if (nResult = BACK) goto Dlg_Start;
Dlg_SdLicense2:
szTitle = "";
szOpt1 = "";
szOpt2 = "";
//{{IS_SCRIPT_TAG(License_File_Path)
szLicenseFile = SUPPORTDIR ^ "License.rtf";
//}}IS_SCRIPT_TAG(License_File_Path)
//{{IS_SCRIPT_TAG(Dlg_SdLicense2)
nResult = SdLicense2Rtf( szTitle, szOpt1, szOpt2, szLicenseFile, bLicenseAccepted );
//}}IS_SCRIPT_TAG(Dlg_SdLicense2)
if (nResult = BACK) then
goto Dlg_SdWelcome;
else
bLicenseAccepted = TRUE;
endif;
Dlg_SdRegisterUser:
szMsg = "";
szTitle = "";
//{{IS_SCRIPT_TAG(Dlg_SdRegisterUser)
nResult = SdRegisterUser( szTitle, szMsg, szName, szCompany );
//}}IS_SCRIPT_TAG(Dlg_SdRegisterUser)
if (nResult = BACK) goto Dlg_SdLicense2;
Dlg_SetupType2:
szTitle = "";
szMsg = "";
nResult = CUSTOM;
//{{IS_SCRIPT_TAG(Dlg_SetupType2)
nResult = SetupType2( szTitle, szMsg, "", nSetupType, 0 );
//}}IS_SCRIPT_TAG(Dlg_SetupType2)
if (nResult = BACK) then
goto Dlg_SdRegisterUser;
else
nSetupType = nResult;
if (nSetupType != CUSTOM) then
szTargetPath = TARGETDIR;
nSize = 0;
FeatureCompareSizeRequired( MEDIA, szTargetPath, nSize );
if (nSize != 0) then
MessageBox( szSdStr_NotEnoughSpace, WARNING );
goto Dlg_SetupType2;
endif;
endif;
endif;
Dlg_SdAskDestPath2:
if ((nResult = BACK) && (nSetupType != CUSTOM)) goto Dlg_SetupType2;
szTitle = "";
szMsg = "";
if (nSetupType = CUSTOM) then
//{{IS_SCRIPT_TAG(Dlg_SdAskDestPath2)
nResult = SdAskDestPath2( szTitle, szMsg, szDir );
//}}IS_SCRIPT_TAG(Dlg_SdAskDestPath2)
TARGETDIR = szDir;
endif;
if (nResult = BACK) goto Dlg_SetupType2;
Dlg_SdFeatureTree:
if ((nResult = BACK) && (nSetupType != CUSTOM)) goto Dlg_SdAskDestPath2;
szTitle = "";
szMsg = "";
szTargetdir = TARGETDIR;
szFeatures = "";
nLevel = 2;
if (nSetupType = CUSTOM) then
//{{IS_SCRIPT_TAG(Dlg_SdFeatureTree)
nResult = SdFeatureTree( szTitle, szMsg, szTargetdir, szFeatures, nLevel );
//}}IS_SCRIPT_TAG(Dlg_SdFeatureTree)
if (nResult = BACK) goto Dlg_SdAskDestPath2;
endif;
Dlg_SQLServer:
nResult = OnSQLServerInitialize( nResult );
if( nResult = BACK ) goto Dlg_SdFeatureTree;
Dlg_ObjDialogs:
nResult = ShowObjWizardPages( nResult );
if (nResult = BACK) goto Dlg_SQLServer;
Dlg_SdStartCopy2:
szTitle = "";
szMsg = "";
//{{IS_SCRIPT_TAG(Dlg_SdStartCopy2)
nResult = SdStartCopy2( szTitle, szMsg );
//}}IS_SCRIPT_TAG(Dlg_SdStartCopy2)
if (nResult = BACK) goto Dlg_ObjDialogs;
// Added in 11.0 - Set appropriate StatusEx static text.
SetStatusExStaticText( SdLoadString( IDS_IFX_STATUSEX_STATICTEXT_FIRSTUI ) );
return 0;
end;
//---------------------------------------------------------------------------
// OnMaintUIBefore
//
// Maintenance UI Sequence - Before Move Data
//
// The OnMaintUIBefore event is called by OnShowUI when the setup is
// running in maintenance mode. By default this event displays UI that
// allows the end user to add or remove features, repair currently
// installed features or uninstall the application.
//
// Note: This event will not be called automatically in a
// program...endprogram style setup.
//---------------------------------------------------------------------------
function OnMaintUIBefore()
number nResult, nType, nMediaFlags;
string szTitle, szMsg, szIgnore;
begin
// nType defaults to MODIFY.
nType = MODIFY;
//Initialize SQL
OnSQLServerInitializeMaint();
// Beginning of UI Sequence
Dlg_Start:
// Added in Version 9.5 - Support for REMOVEONLY option.
if( !REMOVEONLY ) then
// In standard mode show maintenance dialog
Disable( BACKBUTTON );
nType = SdWelcomeMaint( szTitle, szMsg, nType );
Enable( BACKBUTTON );
nResult = NEXT;
else
// Hide the initial progress dialog as otherwise the user can
// click on it, and hide the MessageBox.
Disable( DIALOGCACHE );
// In RemoveOnly mode, set to remove.
nType = REMOVEALL;
endif;
// Show Uninstall Confirmation Dialog
if ( nType = REMOVEALL ) then
nResult = MessageBox( SdLoadString( IFX_MAINTUI_MSG ), MB_YESNO );
if (nResult != IDYES ) then
if( REMOVEONLY ) then
// In REMOVEONLY mode, abort the setup.
abort;
else
// In non-REMOVEONLY mode, redisplay the previous dialog.
goto Dlg_Start;
endif;
endif;
endif;
Dlg_SdFeatureTree:
if ( nType = MODIFY ) then
szTitle = "";
szMsg = SdLoadString( SD_STR_COMPONENT_MAINT_MSG );
nResult = SdFeatureTree( szTitle, szMsg, TARGETDIR, "", -1 );
if ( nResult = BACK ) goto Dlg_Start;
endif;
Dlg_ObjDialogs:
nResult = ShowObjWizardPages( nResult );
if ( ( nResult = BACK ) && ( nType != MODIFY ) ) goto Dlg_Start;
if ( ( nResult = BACK ) && ( nType = MODIFY ) ) goto Dlg_SdFeatureTree;
switch(nType)
case REMOVEALL:
// Ensure that all previously installed features are removed
// for media that supports updating.
MediaGetData( MEDIA, MEDIA_FIELD_MEDIA_FLAGS, nMediaFlags, szIgnore );
if( nMediaFlags & MEDIA_FLAG_UPDATEMODE_SUPPORTED ) then
FeatureRemoveAllInMediaAndLog();
else
FeatureRemoveAllInMedia();
endif;
// Added in 11.0 - Set appropriate StatusEx static text.
SetStatusExStaticText( SdLoadString( IDS_IFX_STATUSEX_STATICTEXT_MAINTUI_REMOVEALL ) );
case REPAIR:
// Changed for DevStudio 9, Disk1 files are now always updated when installed
// so when running from ADDREMOVE we need to prevent these files from being
// updated since this will result in files being updated that are locked by the setup.
// Updating these files when running from ADDREMOVE should not be needed since updates
// are not run directly from Add/Remove.
if( ADDREMOVE ) then
// Reinstall all previously installed features, except
// disk1 features.
FeatureUpdate( "" );
else
// Reinstall all previously installed features.
FeatureReinstall();
endif;
// Added in 11.0 - Set appropriate StatusEx static text.
SetStatusExStaticText( SdLoadString( IDS_IFX_STATUSEX_STATICTEXT_MAINTUI_REPAIR ) );
case MODIFY:
// Added in 11.0 - Set appropriate StatusEx static text.
SetStatusExStaticText( SdLoadString( IDS_IFX_STATUSEX_STATICTEXT_MAINTUI_MODIFY ) );
endswitch;
end;
//---------------------------------------------------------------------------
// OnFirstUIAfter
//
// First Install UI Sequence - After Move Data
//
// The OnFirstUIAfter event called by OnShowUI after the file transfer
// of the setup when the setup is running in first install mode. By default
// this event displays UI that informs the end user that the setup has been
// completed successfully.
//
// Note: This event will not be called automatically in a
// program...endprogram style setup.
//---------------------------------------------------------------------------
function OnFirstUIAfter()
STRING szTitle, szMsg1, szMsg2, szOpt1, szOpt2;
NUMBER bvOpt1, bvOpt2;
NUMBER bShowUpdateServiceDlg;
begin
ShowObjWizardPages(NEXT);
szTitle = "";
szMsg1 = "";
szMsg2 = "";
szOpt1 = "";
szOpt2 = "";
bvOpt1 = FALSE;
bvOpt2 = FALSE;
// Set this to true if you have the update service enabled, and if you want to check for updates.
// Note: the ISUS Starter Edition does not support checking for updates programatically. So,
// only set this to true if you have at least the ISUS Professional Edition.
bShowUpdateServiceDlg = FALSE;
//{{IS_SCRIPT_TAG(Dlg_SdDinishEx)
if ( BATCH_INSTALL ) then
SdFinishReboot ( szTitle , szMsg1 , SYS_BOOTMACHINE , szMsg2 , 0 );
else
// If the update service is enabled, show finish dialog that includes
// update check option.
if( bShowUpdateServiceDlg && ( ENABLED_ISERVICES & SERVICE_ISUPDATE ) ) then
if( SdFinishUpdateEx( szTitle, szMsg1, szMsg2, szOpt1, szOpt2, TRUE ) ) then
// Don't check for updates in silent mode.
if( MODE != SILENTMODE ) then
UpdateServiceCheckForUpdates( "", FALSE );
endif;
endif;
else
SdFinish ( szTitle , szMsg1 , szMsg2 , szOpt1 , szOpt2 , bvOpt1 , bvOpt2 );
endif;
endif;
//}}IS_SCRIPT_TAG(Dlg_SdDinishEx)
end;
//---------------------------------------------------------------------------
// OnMaintUIAfter
//
// The OnMaintUIAfter event called by OnShowUI after the file transfer
// of the setup when the setup is running in maintenance mode. By default
// this event displays UI that informs the end user that the maintenance setup
// has been completed successfully.
//
// Note: This event will not be called automatically in a
// program...endprogram style setup.
//---------------------------------------------------------------------------
function OnMaintUIAfter()
STRING szTitle, szMsg1, szMsg2, szOpt1, szOpt2;
NUMBER bvOpt1, bvOpt2;
begin
ShowObjWizardPages(NEXT);
// Added - Version 9.5 - Use appropriate strings for complete
// uninstall.
if( REMOVEALLMODE ) then
szTitle = SdLoadString(IFX_SDFINISH_REMOVE_TITLE);
szMsg1 = SdLoadString(IFX_SDFINISH_REMOVE_MSG1);
else
szTitle = SdLoadString(IFX_SDFINISH_MAINT_TITLE);
szMsg1 = SdLoadString(IFX_SDFINISH_MAINT_MSG1);
endif;
szMsg2 = "";
szOpt1 = "";
szOpt2 = "";
bvOpt1 = FALSE;
bvOpt2 = FALSE;
if ( BATCH_INSTALL ) then
SdFinishReboot ( szTitle , szMsg1 , SYS_BOOTMACHINE , szMsg2 , 0 );
else
SdFinish ( szTitle , szMsg1 , szMsg2 , szOpt1 , szOpt2 , bvOpt1 , bvOpt2 );
endif;
end;
create disk space
#include "Ifx.h"
prototype Get_disk_Space();
function Get_disk_Space()
STRING szDrive,svResultPath;
long freespace,i;
NUMBER nvResult;
///LIST listInfo;
begin
freespace=0;
AskPath ("Select drive:", "C:\\", svResultPath);
i=0;
freespace= GetDiskSpace(szDrive);
if(freespace<i) then
// MessageBox ("not enough space", SEVERE);
// Disable (NEXTBUTTON);
endif;
if(freespace>i) then
Enable (NEXTBUTTON);
// MessageBox ("enough space,go ahead", INFORMATION);
endif;
///Enable (FINISHBUTTON);
end;
// Create a list for system information.
// listInfo = ListCreate (STRINGLIST);
// Get the amount of extended memory.
// if (GetSystemInfo (EXTENDEDMEMORY, nvResult, svResult) < 0) then
// szInfo = "Couldn't get EXTENDEDMEMORY info.";
// else
// Sprintf(szInfo, "Extended memory: %d K", nvResult);
// endif;
// Add the information to the list.
// ListAddString(listInfo, szInfo, AFTER);
// Get the boot drive.
// if (GetSystemInfo (BOOTUPDRIVE, nvResult, svResult) < 0) then
// szInfo = "Couldn't get BOOTUPDRIVE info.";
// else
// Sprintf(szInfo, "Boot drive: %s", svResult);
//endif;
// Add the information to the list.
// ListAddString(listInfo, szInfo, AFTER);
// Get info about the CD-ROM.
// if (GetSystemInfo (CDROM, nvResult, svResult) < 0) then
// szInfo = "Couldn't get CD-ROM info.";
// else
// if (nvResult = 0) then
// svResult = "No";
// else
// svResult = "Yes";
// endif;
// Sprintf(szInfo, "CDROM: %s", svResult);
//endif;
// Add the information to the list.
// ListAddString(listInfo, szInfo, AFTER);
// Get the video adapter.
// if (GetSystemInfo (VIDEO, nvResult, svResult) < 0) then
// szInfo = "Couldn't get VIDEO info.";
// else
// switch (nvResult)
// case IS_UNKNOWN:
// szInfo = "VIDEO: UNKNOWN";
// case IS_SVGA:
// szInfo = "VIDEO: SVGA";
// case IS_XVGA:
// szInfo = "VIDEO: XVGA";
//// case IS_UVGA:
// szInfo = "VIDEO: UVGA";
// endswitch;
// endif;
// Add the information to the list.
//ListAddString(listInfo, szInfo, AFTER);
// Get number of available colors.
//if (GetSystemInfo (COLORS, nvResult, svResult) < 0) then
//szInfo = "Couldn't get COLORS info.";
// else
// Sprintf(szInfo, "Number of colors: %d", nvResult);
//endif;
// Add the information to the list.
// ListAddString(listInfo, szInfo, AFTER);
// Get the current date.
// if (GetSystemInfo (DATE, nvResult, svResult) < 0) then
// szInfo = "Couldn't get DATE info.";
// else
// Sprintf(szInfo, "DATE: %s", svResult);
//endif;
// Add the information to the list.
//ListAddString(listInfo, szInfo, AFTER);
// Get the current time.
// if (GetSystemInfo (TIME, nvResult, svResult) < 0) then
// szInfo = "Couldn't get TIME info.";
// else
// Sprintf(szInfo, "TIME: %s", svResult);
//endif;
//
// // Add the information to the list.
// ListAddString(listInfo, szInfo, AFTER);
// // Get the operating system.
// if (GetSystemInfo (OS, nvResult, svResult) < 0) then
// szInfo = "Couldn't get Operating System info.";
//else
//switch (nvResult)
// case IS_WINDOWSNT:
// szInfo = "OS: Windows NT";
// case IS_WINDOWS9X:
// GetSystemInfo (WINMINOR, nvResult, svResult);
// if (nvResult < 10) then
// szInfo = "OS: Windows 95";
// else
// szInfo = "OS: Windows 98";
// endif;
// endswitch;
// endif;
// // Add the information to the list.
// ListAddString(listInfo, szInfo, AFTER);
// // Display the information.
// szTitle = "System Information";
// szMsg = "The following is some information related to your system:\n";
// SdShowInfoList (szTitle, szMsg, listInfo);
// ListDestroy(listInfo);
//end;
prototype Get_disk_Space();
function Get_disk_Space()
STRING szDrive,svResultPath;
long freespace,i;
NUMBER nvResult;
///LIST listInfo;
begin
freespace=0;
AskPath ("Select drive:", "C:\\", svResultPath);
i=0;
freespace= GetDiskSpace(szDrive);
if(freespace<i) then
// MessageBox ("not enough space", SEVERE);
// Disable (NEXTBUTTON);
endif;
if(freespace>i) then
Enable (NEXTBUTTON);
// MessageBox ("enough space,go ahead", INFORMATION);
endif;
///Enable (FINISHBUTTON);
end;
// Create a list for system information.
// listInfo = ListCreate (STRINGLIST);
// Get the amount of extended memory.
// if (GetSystemInfo (EXTENDEDMEMORY, nvResult, svResult) < 0) then
// szInfo = "Couldn't get EXTENDEDMEMORY info.";
// else
// Sprintf(szInfo, "Extended memory: %d K", nvResult);
// endif;
// Add the information to the list.
// ListAddString(listInfo, szInfo, AFTER);
// Get the boot drive.
// if (GetSystemInfo (BOOTUPDRIVE, nvResult, svResult) < 0) then
// szInfo = "Couldn't get BOOTUPDRIVE info.";
// else
// Sprintf(szInfo, "Boot drive: %s", svResult);
//endif;
// Add the information to the list.
// ListAddString(listInfo, szInfo, AFTER);
// Get info about the CD-ROM.
// if (GetSystemInfo (CDROM, nvResult, svResult) < 0) then
// szInfo = "Couldn't get CD-ROM info.";
// else
// if (nvResult = 0) then
// svResult = "No";
// else
// svResult = "Yes";
// endif;
// Sprintf(szInfo, "CDROM: %s", svResult);
//endif;
// Add the information to the list.
// ListAddString(listInfo, szInfo, AFTER);
// Get the video adapter.
// if (GetSystemInfo (VIDEO, nvResult, svResult) < 0) then
// szInfo = "Couldn't get VIDEO info.";
// else
// switch (nvResult)
// case IS_UNKNOWN:
// szInfo = "VIDEO: UNKNOWN";
// case IS_SVGA:
// szInfo = "VIDEO: SVGA";
// case IS_XVGA:
// szInfo = "VIDEO: XVGA";
//// case IS_UVGA:
// szInfo = "VIDEO: UVGA";
// endswitch;
// endif;
// Add the information to the list.
//ListAddString(listInfo, szInfo, AFTER);
// Get number of available colors.
//if (GetSystemInfo (COLORS, nvResult, svResult) < 0) then
//szInfo = "Couldn't get COLORS info.";
// else
// Sprintf(szInfo, "Number of colors: %d", nvResult);
//endif;
// Add the information to the list.
// ListAddString(listInfo, szInfo, AFTER);
// Get the current date.
// if (GetSystemInfo (DATE, nvResult, svResult) < 0) then
// szInfo = "Couldn't get DATE info.";
// else
// Sprintf(szInfo, "DATE: %s", svResult);
//endif;
// Add the information to the list.
//ListAddString(listInfo, szInfo, AFTER);
// Get the current time.
// if (GetSystemInfo (TIME, nvResult, svResult) < 0) then
// szInfo = "Couldn't get TIME info.";
// else
// Sprintf(szInfo, "TIME: %s", svResult);
//endif;
//
// // Add the information to the list.
// ListAddString(listInfo, szInfo, AFTER);
// // Get the operating system.
// if (GetSystemInfo (OS, nvResult, svResult) < 0) then
// szInfo = "Couldn't get Operating System info.";
//else
//switch (nvResult)
// case IS_WINDOWSNT:
// szInfo = "OS: Windows NT";
// case IS_WINDOWS9X:
// GetSystemInfo (WINMINOR, nvResult, svResult);
// if (nvResult < 10) then
// szInfo = "OS: Windows 95";
// else
// szInfo = "OS: Windows 98";
// endif;
// endswitch;
// endif;
// // Add the information to the list.
// ListAddString(listInfo, szInfo, AFTER);
// // Display the information.
// szTitle = "System Information";
// szMsg = "The following is some information related to your system:\n";
// SdShowInfoList (szTitle, szMsg, listInfo);
// ListDestroy(listInfo);
//end;
readwrite text in installshield
#include "Ifx.h"
#define read_dir "C:\\"
#define read_file "read.txt"
prototype readandwrite();
function readandwrite()
NUMBER nvFileHandle;
STRING szMsg;
begin
OpenFileMode (FILE_MODE_APPEND);
if (CreateFile (nvFileHandle, read_dir, read_file
) < 0) then
// MessageBox (failed to create file, SEVERE);
else
szMsg = "hello god is watching u";
if (WriteLine(nvFileHandle, szMsg) < 0) then
MessageBox ("error", SEVERE);
else
SprintfBox (INFORMATION, szMsg, read_file);
endif;
endif;
CloseFile(nvFileHandle);
end;
///////////////////////////////////////////
prototype readline();
function readline()
STRING szFileName, szPath, szText, svLine;
NUMBER nFlag, nFileHandle;
LIST listID;
begin
listID = ListCreate (STRINGLIST);
OpenFileMode (FILE_MODE_NORMAL);
OpenFile (nFileHandle,read_dir, read_file);
while (GetLine (nFileHandle, svLine) = 0)
ListAddString (listID, svLine, AFTER);
endwhile;
CloseFile (nFileHandle);
SdShowInfoList ("", read_file, listID);
ListDestroy (listID);
end;
#define read_dir "C:\\"
#define read_file "read.txt"
prototype readandwrite();
function readandwrite()
NUMBER nvFileHandle;
STRING szMsg;
begin
OpenFileMode (FILE_MODE_APPEND);
if (CreateFile (nvFileHandle, read_dir, read_file
) < 0) then
// MessageBox (failed to create file, SEVERE);
else
szMsg = "hello god is watching u";
if (WriteLine(nvFileHandle, szMsg) < 0) then
MessageBox ("error", SEVERE);
else
SprintfBox (INFORMATION, szMsg, read_file);
endif;
endif;
CloseFile(nvFileHandle);
end;
///////////////////////////////////////////
prototype readline();
function readline()
STRING szFileName, szPath, szText, svLine;
NUMBER nFlag, nFileHandle;
LIST listID;
begin
listID = ListCreate (STRINGLIST);
OpenFileMode (FILE_MODE_NORMAL);
OpenFile (nFileHandle,read_dir, read_file);
while (GetLine (nFileHandle, svLine) = 0)
ListAddString (listID, svLine, AFTER);
endwhile;
CloseFile (nFileHandle);
SdShowInfoList ("", read_file, listID);
ListDestroy (listID);
end;
create list info
#include "Ifx.h"
prototype list_info();
function list_info()
STRING szTitle, szMsg, svReturn, szInfo;
NUMBER nvReturn;
LIST listInfo;
begin
// Create a list to hold system information.
listInfo = ListCreate (STRINGLIST);
// Add the time to the list.
ListAddString (listInfo, szInfo, AFTER);
szInfo="apple";
ListAddString (listInfo, szInfo, AFTER);
szInfo="orange";
szInfo="pen";
szInfo="software";
ListAddString (listInfo, szInfo, AFTER);
szInfo="pen";
ListAddString (listInfo, szInfo, AFTER);
szInfo="paper";
ListAddString (listInfo, szInfo, AFTER);
szInfo="keyboard";
ListAddString (listInfo, szInfo, AFTER);
szInfo="adapter";
ListAddString (listInfo, szInfo, AFTER);
szInfo="webpage";
// Disable the Back button in setup dialogs.
Disable (BACKBUTTON);
szTitle = "InfoList";
szMsg = "general information";
// Display the information.
SdShowInfoList (szTitle, szMsg, listInfo);
end;
// Check if the system has a CD-ROM drive.
// GetSystemInfo (CDROM, nvReturn, svReturn);
// if (nvReturn = TRUE) then
//szInfo = "Your machine has a CD-ROM Drive.";
// else
// szInfo = "Your machine does not have a CD-ROM drive.";
// endif;
// Add the CD-ROM info to the list.
// ListAddString (listInfo, szInfo, AFTER);
// Check the time on the system.
// GetSystemInfo (TIME, nvReturn, svReturn);
// Sprintf (szInfo, "The time now is %s.", svReturn);
prototype list_info();
function list_info()
STRING szTitle, szMsg, svReturn, szInfo;
NUMBER nvReturn;
LIST listInfo;
begin
// Create a list to hold system information.
listInfo = ListCreate (STRINGLIST);
// Add the time to the list.
ListAddString (listInfo, szInfo, AFTER);
szInfo="apple";
ListAddString (listInfo, szInfo, AFTER);
szInfo="orange";
szInfo="pen";
szInfo="software";
ListAddString (listInfo, szInfo, AFTER);
szInfo="pen";
ListAddString (listInfo, szInfo, AFTER);
szInfo="paper";
ListAddString (listInfo, szInfo, AFTER);
szInfo="keyboard";
ListAddString (listInfo, szInfo, AFTER);
szInfo="adapter";
ListAddString (listInfo, szInfo, AFTER);
szInfo="webpage";
// Disable the Back button in setup dialogs.
Disable (BACKBUTTON);
szTitle = "InfoList";
szMsg = "general information";
// Display the information.
SdShowInfoList (szTitle, szMsg, listInfo);
end;
// Check if the system has a CD-ROM drive.
// GetSystemInfo (CDROM, nvReturn, svReturn);
// if (nvReturn = TRUE) then
//szInfo = "Your machine has a CD-ROM Drive.";
// else
// szInfo = "Your machine does not have a CD-ROM drive.";
// endif;
// Add the CD-ROM info to the list.
// ListAddString (listInfo, szInfo, AFTER);
// Check the time on the system.
// GetSystemInfo (TIME, nvReturn, svReturn);
// Sprintf (szInfo, "The time now is %s.", svReturn);
Wednesday, September 29, 2010
longpathtoquote example code
#define plq PROGRAMFILES^"notepad.exe"
#define pls "C:\\Program Files\\notepad.exe"
#define plr "C:\\Program Files\\message.txt"
#define pld "C:\\Program Files\\Setup1.BMP"
//#define plm PROGRAMFILES^"orbp.rtf"
// Included header files ----------------------------------------------------
#include "ifx.h"
//---------------------------------------------------------------------------
// OnFirstUIBefore
//
// First Install UI Sequence - Before Move Data
//
// The OnFirstUIBefore event is called by OnShowUI when the setup is
// running in first install mode. By default this event displays UI allowing
// the end user to specify installation parameters.
//
// Note: This event will not be called automatically in a
// program...endprogram style setup.
//---------------------------------------------------------------------------
function OnFirstUIBefore()
number x,nResult, nLevel,nSize,nvType,nType, nSetupType,nvSize,nWait;
string szTitle, szKey,szMsg, szOpt1, szOpt2,svValue,szValue, szLicenseFile,svPath;
string szName, szCompany, szTargetPath, szDir, szFeatures, szTargetdir;
BOOL bLicenseAccepted;
begin
nSetupType = COMPLETE;
szDir =PROGRAMFILES;
szName = "";
szCompany = "";
bLicenseAccepted = FALSE;
svPath = pls;
// svvpath=plr;
// svvpath=pld;
LongPathToQuote (svPath,TRUE);
//LongPathToQuote (svvpath,TRUE);
// LongPathToQuote (svvpath,TRUE);
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
RegDBCreateKeyEx ("SOFTWARE\\projects","");
RegDBSetKeyValueEx ("SOFTWARE\\projects",szName,REGDB_STRING,"Karnataka",nSize);
RegDBGetKeyValueEx("SOFTWARE\\projects",szName,nvType,svValue,nvSize);
// MessageBox(PROGRAMFILES,INFORMATION);
MessageBox(SUPPORTDIR,INFORMATION);
//AddFolderIcon(FOLDER_DESKTOP,"projects",TARGETDIR^"notepad.exe","",TARGETDIR^"xyz.ico",0,"",REPLACE);
//AddFolderIcon(FOLDER_STARTUP,"Projects",TARGETDIR^"notepad.exe","",TARGETDIR^"xyz.ico",0,"",REPLACE);
AddFolderIcon(FOLDER_STARTUP,"Shortcut for notepad",svPath ,"","C:\\Program Files\\xyz.ico",0,"",REPLACE);
//AddFolderIcon(FOLDER_STARTUP,"Shortcut for notepad","C:\\Program Files\\Setup1.BMP","","",0,"",REPLACE);
AddFolderIcon(FOLDER_DESKTOP,"Shortcut for notepad",svPath ,"",PROGRAMFILES ^"xyz.ico",0,"",REPLACE);
//// AddFolderIcon(FOLDER_DESKTOP,"Shortcut notepad",PROGRAMFILES^"message.txt","",PROGRAMFILES ^"xyz.ico",0,"",REPLACE);
// MessageBox("value is:" +svValue,INFORMATION);
MessageBox ("quoted path:" +svPath, INFORMATION);
// MessageBox ("quoted path:" +svvPath, INFORMATION);
/// MessageBox ("quoted path:" +svvPath, INFORMATION);
// Beginning of UI Sequence
Dlg_Start:
nResult = 0;
Dlg_SdWelcome:
szTitle = "world";
szMsg = "god is almighty";
//{{IS_SCRIPT_TAG(Dlg_SdWelcome)
nResult = SdWelcome( szTitle, szMsg);
//}}IS_SCRIPT_TAG(Dlg_SdWelcome)
// if (nResult = BACK) then
Disable(BACKBUTTON);
Dlg_SdLicense2:
szTitle = "my licence";
szOpt1 = "";
szOpt2 = "";
//{{IS_SCRIPT_TAG(License_File_Path)
szLicenseFile = SUPPORTDIR ^ "License.rtf";
//szLicenseFile = PROGRAMFILES ^ "mylicence1.rtf";
//}}IS_SCRIPT_TAG(License_File_Path)
Friday, September 24, 2010
reading registry entry and setting registry data using installshield
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
RegDBCreateKeyEx ("SOFTWARE\\projects", "" );
RegDBSetKeyValueEx ("SOFTWARE\\projects",szName,REGDB_STRING,"Karnataka",nSize);
RegDBGetKeyValueEx("SOFTWARE\\projects",szName,nvType,svValue,nvSize);
MessageBox("value is:"+svValue,INFORMATION);
Tuesday, September 21, 2010
installshield add shortcut to the desktop,startup,program script
function OnFirstUIBefore()
number nResult, nLevel, nSize, nSetupType,nvType,nvSize;
string szTitle, szMsg, szOpt1, szOpt2, szLicenseFile,szKey,szName,svValue,szNumName;
string szCompany, szTargetPath, szDir, szFeatures, szTargetdir,svNumValue;
BOOL bLicenseAccepted;
begin
nSetupType = COMPLETE;
szDir = TARGETDIR;
szName = "";
szCompany = "";
bLicenseAccepted = FALSE;
MessageBox("I am here",INFORMATION);
AddFolderIcon(FOLDER_DESKTOP,"Shortcut for notepad","C:\\notepad.exe","","C:\\xyz.jpg",0,"",REPLACE);
AddFolderIcon(FOLDER_STARTUP,"Shortcut for notepad","C:\\notepad.exe","","",0,"",REPLACE);
AddFolderIcon(FOLDER_STARTMENU,"Shortcut for notepad","C:\\notepad.exe","","",0,"",REPLACE);
AddFolderIcon(FOLDER_PROGRAMS,"Shortcut for notepad","C:\\notepad.exe","","",0,"",REPLACE);
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
//RegDBCreateKeyEx("SOFTWARE\\CreateKeyExample","");
//nvType=123;
RegDBGetKeyValueEx("SOFTWARE\\nijo","My Name",nvType,svValue,nvSize);
MessageBox("Value is: "+svValue,INFORMATION);
number nResult, nLevel, nSize, nSetupType,nvType,nvSize;
string szTitle, szMsg, szOpt1, szOpt2, szLicenseFile,szKey,szName,svValue,szNumName;
string szCompany, szTargetPath, szDir, szFeatures, szTargetdir,svNumValue;
BOOL bLicenseAccepted;
begin
nSetupType = COMPLETE;
szDir = TARGETDIR;
szName = "";
szCompany = "";
bLicenseAccepted = FALSE;
MessageBox("I am here",INFORMATION);
AddFolderIcon(FOLDER_DESKTOP,"Shortcut for notepad","C:\\notepad.exe","","C:\\xyz.jpg",0,"",REPLACE);
AddFolderIcon(FOLDER_STARTUP,"Shortcut for notepad","C:\\notepad.exe","","",0,"",REPLACE);
AddFolderIcon(FOLDER_STARTMENU,"Shortcut for notepad","C:\\notepad.exe","","",0,"",REPLACE);
AddFolderIcon(FOLDER_PROGRAMS,"Shortcut for notepad","C:\\notepad.exe","","",0,"",REPLACE);
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
//RegDBCreateKeyEx("SOFTWARE\\CreateKeyExample","");
//nvType=123;
RegDBGetKeyValueEx("SOFTWARE\\nijo","My Name",nvType,svValue,nvSize);
MessageBox("Value is: "+svValue,INFORMATION);
Wednesday, June 16, 2010
what is Sequences in oracle?
Oracle provides an object called a sequence that can generate numeric value.The value generated can have a maxiumum of 38 digit.A sequence can be used to auto generate numeric value.The value generated can have a maximum of 38 digit.
A sequence can be defined to
* Generate number in ascending order or desending order.
syntax:-
A sequence can be defined to
* Generate number in ascending order or desending order.
* Provide intervals between number .
* Caching of sequence number in memory etc.
The minimum information required for generating numbers using sequence is:-* The Starting number .
* maximum number that can be generated by a sequence.
*increment value for generating the next number.
All this info is provided to oracle at the time of sequence creation .The sql statement used for creating sequence is:-syntax:-
create sequence sequence_name
[ increment by integer value
start with integer value
maxvalue integer value
minvalue integer value
cycle/nocycle
cache/nocache inter value
order/noorder ]
Thursday, June 10, 2010
use of sessions in asp.net?
Sessions can be used to store even complex data for the user just like cookies. Actually, sessions will use cookies to store the data, unless you explicitly tell it not to. Sessions can be used easily in ASP.NET with the Session object.
Keep in mind though, that sessions will expire after a certain amount of minutes, as configured in the web.config file. Markup code:-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Sessions</title> </head> <body runat="server" id="BodyTag"> <form id="form1" runat="server"> <asp:DropDownList runat="server" id="ColorSelector" autopostback="true" onselectedindexchanged="ColorSelector_IndexChanged"> <asp:ListItem value="White" selected="True">Select color...</asp:ListItem> <asp:ListItem value="Red">Red</asp:ListItem> <asp:ListItem value="Green">Green</asp:ListItem> <asp:ListItem value="Blue">Blue</asp:ListItem> </asp:DropDownList> </form> </body> </html> ///////////////////////////////////////////////////////////////////////////////////////////
codebehind:-
//////////////////////////////////////////////////////////////////////////////////////////
using System;using System.Data;using System.Web; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if(Session["BackgroundColor"] != null) { ColorSelector.SelectedValue = Session["BackgroundColor"].ToString(); BodyTag.Style["background-color"] = ColorSelector.SelectedValue; } } protected void ColorSelector_IndexChanged(object sender, EventArgs e) { BodyTag.Style["background-color"] = ColorSelector.SelectedValue; Session["BackgroundColor"] = ColorSelector.SelectedValue; } } ///////////////////////////////////////////////////////////////////////////////////////////
web config:-
//////////////////////////////////////////////////////////////////////////////////////////<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<appSettings/>
<connectionStrings/>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="false" />
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows" />
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
<sessionState mode="InProc" stateNetworkTimeout="1" sqlCommandTimeout="3" cookieName="ASP.NET_SessionId" timeout="1" regenerateExpiredSessionId="False">
<providers>
<clear/>
</providers>
</sessionState>
</system.web>
</configuration>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
session values are tied to an instance of your browser. If you close down the browser, the saved value(s) will usually be "lost". Also, if the webserver recycles the aspnet_wp.exe process, sessions are lost, since they are saved in memory as well. This can be avoided by saving session states on a separate StateServer or by saving to a SQL server
Wednesday, June 9, 2010
cache-output cache
we will take a look at the OutputCache directive, which is by far the easiest way of caching content with ASP.NET. As you will see in our example, it doesn’t even require any code – only some minor changes to the markup of the page, and you’re good to go. In the next chapter, we will look into more ways of using the OuputCachce directive.
Here is a very simple example of a page which will show us the difference between a cached page and a non-cached page. Try creating a new project, and change the Default.aspx page to contain the following markup:-
Here is a very simple example of a page which will show us the difference between a cached page and a non-cached page. Try creating a new project, and change the Default.aspx page to contain the following markup:-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Caching</title> </head> <body> <form id="form1" runat="server"> <%= DateTime.Now.ToString() %> </form> </body> </html>
/////////////////////////////////////////////////////////////////////////////////////
This is all standard stuff, except the line with the DateTime. It simply outputs the current date and time to the page. Try running the project and reload the page a couple of times. As you will see, the time is refreshed on each reload. Now, add the following line as line number 2 to our example:-
<%@ OutputCache duration="10" varybyparam="None" %>
Run our project again, and reload the page a number of times. As you will see, the time is only refreshed every 10 seconds. Adding caching to your page is as simple as that! Now, the duration parameter is pretty obvious - it tells the page how many seconds to cache the content. Each time the page is requested, ASP.NET checks if the page is in the cache, and if it is, whether or not it has expired. It's served from the cache if it isn't expired - if it is, the page is removed from the cache and the page is generated from scratch and then placed in the cache.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////The varybyparam is a required parameter of the OutputCache directive. It specifies a list of parameters which the the cache should be varied by. For instance, if you set it to "p", the cache is now depending on the value of the parameter p. Try changing our example to something like this:-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <%@ OutputCache duration="10" varybyparam="p" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Caching</title> </head> <body> <form id="form1" runat="server"> <%= DateTime.Now.ToString() %><br /> <a href="?p=1">1</a><br /> <a href="?p=2">2</a><br /> <a href="?p=3">3</a><br /> </form> </body> </html>Now, run our example again, and try clicking the links. They each now have their own timestamp, based on when you first accessed the page. The cache is depending on the value of the p parameter! You can specify multiple parameters by seperating them with a semicolon.
What is ViewState?with example
Another approach to saving data for the user, is the ViewState. As described elsewhere in this tutorial, the ViewState allows ASP.NET to repopulate form fields on each postback to the server, making sure that a form is not automatically cleared when the user hits the submit button. All this happens automatically, unless you turn it off, but you can actually use the ViewState for your own purposes as well. Please keep in mind though, that while cookies and sessions can be accessed from all your pages on your website, ViewState values are not carried between pages. Here is a simple example of using the ViewState to carry values between postbacks:-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>ViewState</title> </head> <body> <form id="form1" runat="server"> <asp:TextBox runat="server" id="NameField" /> <asp:Button runat="server" id="SubmitForm" onclick="SubmitForm_Click" text="Submit & set name" /> <asp:Button runat="server" id="RefreshPage" text="Just submit" /> <br /><br /> Name retrieved from ViewState: <asp:Label runat="server" id="NameLabel" /> </form> </body> </html> ///codebehind//
using System;using System.Data;using System.Web; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if(ViewState["NameOfUser"] != null) NameLabel.Text = ViewState["NameOfUser"].ToString(); else NameLabel.Text = "Not set yet..."; } protected void SubmitForm_Click(object sender, EventArgs e) { ViewState["NameOfUser"] = NameField.Text; NameLabel.Text = NameField.Text; } }Try running the project, enter your name in the textbox and press the first button. The name will be saved in the ViewState and set to the Label as well. No magic here at all. Now press the second button. This one does nothing at all actually, it just posts back to the server. As you will notice, the NameLabel still contains the name, but so does the textbox. The first thing is because of us, while the textbox is maintained by ASP.NET it self. Try deleting the value and pressing the second button again. You will see that the textbox is now cleared, but our name label keeps the name, because the value we saved to the ViewState is still there!
ViewState is pretty good for storing simple values for use in the form, but if you wish to save more complex data, and keep them from page to page, you should look into using cookies or sessions
Subscribe to:
Posts (Atom)