1¡¢¹ØÓÚ¼ª´óÊÓƵ£º1-3¼¯½²VB³ÌÐòÉè¼ÆµÄ¸ÅÊö4-30¼¯½²VB»ù´¡ÖªÊ¶£¬Èç¿Ø¼þµÄʹÓÃ31-64¼¯½²ActiveX¿Ø¼þ¡¢Êý¾Ý¿âµÈµÄ¸ß¼¶±à³Ì²¿·Ö¡£
¿´µÄ¹ý³ÌÖÐ×¢Òâ¿ì½Ý¼üµÄʹÓúͽØͼ¹¤¾ßµÄÔËÓ㬿´ÊÓƵʱ½«Öصã×÷³ö±ê×¢¡£
2¡¢ÓÉCSTR¡¢Cstr£¨£©¡¢string¡¢Instr£¨£©ºÍstr£¨£©£¨´ËΪÉî¶ÈÀ©Õ¹£©ËùÏëµ½µÄ¹ØÓÚ×ܽáµÄ·½·¨¡£
CSTRÔÚVB³ÌÐòÉè¼ÆÖÐÊDz»´æÔڵģ¬¼´Ê¹ÇÃÈëCSTRºó£¬VBÒ²»á×Ô¶¯Ä¬ÈÏΪCstr¡£
string º¯Êý string£¨2£¬sport£©µÄ·µ»ØÖµÊÇ“ss”
Instr£¨£©£ºInstr£¨3£¬“studystudy”£¬“tu”£©
¹ØÓÚCstrºÍstr£ºÁ½ÖÖ×î´óµÄÇø±ðÔÚÓÚ£º
CstrÔÚ½«ÕýÊýת»»ÎªÊý×Ö×Ö·û´®Ê±£¬²»ÔÚÆäÇ°¼ÓÇ°µ¼¿Õ¸ñÀ´°µÊ¾ÆäÕýºÅ£»
¶øStrÔÚ½«ÕýÊýת»»ÎªÊý×Ö×Ö·û´®Ê±,·µ»ØµÄ×Ö·û´®°üº¬Ò»Ç°µ¼¿Õ¸ñ°µÊ¾ÓÐÒ»ÕýºÅ¡£
¾ÙÀýÈçÏ£º
Dim i As Single
Dim cstr1 As String
Dim str1 As String
i = 10.3
cstr1 = CStr(i)
str1 = Str(i)
......
VC++
ÓëVB
Êý¾ÝÀàÐͶÔÓ¦¹Øϵ
ÔÚ×öVCÓëvb³ÌÐò¼ä»¥Ïàµ÷Óã¬ÐèҪעÒâÁ½ÖÖÓïÑÔ²»Í¬±àÒëÆ÷¶ÔÊý¾ÝÀàÐ͵Ķ¨ÒåÇø±ð£¬´ËʱÁ½ÕßÊý¾ÝÀàÐ͵ĶÔÓ¦¹Øϵ¾ÍÏÔµÃÊ®·ÖµÄÖØÒª£¬¶ÔÓ¦¹ØϵÒÔ¼°ÉùÃ÷·½Ê½ÈçÏÂËùʾ¡£
VC++
VB
short
Integer
int
Long
long
Long
UNIT
Long
ULONG
Long
WORD
DWORDLong
WPARAM
LPARAMLong
WMSG
UMSGLong
HRESULT
Long
BOOL
Boolean
COLORREF
Long
HWND,HDC,HBRUSH,HKEY,
µÈ µÈ
Long
LPSTR
LPCSTRString
LPWSTR,OLECHARBSTR
String
LPTSTR
String
VARIANT_BOOL
Boolean
unsignedchar
Byte
BYTE
Byte
VARIANTVariant
(
ÈκΠÒÔ*
»ò**
½áβµÄÊý¾ÝÀàÐÍ)
Long
c
ÖеÄÊý¾ÝÀàÐÍ
VB
ÖеÄÉùÃ÷
½á¹û
ATOM
ByVal variable As Integer
½á¹ûΪInteger
ÀàÐ͵ıí´ïʽ
BOOL
ByVal variable As Boolean
½á¹ûΪ Long
ÀàÐ͵ıí´ïʽ
BYTE
ByVal variable As Byte
½á¹ûΪ Byte
ÀàÐ͵ıí´ïʽ
CHAR
ByVal variable As Byte
½á ......
VC++
ÓëVB
Êý¾ÝÀàÐͶÔÓ¦¹Øϵ
ÔÚ×öVCÓëvb³ÌÐò¼ä»¥Ïàµ÷Óã¬ÐèҪעÒâÁ½ÖÖÓïÑÔ²»Í¬±àÒëÆ÷¶ÔÊý¾ÝÀàÐ͵Ķ¨ÒåÇø±ð£¬´ËʱÁ½ÕßÊý¾ÝÀàÐ͵ĶÔÓ¦¹Øϵ¾ÍÏÔµÃÊ®·ÖµÄÖØÒª£¬¶ÔÓ¦¹ØϵÒÔ¼°ÉùÃ÷·½Ê½ÈçÏÂËùʾ¡£
VC++
VB
short
Integer
int
Long
long
Long
UNIT
Long
ULONG
Long
WORD
DWORDLong
WPARAM
LPARAMLong
WMSG
UMSGLong
HRESULT
Long
BOOL
Boolean
COLORREF
Long
HWND,HDC,HBRUSH,HKEY,
µÈ µÈ
Long
LPSTR
LPCSTRString
LPWSTR,OLECHARBSTR
String
LPTSTR
String
VARIANT_BOOL
Boolean
unsignedchar
Byte
BYTE
Byte
VARIANTVariant
(
ÈκΠÒÔ*
»ò**
½áβµÄÊý¾ÝÀàÐÍ)
Long
c
ÖеÄÊý¾ÝÀàÐÍ
VB
ÖеÄÉùÃ÷
½á¹û
ATOM
ByVal variable As Integer
½á¹ûΪInteger
ÀàÐ͵ıí´ïʽ
BOOL
ByVal variable As Boolean
½á¹ûΪ Long
ÀàÐ͵ıí´ïʽ
BYTE
ByVal variable As Byte
½á¹ûΪ Byte
ÀàÐ͵ıí´ïʽ
CHAR
ByVal variable As Byte
½á ......
Format[$] ( expr [ , fmt ] )
format ·µ»Ø±äÌåÐÍ
format$ Ç¿ÖÆ·µ»ØΪÎı¾
--------------------------------
Êý×ÖÀàÐ͵ĸñʽ»¯
--------------------------------
¹Ì¶¨¸ñʽ²ÎÊý£º
General Number ÆÕͨÊý×Ö£¬Èç¿ÉÒÔÓÃÀ´È¥µôǧλ·Ö¸ôºÅ
format$("100,123.12","General Number") ·µ»ØÖµ 100123.12
Currency »õ±ÒÀàÐÍ£¬¿ÉÌí¼Óǧλ·Ö¸ôºÅºÍ»õ±Ò·ûºÅ
format$("100123.12","Currency") ·µ»ØÖµ £¤100,123.12
Fixed ¸ñʽΪ´øÁ½Î»Ð¡ÊýµÄÊý×Ö
format$("100123","Fixed") ·µ»ØÖµ 100123.00
Standard ±ê×¼£¬¼´´øǧλ·Ö¸ôºÅºÍÁ½Î»Ð¡Êý
format$("100123","Standard") ·µ»ØÖµ 100,123.00
Percent °Ù·ÖÊý
format$("100123","Percent") ·µ»ØÖµ 10012300.0 ......
VBÎÞËù²»ÄÜÖ®ËÄ£ºÖÆ×÷͸Ã÷ºÍ°ë͸Ã÷´°Ìå
——×÷ÕߣºÖÓÉù
ÎÒÃǾ³£¿ÉÒÔ¿´µ½ÕâÑùµÄ´°Ì壬¾õµÃºÜìÅ£¬ÈçͼËùʾ£º
ͬÑù£¬¶ÔWindowsϵͳ·½ÃæµÄ±à³ÌËƺõÊ×ÏÈÏëµ½µÄ¾ø¶Ô²»ÊÇVB£¬¶ø´ó²¿·Ö³ÌÐòÔ±Ïëµ½µÄÒ»¶¨ÊÇVC¡£
Æäʵ£¬VB¶ÔÓÚÕâ¸öʵÏַdz£·½±ãÇÒ¼òµ¥£¬Óõ½ÁË“user32”ÖеÄSetLayeredWindowAttributes()º¯Êý¡£
SetLayeredWindowAttributes()º¯Êý½éÉÜ£º
º¯ÊýÉùÃ÷£º
Declare Function SetLayeredWindowAttributes Lib "user32" () Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
hwndÊÇ͸Ã÷´°ÌåµÄ¾ä±ú£¬
crKeyΪÑÕÉ«Öµ£¬
bAlphaÊÇ͸Ã÷¶È£¬È¡Öµ·¶Î§ÊÇ[0,255]£¬
dwFlagsÊÇ͸Ã÷·½Ê½£¬¿ÉÒÔÈ¡Á½¸öÖµ£ºµ±È¡ÖµÎªLWA_ALPHAʱ£¬crKey²ÎÊýÎÞЧ£¬bAlpha²ÎÊýÓÐЧ£»
µ±È¡ÖµÎªLWA_COLORKEYʱ£¬bAlpha²ÎÊýÓÐЧ¶ø´°ÌåÖеÄËùÓÐÑÕɫΪcrKeyµÄµØ·½½«±äΪ͸Ã÷¡£
ÏÂÃæÎÒÃÇ×öÁ½¸öʵÑ飺
......
rndº¯Êý·µ»Ø»òÕß˵²úÉúÒ»¸öСÓÚ1µ«´óÓÚ»òµÈÓÚ0µÄsingleÀàÐ͵ÄËæ»úÊý¡£
²úÉúËæ»úÊý֮ǰÐèÒªÒ»¸öÖÖ×Ó¡£
·²»Í¬µÄÖÖ×Ó£¬¿ÉʹËæ»úÊýÉú³ÉÆ÷Éú³É²»Í¬µÄËæ»úÊý£»
·ÔÚÒ»¸öÖÖ×ÓÏ£¬Éú³ÉµÄËæ»úÊýÏàͬ¡£
Ëæ»úÊýÉú³ÉÆ÷µÄÓï¾äΪrandomize¡£¸ñʽΪ£ºrandomize[x]¡£
·µ±x>0ʱ£¬Ê¹ÓÃÇ°Ò»´Îµ÷ÓÃrndº¯Êý²úÉúµÄËæ»úÊý×÷Ϊ±¾´Î²úÉúËæ»úÊýµÄÖÖ×Ó¡£Ò»°ãͨ¹ýʹÓøòÎÊý»ñµÃ²»Í¬µÄËæ»úÊýÐòÁС£
·µ±x<0ʱ£¬Ê¹ÓÃx×÷ΪËæ»úÊýÖÖ×Ó£¬ÓÃÓÚ²úÉúÏàͬµÄËæ»úÊýÐòÁС£
·µ±x=0ʱ£¬·µ»Ø×î½üÒ»´Îµ÷ÓÃrndº¯ÊýÉú³ÉµÄËæ»úÊý¡£
·µ±xÊ¡ÂÔʱ£¬µ÷ÓÃrndº¯Êý֮ǰ£¬Èç¹ûûÓÐÖ´ÐÐrandomizeÓï¾ä£¬ÔòÓëx>0µÄÇé¿öÏàͬ¡£·´Ö®£¬Èç¹ûÖ´ÐÐÁËrandomizeÓï¾ä£¬Ôòrndº¯ÊýʹÓÃrandomizeÓï¾äÌṩµÄÐÂÖÖ×ÓÖµ£¬·µ»ØËæ»úÊý¡£
rndº¯Êý²úÉúµÄÊÇ[0£¬1£©Çø¼äÄÚµÄsingleÀàÐÍÊý¾Ý¡£
*&&*Èç¹ûÒªÉú³ÉÆäËûÇø¼äµÄËæ»úÊý»òÕßÓ¢ÎÄ×Öĸ£¬ÔòҪͨ¹ý±í´ïʽÀ´ÊµÏÖ£º
·Éú³É[0£¬x£©Çø¼äµÄËæ»úÊýsingleÀàÐÍÊý¾Ý£¬Ê¹Óñí´ïʽrnd*x
·Éú³É[m£¬n£©Çø¼äµÄËæ»úÊýsingleÀàÐÍÊý¾Ý£¬Ê¹Óñí´ïʽm+rnd*£¨n-m£©
·Éú³É[m£¬n]Çø¼äµÄËæ»úÕûÊý£¬Ê¹Óñí´ïʽint£¨m+rnd*£¨n-m+1£©£©»òÕß ......
×î½üÔÚѧϰwindows APIµÄʱºò·¢ÏÖÔÚ¸ö½Ð¾ä±úµÄ¸ÅÄî¸ã²»Çå³þ£¬ÓÚÊDzéÁËÒ»ÏÂÏÖÔÚ°Ñ×Ô¼ºµÄÀí½âд³öÀ´£¬ºóÃæÔÙÌùÍøÉϵĽéÉÜ¡£¾ä±úÊÇÒ»¸ö´ú±í´°¿ÚµÄÕýÕûÊý£¬µ±È»´°¿ÚµÄ¸ÅÄîÔÚÕâÀï°üº¬ÁË×ÀÃæ¡¢°´Å¥¡¢¹ö¶¯ÌõµÈ£¬Õâ¾ÍÊÇÎÒ×î¼òµ¥µÄÀí½âÁË¡£
ÒÔÏÂÊÇÍøÉϵĽéÉÜ£º
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Á˽â¾ä±ú
ÔÚµ÷Óà DLL º¯ÊýÇ°±ØÐëÀí½âµÄÁíÍâÒ»¸öÖØÒª¸ÅÄîÊǾä±ú¡£¾ä±úÊÇÒ»¸ö 32 λµÄÕýÕûÊý£¬Microsoft® Windows® ÓÃËüÀ´Ê¶±ð´°Ìå»òÆäËû¶ÔÏó£¬ÀýÈç×ÖÌå»òλͼ¡£
ÔÚ Windows ÖУ¬´°¿Ú¿ÉÒÔÓÐÐí¶àÖÖ¡£´°¿Ú¿ÉÒÔÊÇÆÁÄ»ÉϵÄÒ»¿é¾ØÐηâ±ÕÇøÓò£¬±ÈÈçÄúÊìϤµÄÓ¦ÓóÌÐò´°¿Ú¡£´°ÌåÉϵĿؼþ£¨ÀýÈçÁбí¿ò»ò¹ö¶¯Ìõ£©Ò²¿ÉÒÔÊÇ´°¿Ú£¬µ«²¢²»ÊÇËùÓÐÀàÐ͵Ŀؼþ¶¼ÊÇ´°¿Ú¡£×ÀÃæÉϵÄͼ±êºÍ×ÀÃæ±¾ÉíÒ²ÊÇ´°¿Ú¡£
ÒòΪËùÓÐÕâЩÀàÐ͵ĶÔÏó¶¼ÊÇ´°¿Ú£¬ËùÒÔ Windows ¿ÉÒÔÓÃÀàËƵķ½Ê½´¦ÀíËüÃÇ¡£Windows ¸øÿ¸ö´°¿ÚÒ»¸öΨһµÄ¾ä±ú£¬Í¨¹ý¾ä±ú²Ù×ݸô°¿Ú¡£Ðí¶à API º¯Êý¿É·µ»Ø¾ä±ú»òÕß½ÓÊܾä±ú×÷²ÎÊý¡£
´´½¨´°¿Úʱ£¬Windows ¸øËüÖ¸ÅÉÒ»¸ö¾ä±ú£¬´°¿ÚÏûʧºó¾ä±ú±»ÊÍ·Å¡£ËäÈ»¾ä±úÔÚ´°¿ÚµÄÕû¸öÉú´æÆÚÄÚ±£³Ö²»±ä£¬µ«²»Äܱ£Ö¤Ä³´°¿ÚÔÚ±»Ë𻵲¢ÖØд´½¨ºó»¹Ê¹ÓÃÔÀ´µÄ¾ä±ú¡£ËùÒÔ£¬Èç¹ûÔÚ±äÁ¿Öд洢Á ......