Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Delphi¶àÏß³Ìѧϰ£¨3£©£ºÏß³Ìͬ²½µÄÔ­Òò

ÔÚʹÓöàÏ̵߳Äʱºò£¬Èç¹û¶àÏ̶߳Ôij¸öÌض¨µÄ¹«¹²Êý¾Ý»ò×ÊÔ´½øÐзÃÎÊ£¬ÐèÒª¶Ô¶àÏ߳̽øÐÐЭµ÷²Ù×÷£¬½Ð×öÏß³Ìͬ²½¡£
     ÀýÈ磺Èý¸öÏ̷ֱ߳ðÑ­»·µØÏòListBoxÖÐдÈëÊý¾Ý¡£Ã»ÓнøÐÐͬ²½Ê±£¬Ð´ÈëµÄ˳ÐòÊDz»È·¶¨µÄ¡£
{Ö÷´°Ìå´úÂë}
unit Unit2;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
TForm2 = class(TForm)
ListBox1: TListBox;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form2: TForm2;

implementation

uses MyThread;

{$R *.dfm}

procedure TForm2.Button1Click(Sender: TObject);
begin
TMyThread.Create(False);
TMyThread.Create(False);
TMyThread.Create(False);
end;

end.{¶àÏ̴߳úÂë}
unit MyThread;

interface

uses
Classes,StdCtrls,SysUtils,Windows;

type
TMyThread = class(TThread)
private
{ Private declarations }
str:String;
procedure AddList;
protected
procedure Execute; override;
end;

implementation

uses Unit2;

{ TMyThread }

procedure TMyThread.AddList;
begin
Form2.ListBox1.Items.Add(str);
end;

procedure TMyThread.Execute;
var
i:Integer;
begin
{ Place thread code here }
for i := 0 to 99 do
begin
if not Terminated then
begin
str:=Format('Ïß³ÌID:%d£¬µÚ%d¸öÑ­»·¡£',[GetCurrentThreadId,i]);
Synchronize(AddList);
end;
end;
end;

end.

Èý¸öÏ̸߳ù¾Ý·ÖÅäµ½µÄCPUʱ¼äµÄ˳ÐòÏòListBoxÖÐдÈëÊý¾Ý¡£ÕâÀïµÄ¹«¹²×ÊÔ´ÊÇListBox¡£
¿ÉÒÔ½«Õâ¸ö¹«¹²µÄÀä×ÊÔ´±ÈÓ÷Ϊһ¸öͼÊé¹Ý£¬Ï̱߳ÈÓ÷Ϊ½èÊé¿´ÊéµÄÈËÔ±¡£ÄÇôûÓÐͬ²½´¦ÀíµÄÇé¿öÏ£¬¾ÍºÃÏñͼÊé¹ÝÍêÈ«¿ª·Å£¬Ã»ÓÐÈ˹ÜÀí£¬Ã¿¸öÈ˶¼¿ÉÒÔ·ÃÎÊÕâ¸öͼÊé¹Ý¡£¿´ÆðÀ´ÂÒÔãÔãµÄ£¬¶øÇÒµ±Ä³ÈËÏë½èÊéAµÄ»°£¬²éѯµÄʱºòÊéA»¹ÔÚ£¬µ±ËûÈ¥½èµÄʱºò¿ÉÄܱ»ÁíÒ»ÈËÒѽè×ß¡£
ΪÁ˸üºÃ¹ÜÀíµÄÐèÒª£¨Ä³Ð©¶Ô¹«¹²×ÊÔ´µÄ·ÃÎʱØÐëÖð¸öÏ̴߳¦Àí£¬²Å²»»á³ö´í£©£¬ÕâÀï¾ÍÒªÓõ½Í¬²½£¬¼´²éѯºÍ½èÊéÕâÁ½¸ö²½ÖèÒªÒ»ÆðÍê³É£¬µÈÒ»¸


Ïà¹ØÎĵµ£º

SDL & Object Pascal (Delphi) [Ç°ÑÔ]

ʵ¼ÊÉÏÕâ¸öÃû×Ö½Ð[SDL & Delphi]Ò²²»³ÉÎÊÌ⣬ ÒòΪ³ýÁËDelphiËƺõҲûÓÐÄĸöÁ÷ÐеĿª·¢¹¤¾ßÓõÄÊÇPascalÓïÑÔ¡£
SDLÆäʵÎÒҲֻѧÁ˲»µ½Á½ÐÇÆÚ¶øÒÑ¡£¸Õ¿ªÊ¼ÎÒÏëÊÔͼÓÃVC£¬ÒòΪÕâÑù×ÊÁÏ×îÈ«£¬Ò²ºÜºÃÕÒ£¬µ«Ì«¾ÃûÓÃVCÏÖÔÚ¿´CµÄ´úÂëÓеãÀ§ÄÑ£¨->Õâ¸öËã·ûÊǸÉÂðµÄÀ´×Å……£©¡£Æäʵ×÷Ϊһ¸öרҵ²»ÊǼÆËã»úµÄÈË ......

