VCÖе÷ÓÃDelphiµÄDLLÖеĻص÷º¯ÊýÀý×Ó
//Delphi²¿·Ö
//»Øµ÷º¯Êý¶¨Òå
type TOnMyCallBack = procedure(data:pchar; id:Integer);stdcall;
//DLLÖеĵ¼³öº¯ÊýÉùÃ÷
procedure StartCall(param: TOnMyCallBack(data:pchar; id:Integer);stdcall;
begin
...
...
end;
-----------------------------------------------------------------------------------------------------------------------------
//vcµ÷Óò¿·Ö
typedef void (CALLBACK *MY_CallBack)(void *, char *data, int id);
void CALLBACK cxxGetDllData(void *data, int id)
{
CString ss;
ss.Format("%s:%d", data, id);
::MessageBox(NULL, "ÊÕµ½Êý¾Ý:", ss, MB_OK | MB_ICONWARNING);
}
void CTttDlg::OnOK()
{
//¶¯Ì¬¼ÓÔØDLLµ½µ±Ç°EXEµÄ½ø³Ì¿Õ¼ä
HINSTANCE hDll = LoadLibrary("d:\\temp\\test.dll");
if(!hDll)
{
:MessageBox(NULL, "¼ÓÔØ¶¯Ì¬Á´½Ó¿âʧ°Ü£¡", "Notice", MB_OK | MB_ICONWARNING);
return ;
}
MY_CallBack hStartCall = (MY_CallBack) ::GetProcAddress(hDll, "StartCall");
if(!hStartCall)
{
::MessageBox(NULL,"»ñÈ¡StartCallº¯ÊýµØÖ·´íÎó£¡","Notice",MB_ICONWARNING);
return ;
}
hStartCall(cxxGetDllData,"123456",100);
}
Ïà¹ØÎĵµ£º
¼¼Êõ½»Á÷,DH½²½â. ÔÚD2010µÄclassesÖÐÓиöTBitsÀà,Õâ¸öÀàÖ÷ÒªÊÇλ²Ù×÷µÄ. TBits = class
private
FSize: Integer;
FBits: Pointer;
procedure Error;
procedure SetSize(Value: Integer);
procedure SetBit(Index: Integer; Value: Boolean);
function GetBit(Index: Integer): Boole ......
DELPHIÓõò»Ì«¶à£¬¼ÓÉÏÄԽºÃʹ£¬¾Í¼ÇÒ»ÏÂ×î³£ÓöԿª·¢Ð§ÂʺÜÓаïÖúµÄ¼¸¸ö£º
Ctrl+Êó±ê×ó¼ü£º²éÕÒ¶¨Òå
Ctrl+Shift+↑£ºÉÏÒ»²Ù×÷ÓëÆäÕýºÃÏà·´£¬Óɶ¨Òå²éÕÒʵÏÖ
Ctrl+Shift+¿Õ¸ñ£ºÔÚÒ»¸öº¯ÊýûÓÐÊäÈë²ÎÊýµÄÀ¨ºÅÄÚ°´Ï´˿ì½Ý¼üʱ»á³öÏÖº¯ÊýÏà¹Ø²ÎÊýµÄÌáʾÐÅÏ¢£¬°üÀ¨ÖØÔصÄËùÓк¯ÊýµÄÐÅÏ¢ ......
Chr ½«Ò»¸öÓÐÐòÊý¾Ýת»»ÎªÒ»¸öANSI×Ö·û
Ord ½«Ò»¸öÓÐÐòÀàÐÍֵת»»ÎªËüµÄÐòºÅ
Round ת»»Ò»¸öʵÐÍֵΪËÄÉáÎåÈëºóµÄÕûÐÍÖµ
Trunc ת»»Ò»¸öʵÐÍֵΪСÊý½Ø¶ÏºóµÄÕûÐÍÖµ
Int ·µ»Ø¸¡µãÊýµÄÕûÊý²¿·Ö
IntToStr ½«Êýֵת»»Îª×Ö· ......
ÔÚÍøÉÏÒ²¿´µ½ÁËһЩÌáÉý½ø³ÌÁîÅÆµÄº¯Êýµ«¶¼²»ÔõôºÃÓÃ,×îºóÎÒ»¹ÊÇ´ÓÒ»¸öºÚ¿ÍºóÃųÌÐòµÄÔ´´úÂëÖÐÌáÈ¡³öÁËÒ»¸öºÃµÄÌáÉý½ø³ÌÁîÅÆµÄº¯Êý,²»¸Ò¶ÀÏí,¸ú´ó¼Ò·ÖÏíÏÂ.ÄǸöºóÃÅÕæµÄдµÄºÜºÃ...
HysiaÌáʾÄã:
Õâ¸öº¯ÊýÓÃÔÚ¶Ô¸¶²¡¶¾µÄ³ÌÐòÖÐЧ¹ûºÜºÃ,Ö»ÓÐÌáÉý×ÔÉíȨÏÞ²ÅÄÜKILLµô²¡¶¾½ø³ÌÎÒÔøÐ´Ð´³öÀ´³¢ÊÔ½áÊøWinlogon½ø³Ì,µ¼ÖµĽṠ......
½üÀ´·¢ÏÖÒ»¸öDelphiĪÃûÆäÃîµÄbug£¬µ±Ê¹ÓÃSetOptionalParamʱ£¬²»ÄÜʹÓÃÒ»Á¬´®Êý×ÖµÄ×Ö·û´®£¬Èç'101'£¬×¢Ò⣬ÊÇ´øÒýºÅµÄ¡£ÔÚSaveToFileʱ£¬¾Í»á³öÏÖ'Invalid field type'µÄÒì³££¬ÕæÊǰÙ˼²»µÃÆä½â£¡Á¬'001'ÕâÖÖ´®Ò²²»ÐУ¬È¥µôÒýºÅ£¬Ö±½Ó°´Êý×Ö¸³Öµ£¬ÔòÕý³£¡£
procedure TForm1.Button1Click(Sender: TObject);
var
  ......