Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

ʹÓÃVC±àдVBʹÓÃDLL

ʹÓÃVC±àдVBʹÓÃDLL
Ò»¡¢ÔÚº¯Êý¶¨ÒåÇ°±ØÐë¼ÓÉÏextern "c"£¬_stdcall¹Ø¼ü×Ö¡£
 extern "C" int _stdcall Sum(int x,int y)
 {
  return x+y;
 }
 
¶þ¡¢DLLµÄ.defÎļþÖбØÐë¼ÓÉÏÈë¿Úº¯Êý
    EXPORTS
     sample @1
    
 sampleÊÇÄãÒªÔÚVBÖе÷Óõĺ¯ÊýÃû£¬@1±íʾ¸Ãº¯ÊýÔÚDLLÖеıàºÅ
 
Èý¡¢Òª×¢ÒâDLLÖеĺ¯ÊýºÍVBÖеĺ¯ÊýÉùÃ÷ÔÚÃû³Æ¡¢·µ»ØÀàÐÍ¡¢²ÎÊýÀàÐÍ¡¢²ÎÊý¸öÊýµÈ·½Ãæ±ØÐëÍêÈ«Ïàͬ£¬ÓÈÆäҪעÒâ´óСдµÄÎÊÌâ¡£
×¢ÒâÊÂÏ
 1¡¢±ØÐë±£Ö¤VBºÍVCµÄ²ÎÊý¸öÊýÏàͬ£¬²ÎÊýËùÕ¼×Ö½ÚÊýÒ²Ò»ÖÂ
3£®Êý×é²ÎÊýÔÚDLLÖеĴ«µÝ
¡¡¡¡ÓÉÓÚDLL¾­³£ÓÃÀ´½øÐÐһЩµ×²ãµÄÔËËã²Ù×÷£¬Òò´ËÓ¦ÓóÌÐò³£ÐèÒª´«µÝ´óÁ¿µÄÊý¾Ý¸øDLL¡£ÔÚC++ÖУ¬Ö¸ÕëÊǽøÐÐÊý×é²Ù×÷µÄ×î¼ÑÑ¡Ôñ£¬µ«VBÖÐûÓÐÖ¸ÕëµÄ¸ÅÄî¡£Õâͨ³£¿ÉÓÃÁ½ÖÖ·½·¨À´½â¾ö¡£
¡¡¡¡ÆäÒ»£¬ÔÚVBÖÐÉùÃ÷DLLʱ£¬ÓÃbyrefÀ´´úÌæbyval£¬¼´¿É½«Êý×éÖ¸Õë´«µÝ¸øDLL¡£
¡¡¡¡ÁíÍ⣬½«Êý×éÉùÃ÷Ϊ±äÌåÐÍ£¨variant£©£¬¼´¿ÉÖ±½Ó½«Êý×é´«µÝ¸øDLL¡£
ËÄ¡¢ÔÚvbÖÐÉùÃ÷£¨"dllTest.dll" ʹÓõÄÊÇÏà¶Ô·¾¶£¬Äã¿ÉÒÔ½«dll.dll·Åµ½.exeËùÔÚµÄĿ¼»òϵͳĿ¼£©£¬º¯ÊýÃû´óСÃô¸Ð
Private Declare Function Sum Lib "dllTest.dll" (ByVal x As Long, ByVal y As Long) As Long
Îå¡¢Àý×Ó
 1¡¢Ð½¨Ò»¸öwin32 dynamic library,¿ÕµÄ¹¤³Ì
 2¡¢Ð½¨Ò»¸ödllTest.cpp Îļþ,²¢Ìí¼Óµ½¹¤³Ì¡£ÄÚÈÝÈçÏÂ
// dll4.cpp : Defines the entry point for the DLL application.
//
#include "stdafx.h"
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
extern "C" int _stdcall Sum(int x,int y)
{
return x+y;
}
extern "C" int _stdcall GetNum(int Num) /*¾ßÌåʵÏÖ*/
{
return Num;
}

 // dll4.cpp : Defines the entry point for the DLL application.
