exelauncher_appui.cpp

来自「Symbian C++ scmp.zip」· C++ 代码 · 共 67 行

CPP
67
字号
// ExeLauncher_AppUi.cpp
//
// Copyright (c) 2002 Symbian Ltd.  All rights reserved.
//

#include "ExeLauncher_AppUi.h"
#include "ExeLauncher_Document.h"

#include <f32file.h>


void CExeLauncherAppUi::ConstructL()
  {
  CEikAppUi::ConstructL();


  iAppView = CExeLauncherAppView::NewL(ClientRect());
//  iProcess = new(ELeave) RProcess;
  
  iDirFspec    = iEikonEnv->AllocReadResourceL(R_EXELAUNCHER_DIR_FSPEC);
  RFs& fs = iCoeEnv->FsSession();
  CDir *DirList = NULL;
  fs.GetDir(*iDirFspec,KEntryAttNormal,ESortNone,iFileList,DirList);
  delete DirList;
  iAppView->AppendItemsAndActivateL(iFileList);
  }
  
CExeLauncherAppUi::~CExeLauncherAppUi()
  {
  delete iAppView;
  delete iDirFspec;
  delete iFileList;
  }

void CExeLauncherAppUi::HandleCommandL(TInt aCommand)
  {
  switch (aCommand)
    {

    case EEikCmdExit: 
		// Exit the application. The call is
		// implemented by the UI framework.
      Exit();
      break;
    case EExeLauncherCmdLaunch:
    	// Run the selected .exe file 
      TInt i = iAppView->GetCurrentItem();
      if (iFileList && (i<iFileList->Count()))
      	{
      	TPtrC name = (*iFileList)[i].iName;
  	  	RFs& fs = iCoeEnv->FsSession();
      	TParse fp;
      	fs.Parse(name, *iDirFspec,fp);
      	const TDesC& runExeDesC = fp.FullName();
      	TInt retval = iProcess.Create(runExeDesC, runExeDesC);
      	if (retval == KErrNone)
        	{
        	iProcess.Resume();
        	iProcess.Close();
        	break;
        	}
        }
      iEikonEnv->InfoMsg(R_EXELAUNCHER_TEXT_RUNFAILED);
      break;
    }
  }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?