確認ですが、Win32-API: FindFirstFile/FineNextFile/FindCloseに
置き換えても再現しますか?
もしそうなら、VC++/MFCのバージョンとは関係ないことになります。
To επιστημηさんへ
API使用時のサンプルコードです。やはり結果は同じですね。。。。
#include io.h
サンプル関数()
{
int iCounter=0;
CString cStringFileName=c:\\test\\*.*;
for( int iLoop=0; iLoop<100; iLoop++ )
{
long handle;
struct _finddata_t fd;
handle = _findfirst(cStringFileName, &fd);
if( handle != (-1) )
{
iCounter = 0;
do
{
TRACE(%d\n,iCounter++ );
}
while(_findnext(handle, &fd) == 0);
_findclose( handle );
}
}
}
Mellさんのコードでやってみました。
★WindowsXP(SP1)/VisualStudio6(SP6)(本機にはVisualStudio7.1はない)→非再現
プログラムやAPIが原因がではなく
その他の常駐アプリ(アンチウィルスソフト)等が悪さしてるとか・・・
#include <windows.h>
#include <stdio.h>
int main() {
const char* name =d:\\work\\*.*;
for( int iLoop=0; iLoop<1000000; iLoop++ ) {
WIN32_FIND_DATA fd;
HANDLE handle = FindFirstFile(name, &fd);
if( handle != INVALID_HANDLE_VALUE ) {
int iCounter = 0;
do {
printf(%d , iCounter++);
} while( FindNextFile(handle, &fd) );
FindClose(handle);
puts(");
}
}
}
処理系/ライブラリの影響を排除すべく、DigitalMars C++ でコンパイルしました。
★Windows2000→非再現
>Mellさんの実行環境下には、VisualStudio7.1(.Net2003)はインストールされておりませ
んか??
インストールされています。
念のため、VC++ 開発環境が一切入っていない WindowsXP(SP2) および Windows2000(SP4)
の環境でも同じプログラムを実行してみましたが問題は再現していません。
※前回のは実機で、今回試した環境は Virtual PC ゲストマシンです。