★初心者にVisual C++ ..
[2ch|▼Menu]
94:デフォルトの名無しさん
07/01/11 22:55:38
>7にはこのコードをあげる。よい子は使っちゃダメだぞ。
typedef void (*throwFuncType)();
void dothrow_func(){ throw 300;}
DWORD CALLBACK threadproc( void * ){
printf("BeginThread\n");
int i=0;
try{
while(1) { i++; }
}catch( int ){
printf("\n%d: catched exception.\n",i);
}
return 0;
}
int main(){
throwFuncType dothrow_ptr = dothrow_func;
DWORD id; HANDLE hThread = CreateThread(NULL,0,threadproc,NULL,0,&id);

char t[255]; fgets(t,200,stdin);

CONTEXT context; context.ContextFlags = CONTEXT_CONTROL;
SuspendThread( hThread); GetThreadContext(hThread, &context);
context.Eip = (DWORD)dothrow_ptr;
SetThreadContext(hThread, &context); ResumeThread( hThread);
WaitForSingleObject(hThread,INFINITE);
}


次ページ
続きを表示
1を表示
最新レス表示
スレッドの検索
類似スレ一覧
話題のニュース
おまかせリスト
▼オプションを表示
暇つぶし2ch

4339日前に更新/201 KB
担当:undef