SDL & Object Pascal (Delphi) [2] ÏÔʾÖÐÎÄ×Ö·û

һЩ»ù´¡µÄÎÊÌâÎÒ²»ÔÙ׸ÊöÁË£¬²éÔÄ°ïÖúÎĵµ£¨Object Pascal SDL Doc.chm£©ÏÔÈ»±ÈÔÚÕâ¿´ÎÒºú³¶ºÏÊʵöࡣÄÇЩ»­ÏñËØ£¬»ñÈ¡ÏñËØÐÅÏ¢£¬ÏÔʾBMPÎļþ¶àÊýʱºòÖ»Òª°ÑÄÇЩ´úÂ븴ÖƹýÀ´»ù±¾¾ÍÄܹ¤×÷¡£ÏÂÃæ˵µÄÊÇÔõÑùÏÔʾÖÐÎÄ¡£
ÆäʵSDL¼ÓÉÏttfÖ§³Öʱ£¨ÐèÒª½«¶ÔÓ¦µÄdllÎļþÌí¼Óµ½¹¤³ÌĿ¼ÀÊÇÍêÈ«¿ÉÒÔÏÔʾÖÐÎĵģ¬¼òÌåºÍ·±Ì嶼ûΠ......

Delphi ×Ô¼ºÐ´¸öTimerÍæÍæ

¼¼Êõ½»Á÷,DH½²½â.
Ã÷ÌìÈ¥×ø»ð³µ,»Ø¼Ò,½ñÌì¾ÍûÓÐÊÂ×ö,±¾À´ÔÚŪһ¸ö¿ç½ø³Ì»ñÈ¡ÆäËû³ÌÐòÀïÃæ×é¼þ,ÈçListView,ListBox,ButtonµÈµÄÐÅÏ¢,ͻȻÓиöÏë·¨×Ô¼ºÐ´¸öTimer,²»ÓÃSetTimerº¯Êý,ÎÒÃÇ×Ô¼ºÓøö¶àÏß³ÌÒ²ÕýºÃʵÏÖÕâ¸ö.·´ÕýÇ°¶Îʱ¼ä¶àÏß³ÌҲŪµÃ±È½Ï¶à,±¾À´Ïëµ¥¶À½²½²µÄ,ÏÖÔÚ¾ÍÓøöÀý×ÓÀ´ËµÃ÷°É.
д³ÉÒ»¸ö¿Ø¼þ:utTimer.pas
v ......

¹ØÓÚ Delphi TThread

TThreadÊÇÒ»¸ö³éÏóÀà,ÓÃÓÚÔÚdelphiÖд´½¨Ï̡߳£
´´½¨Ò»¸öTThreadµÄ×ÓÀà¶ÔÏó¼´Ï൱ÓÚ´´½¨Ò»¸öÏ̡߳£¡¡¡¡
µ±Ò»¸öÓ¦ÓóÌÐòÔËÐÐʱ£¬Ó¦ÓóÌÐò¾Í±»ÔØÈëÄÚ´æ×¼±¸Ö´ÐС£´Ëʱ£¬Ëü³ÉΪ°üº¬Ò»¸ö»ò¶à¸öÏ̵߳Ľø³Ì¡£Ïß³ÌÖ´ÐÐÓ¦ÓóÌÐòµÄ²¿·ÖÄÚÈÝ£¬²¢ÓɲÙ×÷ϵͳ·ÖÅäCPUʱ¼ä¡£Í¬Ò»½ø³ÌµÄËùÓÐÏ̹߳²ÏíͬһµØÖ·¿Õ¼ä£¬¿ÉÒÔ·ÃÎʽø³ÌµÄÈ«¾Ö±äÁ¿ ......

ÔÚDelphiÖУ¬×Ö·û´®²éÕÒ º¯Êý

DelphiÌṩµÄ×Ö·û´®º¯ÊýÀïÓÐÒ»¸öPosº¯Êý£¬ËüµÄ¶¨ÒåÊÇ£º
function Pos(Substr: string; S: string): Integer;
ËüµÄ×÷ÓÃÊÇÔÚ×Ö·û´®SÖвéÕÒ×Ö·û´®Substr£¬·µ»ØÖµÊÇSubstrÔÚSÖеÚÒ»´Î³öÏÖµÄλÖã¬Èç¹ûûÓÐÕÒµ½£¬·µ»ØֵΪ0¡£
ʹÓÃposº¯ÊýÀ´²éÕÒ×Ö·ûµÚÒ»´Î³öÏÖµÄλÖÃ
var
str1:string;
i,j:integer;
begin
str1:='dsf465 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