SearchFunc 関数を作成してその関数が実行される事をテスト |
|
宣言
|
// このコード モジュールに含まれる関数の前宣言:
ATOM MyRegisterClass( HINSTANCE hInstance );
BOOL InitInstance( HINSTANCE, int );
LRESULT CALLBACK WndProc( HWND, UINT, WPARAM, LPARAM );
LRESULT CALLBACK About( HWND, UINT, WPARAM, LPARAM );
DWORD WINAPI SearchFunc( LPVOID lpParameter );
| |
|
呼び出し
|
case IDM_GETDIR:
{
LboxCommdlg Commdlg;
LboxString Path;
if ( Commdlg.GetFolderName( &Path ) ) {
Lview->Reset();
Lview->AddRow();
Lview->SetColumnText( 0, &Path );
Lview->Fit();
SearchFunc( NULL );
}
break;
}
| |
|
実体
|
DWORD WINAPI SearchFunc( LPVOID lpParameter )
{
Win->MsgOk( "OK" );
return true;
}
| |
|
|
ディレクトリ一覧取得処理を SearchFunc に実装 |
|
|
DWORD WINAPI SearchFunc( LPVOID lpParameter )
{
int i;
LboxString Path;
for( i = 0; i < Lview->Count(); i++ ) {
HANDLE hFile;
BOOL bRet;
WIN32_FIND_DATA wfd;
Lview->SetCurrentRow( i );
Lview->GetColumnText( 0, &Path );
Path.AddBackslash();
Path.operator += ("*.*");
hFile = FindFirstFile( Path.szLboxString, &wfd );
bRet = true;
while( hFile != INVALID_HANDLE_VALUE && bRet ) {
if ( lstrcmp( wfd.cFileName, "." ) == 0 ) {
bRet = FindNextFile( hFile, &wfd );
continue;
}
if ( lstrcmp( wfd.cFileName, ".." ) == 0 ) {
bRet = FindNextFile( hFile, &wfd );
continue;
}
Lview->SetCurrentRow( i );
Lview->GetColumnText( 0, &Path );
Path.AddBackslash();
Path.operator += (wfd.cFileName);
if ( PathIsDirectory( Path.szLboxString ) ) {
Lview->AddRow();
Lview->SetColumnText( 0, &Path );
}
bRet = FindNextFile( hFile, &wfd );
}
if ( !bRet ) {
FindClose( hFile );
}
Lview->Fit();
}
return true;
}
| |
|
|
|