ÎÊÌâ: C#³ÌÐòÀïÃæ¿ÉÒÔÊÕµ½C³ÌÐò´«À´µÄÊý¾Ý°ü.µ«ÊÇÿ´ÎÖ»ÓÐÒ»¸öBYTE.ÎÞÂÛC³ÌÐòÀïÃæÊý¾Ý°ü³¤¶È´óСÊǶàÉÙ.
·½°¸:
ÏòC³ÌÐò´«µÝÒ»¸öº¯ÊýÖ¸Õë(C#ÖÐΪίÍÐ)¹ýÈ¥¡£
C#ÀïÃ涨ÒåÒ»¸öÏìÓ¦Êý¾Ý°üµÄ·½·¨£¬½«´Ë·½·¨·â×°ÔÚίÍÐÖУ¬´«¸øC³ÌÐò£¬
C³ÌÐòÄÇÀïÊÕµ½Êý¾Ý°üʱ¼´¿Éµ÷Óø÷½·¨¡£
C#Æô¶¯CµÄ·þÎñ-->C#ÏòC³ÌÐò×¢²áº¯ÊýÖ¸Õë-->C·þÎñÔÚÊʵ±µÄʱºò»Øµ÷C#×¢²áµÄ¸Ã·½·¨
C#³ÌÐò
public delegate void dele_newPacket(Byte[] packet);
public static void newPacket(Byte[] packet)
{}
[DllImport("Win32-Server-DLL.dll", EntryPoint = "start_delegate")]
public static extern void start_delegate(dele_newPacket packet);
CS_Console_1.Program.dele_newPacket packet = CS_Console_1.Program.newPacket;
CS_Console_1.Program.start_delegate(packet);
C´úÂë:
void (_stdcall *dele_func)(BYTE* );//È«¾Ö±äÁ¿
void start_delegate(void(_stdcall *start_address )( BYTE* ) )
{
printf("start_delegate call start:\n");
dele_func = start_address;
(*dele_func)((BYTE*)packet);//packet×ÊÇ1024BYTE
printf("start_delegate call end:\n");
}
Ö»ÒªÊý¾Ý°üÕýÈ·´«ÈëC#³ÌÐò¾Í¿ÉÒÔÁË,ÔÚC#ÀïÃæ½øÐÐÊý¾Ý°ü´¦Àí. Çë°ïæ°¡.
ÎÒÏëÓÃc/sdk listviewµÃµ½ÏÂÃæµÄЧ¹û£¬ÓÐÈË˵×ö±íÍ·ÐèÒª×Ի棬´´½¨Ê±»¹Òª¼ÓLVS_OWNERDRAWFIXEDÀàÐÍ£¬È»ºó´¦Àí¸¸´°¿ÚµÄWM_DRAWITEMÏûÏ¢¡£
ÄÄλÄÜ°ï°ïæ¸ø¸öÀý×Ó´úÂ룿 ×îºÃÊÇC/SDKµÄ¡£
ÎÒÐèÒªµÃµ½ÕâÑùµ ......