在程序中打开我的电脑两种方法

来源:互联网 发布:the taylor life软件 编辑:程序博客网 时间:2024/04/29 07:00

在程序中打开我的电脑两种方法

 

方法1:
********************************************************************************************************************
               ::ShellExecute(this->m_hWnd,"open","explorer.exe",
   "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", NULL,SW_SHOWDEFAULT);

方法2:
********************************************************************************************************************
  if ( SUCCEEDED( SHGetSpecialFolderLocation ( NULL, CSIDL_DRIVES, &pidl )))
  {
   SHELLEXECUTEINFO sei;
   ZeroMemory(&sei, sizeof(sei));
   sei.cbSize = sizeof(sei);
   sei.fMask = SEE_MASK_IDLIST;
   sei.lpIDList = pidl;
   sei.lpVerb = "open";
   sei.hwnd = AfxGetMainWnd()->GetSafeHwnd();
   sei.nShow = SW_SHOWNORMAL;
   ShellExecuteEx(&sei);
   if ( SUCCEEDED( SHGetMalloc ( &pMalloc )))
   {
    pMalloc->Free ( pidl );
    pMalloc->Release();
   }
  }

原创粉丝点击