有一段程序看不明白,望高手解答(20分)

  • 主题发起人 主题发起人 wuliao
  • 开始时间 开始时间
W

wuliao

Unregistered / Unconfirmed
GUEST, unregistred user!
function ThreadFunction(Info: Pointer): Integer;
StdCall
var
Count: Integer;

FormDC: HDC;

CountStr: string;

begin
FormDC := GetDC(Form1.Handle);
{display something visual}
for Count := 1 to 1000do
begin
CountStr := IntToStr(Count);
TextOut(FormDC, 10, 10, Pchar(CountStr), Length(CountStr));
end;


ReleaseDC(Form1.Handle, FormDC);
ExitThread(4);
//ExitThread后边的参数应该是退出码,这里的4是随便给的数字还是怎么来的??(另还有Windows.ExitProcess(10);这种写法应该是推出码,但是程序没有什么地方指定退出码为10,也没应用函数取得退出码为10,这里为什么写10呢??)
end;

望解答,谢谢
 
退出码是用来让调用进程或线程的地方,判断调用是否正确.可以将线程或进程想象成一个函数就可以了.
这个返回值是自定义的!但是有一个约束就是:0为正常值,非零都是错误返回值.
 
The ExitThread function ends a thread.
VOID ExitThread(
DWORD dwExitCode // exit code for this thread
);

Parameters
dwExitCode
Specifies the exit code for the calling thread. Use the GetExitCodeThread function to retrieve a thread's exit code.

Return Values
This functiondo
es not return a value.
//----------Win32 Help
The ExitProcess function ends a process and all its threads.
VOID ExitProcess(
UINT uExitCode // exit code for all threads
);

Parameters
uExitCode
Specifies the exit code for the process, and for all threads that are terminated as a result of this call. Use the GetExitCodeProcess function to retrieve the process's exit value. Use the GetExitCodeThread function to retrieve a thread's exit value.

Return Values
This functiondo
es not return a value.
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
614
import
I
后退
顶部