delphi ÎÊÌâÇóÖú - Delphi / ÍøÂçͨÐÅ/·Ö²¼Ê½¿ª·¢
ÎÊÌâÊÇÕâÑù×ÓµÄ
ÎÒÔÚform1Öж¨ÒåÁËÒ»¸ösk1:tsocket
È»ºóÔÚform2ÖÐ
ÓÃsk1 ·¢ËͶ«Î÷ ·¢Íêºó socket ×Ô¶¯¹Ø±ÕÁË~
µ«ÊÇÔÚform1Öз¢¶«Î÷ Èç¹ûÎÒ²»ÔËÐÐ closesocket µÄ»° ÊDz»»á¶ÏµôµÄ
ÎÊÏ ÕâÊÇÔõô»ØÊÂ
ÁíÎÒÔÚ form2 Àï¼ÓÁ˸ö
uses Unit1;
Ö±½Óµ÷ÓÃ sk1~
ÕâÑù×ÓÓ¦¸ÃûÎÊÌâ°É~
µ¥²½µ÷ÊÔÁËÏÂ~
type
test_array=array[0..211] of Byte;
var
re:integer;
message_headpack:array[0..3] of Byte;
test_byte:array[0..207] of Byte;
send_pack:test_array;
psend_pack:^test_array;
~~~~~~~~~~~~~~~~~~~~
Ç°±ßÊÇЩ¸³ÖµÓï¾ä¾Í²»¸´ÖÆÁË
for i:=0 to sizeof(message_headpack)-1 do
send_pack[i]:=message_headpack[i];
for i:=SizeOf(message_headpack)to SizeOf(send_pack)-1 do
send_pack[i]:=test_byte[i-sizeof(message_headpack)];
re:=send(sk1,psend_pack^,Length(psend_pack^),0);
//µ¥²½ÔËÐе½ÕâÒ»²½ ¾Í·¢ÏÖÐÅÏ¢°ü·¢³öÈ¥ºó È»ºósocketÒ²×Ô¶¯¹Ø±ÕÁË~sk1ÊÇÌ×½Ó×Ö~ÎÒÔÚunit1Öж¨ÒåµÄ
if(Re=SOCKET_ERROR)then
begin
ShowMessage('·¢ËÍ´íÎó');
exit;
end;
form2.Release;
close;
¸ßÊÖ°ïÎÒ¿´ÏÂ
¶¥ÆðÀ´~
Õâ¸öµ½µ×ÊÇÔõô»ØÊ°¡~
·þÎñÆ÷ÊÇÓÃCдµÄ
ÎÒÔÚunit1 Ï·¢ËÍ ÊDz»»á¶Ï¿ªµÄ~
µ«ÔÚunit2 Ï·¢ËÍ socket¾Í¶Ï¿ªÁË~
¼Ó¸öÊä³ö´íÎóÐÅÏ¢¿´ÏÂ
uses
Winsock2;
try
re:=send(sk1,psend_pack^,Length(psend
Ïà¹ØÎÊ´ð£º
Ò»Ö±ÏëʹÓÃdll£¬µ«delphiµÄdll×Ó´°Ìå¾³£Óи÷ÖÖÎÊÌ⣬±ÈÈçÖ÷´°¿ÚÓëdll×Ó´°¿ÚµÄ½¹µãÎÊÌ⣬×Ó´°¿ÚÖпؼþµÄtab¼ü¡¢Èȼü¡¢enter¼üµÈµÄÎÊÌ⣬×Ó´°¿ÚÍ˳öµÄÎÊÌ⡢ƽÃæ°´Å¥ÎÊÌâµÈµÈ£¬ÍøÕ¾ÉϽøÐÐÁËËÑË÷£¬Ã»ÓбȽÏÍêÃÀµÄ½â¾ö· ......
//DLL ·ÅÔÚEXEÖÐûÎÊÌâ
function SkinForm(var skfrm:TForm):Integer;stdcall;
var
skf:TbsBusinessSkinForm;
nskfrm:TForm;
begin
frmUUMain:=skfrm;
skf:=TbsBus ......
¸÷λºÃ£¡£¡
¼ÙÉèÎÒÓÐÁ½¸ötextÎļþ
Ò»¸öÃû½Ð 1.text
ÄÚÈÝ£º
I like PC....
ÁíÍâÒ»ÊÇ2.text
ÄÚÈÝ:
function yk as string
endfunction
globals
endglobals
***********************·Ö½çÏß********** ......
adoconnection1.ConnectionString := 'driver={MySQL ODBC 3.51 Driver};server=localhost;uid=root;pwd=111111;database=xiamen';
adoconnection1.Open;
adodataset1.Connection := adoconne ......
DBGridÖеÄÁбȽ϶à
ÔÚQueryˢкóÈç¹ûÈÃËüÏÔʾÔÚijһÐУ¿
ÒýÓÃ
DBGrid1.SelectedIndex := ÄãÒªÏÔʾµÄÄÇÒ»ÐÐ;
²»ºÃÒâ˼£¬ÎÒд´íÁË£¬ÊÇijһÁС£¡£¡£
ÒýÓÃ
²»ÊǺÜÃ÷°×,ºÜ¶àÁÐÓëÐÐÓ¦¸Ãû¹Ø°É
ÊÇ·ñÏëҪˢР......