//
#include "stdafx.h"
BOOL APIENTRY DllMain( HANDLE hModule,
                       DWORD  ul_reason_for_call,
          


Ïà¹ØÎĵµ£º

VBÈçºÎÉú³ÉWINDOW XP·ç¸ñ½çÃ棡

 ËäÈ»WindowsXPµÄ½çÃæ·Ç³£»ªÀö¡£µ«ÊÇÁîÈËÒź¶µÄÊÇ£¬ÎÒÃÇÓÃVBдµÄ³ÌÐò³ýÁ˲˵¥ºÍ´°¿ÚµÄÍâ¹ÛÊÇXP·ç¸ñÍ⣬ÆäËû¿Ø¼þ»¹ÊÇÒ»Èç¼ÈÍùµÄÊÇÆÕͨ·ç¸ñ¡£ÎÒÏ룬ÓеijÌÐòÔÚXPÏÂÓÐXPµÄ·ç¸ñ£¬VBÒ²Ò»¶¨Óа취ʵÏÖXPµÄ·ç¸ñ¡£ºóÀ´±ÊÕßÔÚÍøÉÏ¿´µ½Ò»Æª½éÉÜXMLµÄÎÄÕ£¬ÓÖÔÚÍøÉÏÕÒµ½ÁËһƪʵÏÖXP·ç¸ñµÄÎÄÕ£¬¾­¹ý×Ô¼ºµÄʵ¼ù£¬ÖÕÓÚÕÒµ½ÁËVB³ÌÐò ......

»ñµÃVB listbox Ñ¡ÖÐÏîÄ¿(¶àÏî)µÄÒ»¸öºÃ·½·¨

´«Í³·½·¨ÊDZéÀúÒ»±é
Èç¹ûlistbox ÏîÄ¿¹ý¶à
Ã÷ÏÔËٶȲ»ÐÐ
ºÃ·½·¨ÊÇͨ¹ýsendmessge·¢ÏûÏ¢¸ølistboxÈÃËû°ÑÑ¡ÖÐÏîÄ¿Ö±½Ó´«µ½²ÎÊýÊý×éÖÐ
You can use the SendMessage() API function instead.
As
you probably know, this function lets you send a message to one or more
windows. The declaration statement conforms ......

ÖØÊ°VBÖ®¶þ£¬ºÁÃëƪ

ÖØÊ°VBÖ®¶þ£¬ºÁÃëƪ
PMP ¹Ø¾¢ËÉ
   
    ¹íʹÉñ²î£¬09Äê12ÔÂÈëÖ°µÄ¹«Ë¾ÈÔʹÓÃVB¿ª·¢Èí¼þ£¬ËäÈ»²¢·Çרְ¿ª·¢£¬µ«Ò²²»µÃ²»ÔÚʸô4ÄêÖ®ºó£¬ÖØÐÂʹÓÃVB¡£
    ÔÚvbÖÐÈçºÎ»ñµÃºÁÃ뾫¶È¼¶±ðµÄʱ¼ä£¿vbµÄʱ¼äº¯Êý²»Ö§³ÖºÁÃ룬ÐèÒªÀûÓÃwindowsµÄ»ù±¾API£¬±àд³ÌÐò²ÅÄÜ»ñÈ¡ºÁÃ뼶 ......

vb class Property Get¡¢Property Let ʹÓÃ

vb class Property Get¡¢Property Let ʹÓÃ
<%
'ÔÚ Class ¿éÖУ¬³ÉԱͨ¹ýÏàÓ¦µÄÉùÃ÷Óï¾ä±»ÉùÃ÷Ϊ Private(˽ÓгÉÔ±£¬Ö»ÄÜÔÚÀàÄÚ²¿µ÷ÓÃ) »ò Public(¹«ÓгÉÔ±£¬¿ÉÒÔÔÚÀàÄÚÍⲿµ÷ÓÃ) ¡£
'±»ÉùÃ÷Ϊ Private µÄ½«Ö»ÔÚ Class ¿éÄÚÊǿɼûµÄ¡£±»ÉùÃ÷Ϊ Public ²»½öÔÚ Class ¿éµÄÄÚ²¿ÊǿɼûµÄ£¬¶Ô Class ¿éÖ®ÍâµÄ´úÂëÒ²Êǿɼûµ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