Artifact Content

Not logged in

Artifact 78e05bd9298c6705e64d7049fc53cd0e1d9123d7


     1  //--- K.I.LIB ---
     2  // kl_wcmn.h : windows-common-interface operatin
     3  
     4  #ifndef AFX_KIWINCOMMON_H__0686721C_CAFB_4C2C_9FE5_0F482EA6A60B__INCLUDED_
     5  #define AFX_KIWINCOMMON_H__0686721C_CAFB_4C2C_9FE5_0F482EA6A60B__INCLUDED_
     6  
     7  /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
     8  // シェルユーティリティークラス
     9  
    10  class kiSUtil
    11  {
    12  public:
    13  	// カレントディレクトリ退避
    14  	static void switchCurDirToExeDir();
    15  
    16  	// 「フォルダの選択」ダイアログ
    17  	static bool getFolderDlg( char* buf, HWND par, const char* title, const char* def );
    18  	static void getFolderDlgOfEditBox( HWND wnd, HWND par, const char* title );
    19  
    20  	// 対応する拡張子用アイコンの、システムイメージリストのインデックスを返す。
    21  	static int getSysIcon( const char* ext );
    22  
    23  	// 最後のエラーを表示
    24  	static void msgLastError( const char* msg = NULL );
    25  
    26  	// 自分へのショートカット作成
    27  	static void createShortCut( const kiPath& at, const char* name );
    28  
    29  	// ファイルが存在する?
    30  	static bool exist( const char* fname );
    31  	static bool isdir( const char* fname );
    32  
    33  	// カレントディレクトリを安全なところに移してLoadLibrary
    34  	static HMODULE loadLibrary(LPCTSTR lpFileName)
    35  	{
    36  		char original_cur[MAX_PATH], sys[MAX_PATH];
    37  		::GetCurrentDirectory(MAX_PATH, original_cur);
    38  		::GetSystemDirectory(sys, MAX_PATH);
    39  		::SetCurrentDirectory(sys);
    40  		HMODULE han = ::LoadLibrary(lpFileName);
    41  		::SetCurrentDirectory(original_cur);
    42  		return han;
    43  	}
    44  };
    45  
    46  #endif