CÓïÑԻص÷º¯ÊýʹÓÃ
ʲôÊǻص÷º¯Êý£¿
¡¡¡¡¼ò¶øÑÔÖ®£¬»Øµ÷º¯Êý¾ÍÊÇÒ»¸öͨ¹ýº¯ÊýÖ¸Õëµ÷Óõĺ¯Êý¡£Èç¹ûÄã°Ñº¯ÊýµÄÖ¸Õ루µØÖ·£©×÷Ϊ²ÎÊý´«µÝ¸øÁíÒ»¸öº¯Êý£¬µ±Õâ¸öÖ¸Õë±»ÓÃΪµ÷ÓÃËüËùÖ¸ÏòµÄº¯Êýʱ£¬ÎÒÃǾÍ˵ÕâÊǻص÷º¯Êý¡£
¡¡¡¡ÎªÊ²Ã´ÒªÊ¹Óûص÷º¯Êý£¿
¡¡¡¡ÒòΪ¿ÉÒ԰ѵ÷ÓÃÕßÓë±»µ÷ÓÃÕß·Ö¿ª¡£µ÷ÓÃÕß²»¹ØÐÄËÊDZ»µ÷ÓÃÕߣ¬ËùÓÐËüÐèÖªµÀµÄ£¬Ö»ÊÇ´æÔÚÒ»¸ö¾ßÓÐijÖÖÌض¨ÔÐÍ¡¢Ä³Ð©ÏÞÖÆÌõ¼þ£¨Èç·µ»ØֵΪint£©µÄ±»µ÷Óú¯Êý¡£
¡¡
¡¡Èç¹ûÏëÖªµÀ»Øµ÷º¯ÊýÔÚʵ¼ÊÖÐÓÐʲô×÷Óã¬ÏȼÙÉèÓÐÕâÑùÒ»ÖÖÇé¿ö£¬ÎÒÃÇÒª±àдһ¸ö¿â£¬ËüÌṩÁËijЩÅÅÐòËã·¨µÄʵÏÖ£¬ÈçðÅÝÅÅÐò¡¢¿ìËÙÅÅÐò¡¢shellÅÅ
Ðò¡¢shakeÅÅÐòµÈµÈ£¬µ«ÎªÊ¹¿â¸ü¼ÓͨÓ㬲»ÏëÔÚº¯ÊýÖÐǶÈëÅÅÐòÂß¼£¬¶øÈÃʹÓÃÕßÀ´ÊµÏÖÏàÓ¦µÄÂß¼£»»òÕߣ¬ÏëÈÿâ¿ÉÓÃÓÚ¶àÖÖÊý¾ÝÀàÐÍ£¨int¡¢
float¡¢string£©£¬´Ëʱ£¬¸ÃÔõô°ìÄØ£¿¿ÉÒÔʹÓú¯ÊýÖ¸Õ룬²¢½øÐлص÷¡£
¡¡¡¡»Øµ÷¿ÉÓÃÓÚ֪ͨ»úÖÆ£¬ÀýÈ磬ÓÐʱҪÔÚ³ÌÐòÖÐÉèÖÃÒ»¸ö
¼ÆʱÆ÷£¬Ã¿µ½Ò»¶¨Ê±¼ä£¬³ÌÐò»áµÃµ½ÏàÓ¦µÄ֪ͨ£¬µ«Í¨Öª»úÖƵÄʵÏÖÕ߶ÔÎÒÃǵijÌÐòÒ»ÎÞËùÖª¡£¶ø´Ëʱ£¬¾ÍÐèÓÐÒ»¸öÌض¨ÔÐ͵ĺ¯ÊýÖ¸Õ룬ÓÃÕâ¸öÖ¸ÕëÀ´½øÐлص÷£¬
À´Í¨ÖªÎÒÃǵijÌÐòʼþÒѾ·¢Éú¡£Êµ¼ÊÉÏ£¬SetTimer()
APIʹÓÃÁËÒ»¸ö»Øµ÷º¯ÊýÀ´Í¨Öª¼ÆʱÆ÷£¬¶øÇÒ£¬ÍòһûÓÐÌṩ»Øµ÷º¯Êý£¬Ëü»¹»á°ÑÒ»¸öÏûÏ¢·¢Íù³ÌÐòµÄÏûÏ¢¶ÓÁС£
¡¡¡¡ÁíÒ»¸öʹÓûص÷»úÖƵÄ
APIº¯ÊýÊÇEnumWindow()£¬Ëüö¾ÙÆÁÄ»ÉÏËùÓеĶ¥²ã´°¿Ú£¬ÎªÃ¿¸ö´°¿Úµ÷ÓÃÒ»¸ö³ÌÐòÌṩµÄº¯Êý£¬²¢´«µÝ´°¿ÚµÄ´¦Àí³ÌÐò¡£Èç¹û±»µ÷ÓÃÕß·µ»ØÒ»¸ö
Öµ£¬¾Í¼ÌÐø½øÐеü´ú£¬·ñÔò£¬Í˳ö¡£EnumWindow()²¢²»¹ØÐı»µ÷ÓÃÕßÔں䦣¬Ò²²»¹ØÐı»µ÷ÓÃÕßÓÃËü´«µÝµÄ´¦Àí³ÌÐò×öÁËʲô£¬ËüÖ»¹ØÐÄ·µ»ØÖµ£¬ÒòΪ
»ùÓÚ·µ»ØÖµ£¬Ëü½«¼ÌÐøÖ´ÐлòÍ˳ö¡£
¡¡¡¡²»¹ÜÔõô˵£¬»Øµ÷º¯ÊýÊǼÌÐø×ÔCÓïÑԵģ¬Òò¶ø£¬ÔÚC++ÖУ¬Ó¦Ö»ÔÚÓëC´úÂ뽨Á¢½Ó¿Ú£¬»òÓëÒÑÓеĻص÷½Ó¿Ú´ò½»µÀʱ£¬²ÅʹÓûص÷º¯Êý¡£³ýÁËÉÏÊöÇé¿ö£¬ÔÚC++ÖÐӦʹÓÃÐéÄâ·½·¨»òº¯Êý·û£¨functor£©£¬¶ø²»Êǻص÷º¯Êý¡£
¡¡¡¡Ò»¸ö¼òµ¥µÄ»Øµ÷º¯ÊýʵÏÖ
¡¡¡¡ÏÂÃæ´´½¨ÁËÒ»¸ösort.dllµÄ¶¯Ì¬Á´½Ó¿â£¬Ëüµ¼³öÁËÒ»¸öÃûΪ
CompareFunctionµÄÀàÐÍ--typedef int (__stdcall *CompareFunction)(const
byte*, const
byte*)£¬Ëü¾ÍÊǻص÷º¯ÊýµÄÀàÐÍ¡£ÁíÍ⣬ËüÒ²µ¼³öÁËÁ½¸ö·½·¨£ºBubblesort()ºÍQuicksort()£¬ÕâÁ½¸ö·½·¨ÔÐÍÏàͬ£¬µ«ÊµÏÖÁ˲»Í¬
µÄÅÅÐòËã·¨¡£
void DLLDIR __stdcall Bubblesort(byte* array,int size,int elem_size,CompareFunction cmpFunc);
void DLLDIR __stdcall Qui
Ïà¹ØÎĵµ£º
Ò»¡¢´ÓCÓëC++±àÒëÁ¬½Ó·½Ê½ÉîÈëÀí½âextern "C"
<1>.CºÍC++¶Ôº¯ÊýµÄ´¦Àí·½Ê½ÊDz»Í¬µÄ.±»extern "C"ÐÞÊεıäÁ¿ºÍº¯ÊýÊÇ°´ÕÕCÓïÑÔ·½Ê½±àÒëºÍÁ¬½ÓµÄ.extern "C"ÓÃÓÚʵÏÖC++ÓëC¼°ÆäËüÓïÑԵĻìºÏ±à³Ì¡£
<2>.δ¼Óextern “C”ÉùÃ÷ʱµÄ±àÒ뷽ʽ
Ê×ÏÈ¿´¿´C++ÖжÔÀàËÆCµÄº¯ÊýÊÇÔõÑù±àÒëµÄ¡£
×÷ΪһÖÖÃæÏò ......
CÓïÑÔ»ù±¾¹¦½Ì³ÌϵÁÐ(3) - ¿ìËٵĺ¯Êýµ÷ÓÃ
ÎÒÓÖÀ´ÁË£¬½ñÌ쿲¿²º¯Êýµ÷ÓõÄÎÊÌâ¡£º¯ÊýÄÄÀﶼÓУ¬Ð¡µÄ³ÌÐòÒ»Á½¸öº¯Êý£¬´óµÄ³ÌÐò³É°ÙÉÏǧ¸öº¯Êý¡£¼´Ê¹ÔÚÓÎÏ·µÄ¹Ø¼üÑ»·ÖУ¬µ÷Óü¸Ê®¸öº¯ÊýÒ²ÊǺܳ£¼ûµÄ¡£ËùÒÔº¯Êýµ÷ÓôúÂëµÄÖÊÁ¿£¬Ôںܴó³Ì¶ÈÉÏÓ°Ïì×ÅÓÎÏ·µÄÖÊÁ¿¡£
»¹ÊÇÏÈ˵×î»ù±¾µÄ´úÂë·ç¸ñÎÊÌâ¡£Ê×ÏÈ£¬¶ÔÓÚº¯ÊýµÄ²ÎÊý£¨ÌرðÊÇ ......
µÚÒ»´Î×ÐϸµØ¿´ÕâÖÖ´úÂ룬¶¼ÊÇ´ÓÍøÉϸ´ÖÆ×öÁËÂÔ΢¸Ä¶¯ºóµÄ²úÎï¡£´úÂëÈçÏ£º
#include "reg52.h"
unsigned char Count;
sbit Xiang=P1^2 ; //·äÃùÆ÷Ïì
unsigned char code SONG[] ={
0x26,0x20,0x20,0x20,0x20,0x20,0x26,0x10,0x20,0x10,0x20,0x80,0x26,0x20,0x30,0x20,
0x30,0x20,0x39,0x10,0x30,0x10,0x30,0x80,0x2 ......
¡¡¡¡1£¬mallocÓëfreeÊÇC++/CÓïÑԵıê×¼¿âº¯Êý£¬new/deleteÊÇC++µÄÔËËã·û¡£ËüÃǶ¼¿ÉÓÃÓÚÉêÇ붯̬ÄÚ´æºÍÊÍ·ÅÄÚ´æ¡£
¡¡¡¡2£¬¶ÔÓÚ·ÇÄÚ²¿Êý¾ÝÀàÐ͵ĶÔÏó¶øÑÔ£¬¹âÓÃmaloc/freeÎÞ·¨Âú×㶯̬¶ÔÏóµÄÒªÇ󡣶ÔÏóÔÚ´´½¨µÄͬʱҪ×Ô¶¯Ö´Ðй¹Ô캯Êý£¬¶ÔÏóÔÚÏûÍö֮ǰҪ×Ô¶¯Ö´ÐÐÎö¹¹º¯Êý¡£ÓÉÓÚmalloc/freeÊǿ⺯Êý¶ø²»ÊÇÔËËã·û£¬²»ÔÚ±àÒëÆ ......