delphiÔõÑùʵÏÖÔ¶³Ì¿ØÖÆ(ת)
½«Ô¶³Ì¿ØÖÆÓ¦ÓÃÓÚ½ÌѧÖУ¬ÒѳÉΪĿǰ¼ÆËã»ú»¯½ÌѧµÄÖØÒªÊֶΡ£Ò»¶¨ÓкܶàµÄÍø³æÏëÁ˽âÕâÖÖÍøÂç½Ìѧ·½Ê½µÄ±à³ÌÔÀí°É¡£ÔÚ´ËÎÒÃǾÍÒÔÒ»¸ö¼òµ¥µÄÔ¶³Ì¿ØÖƳÌÐò×÷ΪʾÀý£¬ËµÃ÷ÕâÖÖÍøÂç±à³ÌµÄ»ù±¾ÔÀí¡£±¾³ÌÐòÒÔDelphi±à³ÌΪÀý¡£
¡¡¡¡Æäʵ¸Ã³ÌÐòµÄ¹¤×÷»úÖƺܼòµ¥£¬ÊÜ¿Ø·½ÔËÐÐÒ»¸ö³ÌÐò£¬ÓÃÓÚÕìÌý¶Ë¿Ú²¢½ÓÊÕÊý¾Ý°ü£¬¶øÖ÷¿Ø·½Í¨¹ý¶Ë¿Ú¸øÊÜ¿Ø·½µÄ¶Ë¿Ú·¢ËÍÊý¾Ý°ü¡£¸ù¾ÝÕâ¸öÔÀí£¬ÎÒÃDZàдÁ½¸ö³ÌÐò£¬Ò»¸öÊÇ¿ØÖÆ·½µÄ£¬¶øÁíÒ»¸öÊÇÊÜ¿Ø·½µÄ£¬°ÑÕâÁ½¸ö³ÌÐòÔËÐÐÔÚÁ½Ì¨²»Í¬µÄ»úÆ÷ÉÏ£¬ÊÜ¿Ø»úµÈ´ý¿ØÖÆ»ú·¢Ë͹ýÀ´µÄÊý¾ÝÈ»ºóÖ´ÐÐÏàÓ¦µÄ²Ù×÷(Èç±¾ÀýÖеÄÖØÆô)¡£
¡¡¡¡DelphiÖÐÓÐÁ½Àà¿Ø¼þ¿ÉÒÔʵÏÖÉÏÃæµÄÄ¿µÄ¡£Ò»ÀàÊÇ¿ØÖÆ·½Ê¹ÓÃClientSocket£¬ÊÜ¿Ø·½Ê¹ÓÃServerSocket(¾ùÔÚInternetÒ³)£¬ÁíÒ»ÀàÊÇË«·½¶¼Ê¹ÓÃNMUDP(ÔÚFastNetÒ³)¡£ÎÒÃÇÖªµÀÍøÂç´«Ê䶼ÊDz»¿É¿¿µÄ£¬Ò²¾ÍÊÇ˵´«ÊäµÄÊý¾ÝÓпÉÄܶªÊ§£¬¶øÕâÁ½Àà¿Ø¼þµÄÇø±ðÊÇÇ°ÕßʹÓÃTCP(Transfer Control Protocol£¬´«Êä¿ØÖÆÐÒé)¡£TCPÐÒéÊÇÃæÏòÁ¬½Ó,ÿ´ÎË«·½½¨Á¢Á¬½Ó(»ò¶Ï¿ª)ʱÐè¾¹ýÈý´ÎÎÕÊÖ,½ÏΪºÄʱ£¬µ«Êý¾Ý´«Êä¿É¿¿£»¶øºóÕßʹÓÃUDP(User Datagram Protocol£¬Óû§±¨ÎÄÐÒé)£¬ËüÊÇÃæÏòÎÞÁ¬½ÓµÄ£¬·¢³öÊý¾Ý²»Ðè¶Ô·½È·ÈÏ£¬ÕâÑùËٶȱÈTCP¿ì£¬µ«Êý¾ÝÓпÉÄܶªÊ§£¬Òò´ËËü²»¿É¿¿¡£ÓÉÓÚ¿ØÖÆËùÐè´«Ë͵ÄÊý¾ÝÁ¿²»´ó£¬¶øÇÒÐèÒª½Ï¸ßµÄ¿É¿¿ÐÔ£¬Òò´ËÒ»°ãʹÓÃÇ°Õߣ¬³ÌÐò˵Ã÷ÈçÏ£º
¡¡¡¡µÚÒ»²½£¬¿ªÊ¼¿ØÖÆ·½³ÌÐò£¬ÔÚÆäÖмÓÈëclientsocket¿Ø¼þ£¬È¡Ãûcontrol£¬ÉèÖÃhostÊôÐÔΪÊÜ¿Ø»úipµØÖ·£¬portÊôÐÔΪ1234(¶Ë¿Ú¿ÉÒÔËæ±ãÉèÖ㬵«²»ÒªÓëһЩĬÈ϶˿ÚÖظ´£¬Èç80µÈ)¡£
¡¡¡¡µÚ¶þ²½£¬ÔÚFormCreateʼþÖмÓÈë´úÂëcontrol.open; //´ò¿ªÓëÊÜ¿Ø»úµÄͨÐÅ
¡¡¡¡µÚÈý²½£¬¼ÓÈë¸öButton£¬ÉèÖÃcaptionΪ“ÖØÐÂÆô¶¯”£¬²¢ÔÚButtonClickʼþÖмÓÈë´úÂëcontrol.Socket.SendText('reboot')£»//֪ͨÊÜ¿Ø»úÖØÐÂÆô¶¯¡£ÕâÑù¾ÍÍê³ÉÁË¿ØÖÆ·½µÄ¹¤×÷ÁË¡£
¡¡¡¡µÚËIJ½£¬¿ªÊ¼ÊÜ¿Ø·½µÄ³ÌÐò£¬ÔÚÆäÖмÓÈëserversocket¿Ø¼þ£¬È¡Ãûundercontrol,ÉèÖÃportÊôÐÔΪ1234(Óë¿ØÖÆ·½µÄ¶Ë¿ÚÒ»ÖÂ)£¬activeÊôÐÔΪtrue£»
¡¡¡¡µÚÎå²½£¬ÔÚundercontrolµÄOnclientReadʼþÖмÓÈë´úÂëif Socket.ReceiveText='reboot' then
¡¡¡¡ExitWindowsEx(EWX_REBOOT,2); //ÖØÆôµÄAPIº¯Êý
¡¡¡¡ÕâÑù¾ÍÍê³ÉÁË´úÂëµÄ¹¤×÷£¬È»ºó±àÒëÕâÁ½¸ö³ÌÐòÉú³ÉÁ½¸ö.exeÎļþ·Ö±ð·ÅÔÚÁ½Ì¨»úÆ÷ÉÏÔËÐÐ(¼ÇµÃÏÈÔËÐÐWin98ϵÄÊÜ¿Ø»ú³ÌÐò)£¬ÔÚ¿ØÖÆ»ú°´Ï“ÖØÐÂÆô¶¯”µÄButton(°´Å¥)£¬ÊÜ¿Ø»ú¾ÍÖØÐÂÆô¶¯ÁË¡£Ô¶³Ì¿ØÖÆ»úÆ
Ïà¹ØÎĵµ£º
DelphiÖнØÈ¡ÎļþÃû²»º¬ºó׺²¿·Ö ÊÕ²Ø
µ±ÎļþÃûº¬ÓÐÖÐÎÄʱ£¬²»ÄÜÖ±½ÓÓÃLeftStr(FileName, Length(FileName - 4))»òÕßÓÃPosÀ´¶¨Î»"."µÄλÖÃÀ´»ñÈ¡¡£ÒòΪÖÐÎÄÒ»¸ö×Ö·ûÏ൱ÓëÁ½¸öÓ¢ÎÄ×Ö·û¡£ÕâÑù½ØÈ¡ÍùÍù»¹ÊÇ°ÑÕû¸öFileName¶¼½ØÏÂÀ´ÁË¡£
Ó¦µ±Ê¹ÓÃCopyº¯Êý£¬ÈçÏ£º
TmpFileLength := Pos(extFile, FileName); TmpFileName := ......
1.·ÀֹˢÐÂʱÉÁ˸µÄÖÕ¼«½â¾ö°ì·¨
{ ·ÀֹˢÐÂʱÉÁ˸µÄÖÕ¼«½â¾ö°ì·¨(¶Ô¸¶Ë«»º³åÎÞЧʱ) }
Perform($000B, 0, 0); //ËøÆÁÄ» ·ÀÖ¹ÉÁ˸
// ×öһЩ»á·¢ÉúÑÏÖØÉÁ˸µÄÊÂÇé..
//½âËøÆÁÄ»²¢ÖØ»
Perform($000B, 1, 0);
RedrawWindow(Handle, nil, 0, RDW_FRAME + RDW_INVALIDATE + R ......
ÎÒʹÓÃdelphiÒ²²»ÊǺܳ¤Ê±¼ä£¬ÓÉÓÚ¾³£ÒªÓõ½SQLÓï¾ä£¬×ܽáÁËһЩDelphiÖÐʹÓÃSQLÓï¾äҪעÒâµÄÊÂÏ¹éÄÉÆðÀ´Ö÷ÒªÓÐһϼ¸Ìõ£º
Ò»¡¢¿Õ¸ñ²»ÒªÂ©£º
ÎÒÃǾ³£ÒªÆ´×°SQLÓï¾ä£¬ÌرðÊÇwhereÌõ¼þ¾ä£¬ÔÚ¸÷¸öÓï¾äÖбðÍüÁËͷβ¼ÓÉÏ¿Õ¸ñ¡£ÒòΪÔÚÒ»¸öÓï¾äÖÐÎÒÃÇ»á×¢ÒâÓÿոñ·Ö¿ª¹Ø¼ü×Öµ«ÊÇÍùÍùÍüÁËͷβµÄ¿Õ¸ñ¡£ÀýÈ磺
sSQL=' select ......
Anders Hejlsberg(°²µÂ˹-º£É²©¸ñ) ×øÔÚ×Ô¼ºµÄ°ì¹«ÊÒ£¬Ë«ÑÛÖ±Ö±µÄ¶¢×ÅÇ°·½¡£ËûÒª×öÒ»¸ö¾ö¶¨£¬¾ö¶¨×Ô¼ºÎ´À´µÄÃüÔ˺ÍÀíÏë¡£ÕâÊÇ1996ÄêÒ»¸öÆÕͨµÄÏÂÎ磬¼¸¸öСʱǰ£¬Ëû¸ÕÓë±È¶û-¸Ç´Ä½áÊøÁËÒ»´ÎÓä¿ìµÄÎç²Í£¬Í¬ÎªÈí¼þ½çµÄ¾«Ó¢£¬ËûÃÇÏà̸Éõ»¶£¬¸Ç´Ä¸øËû¿ª³öÈý°ÙÍòÒÔÉϵÄÄêнºÍÊýÍò¹ÉµÄ΢Èí¹ÉƱ¡£ÕâÊÇÒ»¸öÓÕÈË ......
×î½ü¾³£»áÄ£ÄâÍøÒ³Ìá½»·µ»ØÍøÒ³Ô´Â룬Ȼºó»ñµÃÍøÒ³ÖÐÏàÓ¦µÄÔªËØ£¬ÓÚÊÇÐèÒª³£³£½âÎöHtmlÖÐÏàÓ¦µÄ¸÷ÖÖÔªËØ£¬ÍøÂçÊǸöºÃ¶«Î÷£¬ËÑË÷Ò»·¬£¬¾ÍÕÒµ½ÁË
ºÃ¼¸¸öDelphi°æ±¾µÄHtmlParserµÄÀà¿â£¬ÊÔ×ÅʹÓÃÁ˼¸¸ö£¬·¢ÏÖ½âÎöÆðÀ´¶¼²»ÍêÕû£¬»ò¶à»òÉٵĻسöÏÖһЩÎÊÌ⣡ÓÚÊÇÏëµ½ÁËÈç¹û½çÃæÉÏÓÐÒ»¸öä¯
ÀÀÆ÷£¬ÎÒÃÇ¿ÉÒÔͨ¹ýWebBrowserµÄDocu ......