Detect .Net FameWork

//===========================================================================
//
//  Topic:    CheckAndInstallNetFramework
//
//  Description: 
//
//  My Name    : 
//
//===========================================================================
function CheckAndInstallNetFramework()
begin
   
   //CopyFile(SRCDIR^"Net Framework\\CheckNetFamework.exe",SUPPORTDIR ^ "CheckNetFamework.exe");
   if CheckNetFameworkCreateFile(SUPPORTDIR,"CheckNetFamework.exe","CheckNetFamework.txt")=FALSE then
    	InstallNetFrameWork(SUPPORTDIR^"\\NetFx20SP1_x86.exe");
   endif;
   DeleteFile(SUPPORTDIR^"CheckNetFamework.exe");
   

end; 

//===========================================================================
//
//  Topic:    InstallNetFrameWork
//
//  Description: 
//
//  My Name    : 
//
//===========================================================================

function InstallNetFrameWork(filePath)
    NUMBER  nvDx, nvDy, nvResult, nvType, nvSize;
    STRING  svResult, svVersionNumber;

begin
      
    	 if (AskYesNo("Microsoft .NET Framework 2.0 or later version was not installed in your system.\n\n Would you like to install it now?", YES ) = YES) then
    	  	   if Is(FILE_EXISTS,filePath)==TRUE then  
	    	  	   if (LaunchAppAndWait (filePath, "", LAAW_OPTION_WAIT) < 0) then
				    	
				    	 MessageBox("NetFx20SP1_x86.exe doesn't exist in Net Frmework foder in CD, please check again.",WARNING);
			        //abort; 
			        	InformFinishNetFramWork();
			       else
			       		//if (AskYesNo("Would you like to restart computer now?", YES ) = YES) then
				      			     
				      			     //SdFinishReboot ( szTitle, szMsg1, SYS_BOOTMACHINE, szMsg2, 0 );   
				      			       // System (SYS_BOOTMACHINE);
                                       // abort; 

				       // endif;      
				   endif;     
			   else
			   	    
  			   endif;
				  
    	 else
    	 	//abort; 
    	 	MessageBox("Microsoft .NET Framework 2.0 installation is not completed",WARNING);
    	 	InformFinishNetFramWork();
    	 endif; 
    	 if(CheckNetFameWorkRuning()==FALSE) then
    	      MessageBox("Microsoft .NET Framework 2.0 installation is not completed",WARNING);
    	 		InformFinishNetFramWork();
    	 		//MessageBox("HAHHAHAH",WARNING);
    	 endif;
    	      
    
end; 

//===========================================================================
//
//  Topic:    CheckNetFameworkCreateFile
//
//  Description: 
//
//  My Name    :
//
//===========================================================================              
function BOOL CheckNetFameworkCreateFile(strFolderPath,fileEXE,createdFile)
	BOOL blnResult;      
	NUMBER  nvDx, nvDy, nvResult, nvType, nvSize;
    STRING  svVersionNumber;  
    STRING para;       
    
        
begin           
	  blnResult=FALSE; 
	  para="\""+ strFolderPath^ createdFile+ "\"";
	  if LaunchAppAndWait (strFolderPath^fileEXE,para, LAAW_OPTION_WAIT|LAAW_OPTION_HIDDEN)=0 then
		  if Is(FILE_EXISTS,strFolderPath^ createdFile)==TRUE then
		  	   blnResult=TRUE;
		  	   DeleteFile(strFolderPath^ createdFile);
		  else
		  	   blnResult=FALSE;
		  endif;
	  endif;
	  return blnResult;

  
end; 
//===========================================================================
//
//  Topic:    InformFinishNetFramWork
//
//  Description: 
//
//  My Name    : 
//
//===========================================================================
function BOOL CheckNetFameWorkRuning()

begin
      if CheckNetFameworkCreateFile(SUPPORTDIR,"CheckNetFamework.exe","CheckNetFamework.txt")=FALSE then
      	return FALSE;
      else
      	return TRUE;
      endif;
end;


//===========================================================================
//
//  Topic:    InformFinishNetFramWork
//
//  Description: 
//
//  My Name    : 
//
//===========================================================================

function InformFinishNetFramWork()
	NUMBER  nResult, nLevel, nSize, nSetupType;
    STRING  szTitle, szMsg, szOpt1, szOpt2, szLicenseFile;
    STRING  szName, szCompany, szTargetPath, szDir, szFeatures;
    BOOL    bLicenseAccepted;	
    STRING   szProductName;
    STRING   szMsg1, szMsg2;
    BOOL     bvOpt1, bvOpt2;
    NUMBER   nReturn;
    NUMBER	 nType, nMediaFlags;
    STRING	szIgnore,svOldPath;
    STRING szKey, szNumName, szNumValue, svNumValue;  
    
begin
	
	szTitle = @PRODUCT_NAME +" Installation is not Completed.";
    szMsg1  = "Microsoft .NET Framework 2.0 installation is not completed" ;
    szMsg2  = "Click Finish to complete %P Setup.";
    SdFinish (szTitle, szMsg1, szMsg2, szOpt1, szOpt2, bvOpt1, bvOpt2);
    abort;
end;

After dowload file: Dowload successful you need rename “checknetfamework-exe.doc” to “checknetfamework.exe”

Dowload

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: