Artifact Content

Not logged in

Artifact b5993084886670416559e3fe6f17ddfc6f944af0


#ifndef AFX_KIUTIL_H__D2E1F380_468E_11D3_8D94_ECF8CA9E4339__INCLUDED_
#define AFX_KIUTIL_H__D2E1F380_468E_11D3_8D94_ECF8CA9E4339__INCLUDED_

// ちょっと便利かも知れない関数群「kiutil」
//
// VC++ のツリーでひとまとめで表示させるためにクラス化
// しただけで、実は全部 public & static だったりする。(^^;

class kiutil
{
public:

// タイムスタンプ

	// WIN( 0.1 millisec from 1601.1.1 )
	static void timeSet( const char* fname, FILETIME* pft );
	// DOS( 0-4:day 5-8:month 9-15:year+1980, 0-4:sec/2 5-10:min 11-15:hour )
	static void timeSet( const char* fname, WORD date, WORD time );
	// UNIX( sec from 1970.1.1 )
	static void timeSet( const char* fname, DWORD sec );

// パス文字列

	// ↓最初に必ずコレを呼んでおくこと!
	static void pathInit();

	// 相対パスを与えると [不正文字除去],[複数階層makeDir] を行う
	static char* pathMake( char* path );
	// 絶対パスを与えると [複数階層makeDir]
	static void pathMakeAbs( char* path );
	// yに最後の\, dに最後の. の位置を入れる
	static void pathSplit( const char* path, int* y, int* d );
	// 拡張子
	static const char* pathExt( const char* path );
	// ファイル名
	static const char* pathName( const char* path );

// window
	
	// 強制的に前面へ。( kazubon氏の TClock のソースより。感謝! )
	static void wndFront( HWND wnd );

// その他

	// fgets改訂版(CR/LF/CRLFを改行と認定。改行コードは含めない文字列を返す)
	static char* getline( char* str, int size, FILE* fp );
	// 拡張子変換
	static void getOriginalName( char* nw, const char* od, char* ext );
	// 安全なところに移ってからLoadLibrary
	static HMODULE safepathLoadLibrary(LPCTSTR lpFileName)
	{
		kiPath original_cur(kiPath::Cur), sys(kiPath::Sys);
		::SetCurrentDirectory(sys); 
		HMODULE han = ::LoadLibrary(lpFileName);
		::SetCurrentDirectory(original_cur); 
		return han;
	}

// 変数

private:
	static char lb[256];
};

#endif