里面有一个参数要用到函数起始地址,比如我在线程内要调用到getdata这个函数,应怎样调用?请高手指教
解决方案 »
- 关于Delphi托盘问题(主Form中调用其他Form后托盘遇到问题)
- 简单问题,向各位专家请教!在线等
- delphi中是否有条件编译?(在线等,给分)
- 急问:ADO连接SQL数据库的问题(在线等)
- 深圳千升投资有限公司招DELPHI+SQL程序员10名
- 请问怎样从TOleEnum类型,转化为string型呢?
- 一个form里有多个Image 同时更新内容.....进来看吧,题目发不下
- 现在我能通过键盘向LABEL.CAPTION中输入数字串了,但我按了+号之后,再次输入数字时,新数字会接着前面的数字串后面,而不是从头开始,为什么?
- 如何打开和编辑DBF文件
- 请问: 如何将MEMO中的HTML源代码,另存为TXT?
- activeform 在浏览器中卷动的问题
- 求stringGrid控件的详细用法????????????????????????????????????
Form1: TForm1;
ThreadHandle: THandle; // holds the handles the threads
ThreadHandle2: THandle;
CriticalSection: TRTLCriticalSection; // holds the critical section infoimplementation{$R *.DFM}function ThreadFunc(Info: Pointer): Integer; stdcall;
var
Count : Integer; // general loop control variable
begin
{performing the EnterCriticalSection function prevents the second thread from executing until this thread leaves the critical section}
EnterCriticalSection(CriticalSection); {show a visual display}
for Count := 0 to 100 do
begin
Form1.Edit1.Text := IntToStr(Count);
end; {display a message}
Form1.Edit1.Text := 'Hello from the thread!'; {pause for a second}
Sleep(1000); {leave the critical section and exit the thread} LeaveCriticalSection(CriticalSection);
ExitThread(4);
end;procedure TForm1.Button1Click(Sender: TObject);
var
ThreadId1, ThreadId2: DWORD; // holds the created thread identifiers
begin
{initialize the critical section information}
InitializeCriticalSection(CriticalSection); {create and execute the first thread}
ThreadHandle := CreateThread(nil, 0, @ThreadFunc, nil, 0, ThreadId1); {create and execute the second thread}
ThreadHandle2 := CreateThread(nil, 0, @ThreadFunc, nil, 0, ThreadId1);
end;procedure TForm1.FormDestroy(Sender: TObject);
begin
{we are done, so destroy the critical section information}
DeleteCriticalSection(CriticalSection);
end;
自己创建线程,容易出错误