[PR]

水無瀬の部屋 > Programming > sample > tools > old > toolold.cpp
最終更新日: 2007/03/11

   1: //*********************************************************
   2: // プロジェクト: TOOLS
   3: //   ファイル名: toolold.cpp
   4: //*********************************************************
   5: #include <old/toolold.h>  //
   6: #include <header/tooldbg.h>  //  
   7: #include <header/toolbase.h> //  
   8: #include <header/toolsys.h>  //  
   9: #include <header/toolwind.h> //  
  10: #include <limits.h>          //
  11: 
  12: 
  13: //---------------------------------------------------------
  14: // マクロ定数 の 定義
  15: //---------------------------------------------------------
  16: 
  17: 
  18: //---------------------------------------------------------
  19: // マクロ関数 の 定義
  20: //---------------------------------------------------------
  21: 
  22: 
  23: //---------------------------------------------------------
  24: // ファイルスコープ関数 の 宣言
  25: //---------------------------------------------------------
  26: 
  27: 
  28: //---------------------------------------------------------
  29: // a
  30: //---------------------------------------------------------
  31: 
  32: //---------------------------------------------------------
  33: // b
  34: //---------------------------------------------------------
  35: 
  36: //---------------------------------------------------------
  37: // c
  38: //---------------------------------------------------------
  39: 
  40: //---------------------------------------------------------
  41: // d
  42: //---------------------------------------------------------
  43: 
  44: //---------------------------------------------------------
  45: // e
  46: //---------------------------------------------------------
  47: 
  48: //---------------------------------------------------------
  49: // f
  50: //---------------------------------------------------------
  51: 
  52: //---------------------------------------------------------
  53: // g
  54: //---------------------------------------------------------
  55: 
  56: //---------------------------------------------------------
  57: // h
  58: //---------------------------------------------------------
  59: 
  60: //---------------------------------------------------------
  61: // i
  62: //---------------------------------------------------------
  63: 
  64: //---------------------------------------------------------
  65: // j
  66: //---------------------------------------------------------
  67: 
  68: //---------------------------------------------------------
  69: // k
  70: //---------------------------------------------------------
  71: 
  72: //---------------------------------------------------------
  73: // l
  74: //---------------------------------------------------------
  75: 
  76: //---------------------------------------------------------
  77: // m
  78: //---------------------------------------------------------
  79: 
  80: //---------------------------------------------------------
  81: // n
  82: //---------------------------------------------------------
  83: 
  84: //---------------------------------------------------------
  85: // o
  86: //---------------------------------------------------------
  87: 
  88: //---------------------------------------------------------
  89: // p
  90: //---------------------------------------------------------
  91: 
  92: //---------------------------------------------------------
  93: // q
  94: //---------------------------------------------------------
  95: //*********************************************************
  96: // Quit
  97: //*********************************************************
  98: void
  99: Quit
 100: 	(
 101: 		void
 102: 	)
 103: {
 104: 	ShowCursor( true );
 105: 	PostQuitMessage( EXIT_SUCCESS );
 106: }//Quit
 107: 
 108: 
 109: //---------------------------------------------------------
 110: // r
 111: //---------------------------------------------------------
 112: //*********************************************************
 113: // Random
 114: //   最小値 nMin と最大値 nMin の間の乱数を int で返す。
 115: //   nMin <= Random <= nMin
 116: //*********************************************************
 117: int
 118: Random
 119: 	(
 120: 		int          nMin,
 121: 		int          nMax,
 122: 		unsigned int nSeed 
 123: 	)
 124: {
 125: 	if ( nMin > nMax )
 126: 		memswap( &nMin, &nMax, sizeof( int ) );
 127: 
 128: 	ASSERT( nMin <= nMax );
 129: 	return( ( nSeed % ( nMax - nMin + 1 ) ) + nMin ); 
 130: }//Random
 131: 
 132: //*********************************************************
 133: // RegisterWindowClass
 134: // ウィンドウのクラスを登録する
 135: // 登録したクラスを一意的に識別するアトムを返す
 136: // 関数が失敗した場合には 0 を返す
 137: // 登録したウィンドウクラスは終了時に自動的に削除される
 138: //   uStyle …… CS_DBLCLKS, CS_VREDRAW, CS_HREDRAW, CS_OWNDC, CS_SAVEBITS, ... 
 139: //   menu   …… MAKEINTRESOURCE()
 140: //*********************************************************
 141: ATOM
 142: RegisterWindowClass
 143: 	(
 144: 		      HINSTANCE  hInstance,
 145: 		const char     *ClassName, 
 146: 		      WNDPROC    WndProc,
 147: 		      UINT       uStyle,
 148: 		const char     *menu,
 149: 		      int        nBrush
 150: 	)
 151: {
 152: 	// パラメタの仮定
 153: 	ASSERT( IsValidInstanceHandle( hInstance ) );
 154: 	ASSERT( !menu || IsValidResourceName( menu ) );
 155: 	ASSERT( IsValidStringPtr( ClassName ) );
 156: 	ASSERT( IsValidCodePtr( WndProc ) );
 157: 
 158: 	// ウィンドウクラスの登録
 159: 	WNDCLASSEX wc; // ウィンドウクラス構造体
 160: 	VERIFY( MakeWindowClass( &wc, hInstance, WndProc, ClassName, menu, uStyle ) );
 161: 	wc.hbrBackground = GetStockBrush( nBrush );                         // 背景色
 162: 	wc.hIcon         = SHGetInstanceIcon( hInstance, SHGFI_LARGEICON ); // 大きいアイコン
 163: 	wc.hIconSm       = SHGetInstanceIcon( hInstance, SHGFI_SMALLICON ); // 小さいアイコン
 164: 
 165: 	return RegisterClassEx( &wc );
 166: }//RegisterWindowClass
 167: 
 168: 
 169: //---------------------------------------------------------
 170: // s
 171: //---------------------------------------------------------
 172: //*********************************************************
 173: // SearchFile
 174: //*********************************************************
 175: bool
 176: SearchFile
 177: 	(
 178: 		const char *filename,
 179: 		const char *extension
 180: 	)
 181: {
 182: 	// パラメタの仮定
 183: 	ASSERT( IsValidStringPtr( filename ) );
 184: 	ASSERT( !extension || IsValidStringPtr( extension ) );
 185: 	ASSERT( !extension || ('.' == extension[0]) );
 186: 
 187: 	char *dumy;                 // パス buffer のファイル名の開始位置を指すポインタが格納される
 188: 	char  buffer[ MAX_PATH_BUF ]; // 検索されたパスが格納される
 189: 	return 0 < SearchPath( null, filename, extension, numof( buffer ), buffer, &dumy );
 190: #pragma memo( "rewrite !!" )
 191: }//SearchFile
 192: 
 193: 
 194: //---------------------------------------------------------
 195: // t
 196: //---------------------------------------------------------
 197: 
 198: //---------------------------------------------------------
 199: // u
 200: //---------------------------------------------------------
 201: 
 202: //---------------------------------------------------------
 203: // v
 204: //---------------------------------------------------------
 205: 
 206: //---------------------------------------------------------
 207: // w
 208: //---------------------------------------------------------
 209: 
 210: //---------------------------------------------------------
 211: // x
 212: //---------------------------------------------------------
 213: 
 214: //---------------------------------------------------------
 215: // y
 216: //---------------------------------------------------------
 217: 
 218: //---------------------------------------------------------
 219: // z
 220: //---------------------------------------------------------
 221: 
 222: 
 223: //** end **
 224: 

参照:


Google
ご意見・ご感想をお聞かせ下さい。匿名で送信できます。

 * 返信が必要な場合には postmaster@katsura-kotonoha.sakura.ne.jp へ直接メールしてください。

水無瀬の部屋 > sample > tools > old > toolold.cpp

このページは cpp2web が出力しました。
水無瀬 優 postmaster@katsura-kotonoha.sakura.ne.jp
http://katsura-kotonoha.sakura.ne.jp/prog/code/tools/old/toolold_cpp.shtml
同人ダウンロード販売
同人ダウンロード販売|DL.Getchu.com