½Ó×ÅÍâ¹Ò½Ì³Ì VB ´ÓÁ㿪ʼ±àÍâ¹Ò
ÐèÒªVBAPIº¯Êý£º
FindWindow←Ñ°ÕÒ´°¿ÚÁбíÖеÚÒ»¸ö·ûºÏÖ¸¶¨Ìõ¼þµÄ¶¥¼¶´°¿Ú
GetWindowThreadProcessId←»ñÈ¡ÓëÖ¸¶¨´°¿Ú¹ØÁªÔÚÒ»ÆðµÄÒ»¸ö½ø³ÌºÍÏ̱߳êʶ·û
--------------------------------------------------------------------------------------------------------------------------------------------------------
Ïà¹ØAPIÉùÃ÷£º
FindWindow
↓
PrivateDeclareFunctionFindWindowLib"user32"Alias"FindWindowA"(ByVallpClassNameAsString,ByVallpWindowNameAsString)AsLong
GetWindowThreadProcessId
↓
PrivateDeclareFunctionGetWindowThreadProcessIdLib"user32"(ByValhwndAsLong,lpdwProcessIdAsLong)
AsLong
--------------------------------------------------------------------------------------------------------------------------------------------------------
ÐèÒªµÄ¿Ø¼þ£ºLabel¡¢Timer
--------------------------------------------------------------------------------------------------------------------------------------------------------×Ô¶¨Ò庯Êý£º
DimhwndAsLong
-- ......
×Ô¼ºÕûÁË4¸öÄ¿±êÓÃÓÚɨÃè¡£ÒÔºó¿ÉÄÜ¿ÉÒÔ×Ô¼ºÌí¼Óɾ³ý£¨Ð´µ½Õâ¶ùºöÈ»¾õµÃC++µÄvector²»ÄÜɾ³ýÔªËØ£¨·´ÕýC++ PrimerÀïĿǰûÕÒµ½£©ÈÃÈ˺ÜÓôÃÆ£©
Form1£¬Ðë¼ÓÒ»¸öTimer1
Dim CAngle As Integer 'Current Angle (Not Class Angle)
Private Sub Form_Load() '³õʼ»¯
CAngle = 0
Me.BackColor = vbBlack
Me.BorderStyle = 3
Me.FillColor = vbYellow
Me.ForeColor = vbGreen
Me.FillStyle = 1
Me.ScaleMode = 3 'Pixel
Me.Width = 4590
Me.Height = 4980
Timer1.Interval = 10
End Sub
Private Sub Timer1_Timer()
Cls
Circle (150, 150), 130
If CAngle = 359 Then CAngle = 0 Else CAngle = CAngle + 1
Raida CAngle '»æÖÆÀ×´ï
RaidaTarget 0.5, 20 '¶¨ÒåÀ×´ïÄ¿±ê1
RaidaTarget 0.7, 200 '¶¨ÒåÀ×´ïÄ¿±ê2
RaidaTarget 0.2, 100 '¶¨ÒåÀ×´ïÄ¿±ê3
RaidaTarget 0.9, 257 '¶¨ÒåÀ×´ïÄ¿±ê4
End Sub
Private Sub Raida(ByVal angle As Integer) '¸ù¾ÝËù¸ø½Ç¶È»æÖÆÀ×´ï
Dim x As Single, y As Single, a As Single, _ ......
Õ⼸ÌìÔÚÉè¼ÆÔĶÁÆäÖÐÓõ½Á˺ܶàºÃµÄ¼¼Êõ,,ÈÃÎÒÃÇÔÚÉè¼ÆÈí¼þµÄʱºò·½±ã,,¿ì½Ý,,ÃÀ¹Û.Ò²ÊÇÎÒÃǾ³£Óõ½µÄһЩ¿Ø¼þ.
ËùÒÔÔÚÕâÀïÎÒ»á½Ðø°ÑËû·ÖÏí³öÀ´.
ÕâÀïÊÇÔÚ´°ÌåÖиı䴰ÌåµÄ´óС.´°ÌåÄÚ²¿ËùÒԿؼþµÄ´óСͬ±ÈÀýµÄ¸Ä±äµÄÒ»¸ö³ÌÐò
ÕâЩÊÇÔÚ±ê׼ģ¿éÖÐ
'¶¨Òå FormOldWidth, FormOldHeight Ϊȫ¾Ö±äÁ¿£¬ÕâÑùÆäËûÄ£¿é²ÅÄܵ÷ÓÃËü
Global FormOldWidth, FormOldHeight
'ÔÚµ÷ÓÃResizeFormÇ°Ïȵ÷Óñ¾º¯Êý
Public Sub ResizeInit(FormName As Form)
'ControlÊÇÒ»¸ö¶ÔÏ󣬱íʾËùÓÐ Visual Basic ÄÚ²¿¿Ø¼þµÄÀàÃû¡£
'¿ÉÒÔ½«Ò»¸ö±äÁ¿±êΪ Control ¶ÔÏó£¬ÏóÒý°Ñ¿Ø¼þ·Åµ½´°ÌåÉϵÄÒ»ÑùÀ´ÒýÓÃËü¡£ÀýÈ磺
'Dim C As Control
'Set C = Command1
Dim Obj As Control
FormOldWidth = FormName.ScaleWidth
FormOldHeight = FormName.ScaleHeight
On Error Resume Next
'EachÊÇÒ»¸ö¹Ø¼ü×Ö£¬×÷ÓÃÊÇÕë¶ÔÒ»¸öÊý×é»ò¼¯ºÏÖеÄÿ¸öÔªËØ£¬Öظ´Ö´ÐÐÒ»×éÓï¾ä¡£
'Óï·¨
'For Each element In Group
For Each Obj In FormName
'Tag·µ»Ø»òÉèÖÃÒ»¸ö±í´ïʽÓÃÀ´´æ´¢³ÌÐòÖÐÐèÒªµÄ¶îÍâÊý¾Ý¡£
Obj.Tag = Obj.Left & " " & Obj.Top & " " & Obj.Width & " " & Obj.Height ......
ÕâÀïÊÇ ÀûÓÃreplace º¯Êý ÔÚvbÖÐʵÏÖ Ïû³ý¿ÕÐеÄÒ»¸ö³ÌÐò
ÕâÀïµÄÈÝÆ÷ÊÇrichtext
¿ÉÒÔÀ©³äµ½ÆäËûÈÝÆ÷ ºÍÆäËû×Ö·û ÓÃÓÚ±àд²éÕÒÌæ»»¹¦ÄÜ
'--------------------------------------------------------------------------------------------
' Ïû³ý¿ÕÐÐ , ÀûÓÃinstrº¯Êý, ËÑË÷Îı¾ÀïµÄvbcrlf(»Ø³µ + »»ÐÐ), Á½¸ö»Ø³µÌæ»»³ÉÒ»¸ö»Ø³µ¼Ó»»ÐÐ
'--------------------------------------------------------------------------------------------
Do While InStr(1, rtffile.Text, vbCrLf & vbCrLf)
rtffile = Replace(rtffile.Text, vbCrLf & vbCrLf, vbCrLf)
Loop
......
1¡¢ÏÈ°ÑVB±àÒëºÃµÄDLLÎļþ·Åµ½ÏµÍ³µÄSYSTEM32Îļþ¼ÐÏÂ
2¡¢ÓÃregsvr32×¢²áÕâ¸öDLLÎļþ
3¡¢Pbϵ÷ÓÃ
oleobject ole_1
ole_1=create oleobject
long ll_ret
ll_ret=ole_1.connecttonewobject( 'add.addstring ')//ÆäÖÐaddΪVBµÄ¹¤³ÌÃû£¬addstringΪVBµÄÀàÄ£¿éÃû
string ls_message,ls_first,ls_second
ls_first= "ÄãºÃ "
ls_second= ",ÎÒÊÇÐêÐêÍÃ! "
ls_message=ole_1.add(ls_first,ls_second) //Õâ¸öaddΪvbÖÐÉùÃ÷µÄº¯Êý
messagebox( ' ',ls_message) ......
VB´´½¨ACCESSÊý¾Ý¿âÈ«½â ¶¯Ì¬´´½¨Êý¾Ý¿â¡¢´´½¨±í£¬´´½¨¼Ç¼ ADO¡¢ADOX2009Äê04ÔÂ20ÈÕ ÐÇÆÚÒ» 10:17ÕªÒª£º ±¾ÎIJûÊöÁËÔÚVB³ÌÐòÖÐÀûÓÃADO¶ÔÏó¶¯Ì¬´´½¨Êý¾Ý¿âºÍÊý¾Ý±íµÄ·½·¨£¬ÕâЩ·½·¨ÔÚ¿ª·¢VBÊý¾Ý¿âÓ¦ÓóÌÐòÖкÜÓÐʵÓüÛÖµ£¬Ëü¿ÉÒÔÌá¸ßÊý¾Ý¿â³ÌÐòÁé»îÐÔ¡£
¡¡¡¡¹Ø¼ü´Ê£ºÊý¾Ý¿â¡¢Êý¾Ý±í¡¢ADO¡¢ADOX
¡¡¡¡1: ÎÊÌâµÄÌá³ö
¡¡¡¡ÔÚVisual BasicÖУ¬³£ÓõÄÊý¾Ý·ÃÎʽӿÚÓÐÏÂÁÐÈýÖÖ£ºÊý¾Ý¿â·ÃÎʶÔÏó(DAO£¬Data Access Object)¡¢Ô¶³ÌÊý¾Ý¿â¶ÔÏó(RDO£¬Remote Data Object)ºÍActiveXÊý¾Ý¶ÔÏó(ADO£¬ActiveX Data Object )¡£Êý¾Ý¿â·ÃÎʼ¼ÊõÒ»Ö±ÔÚ²»¶Ï½ø²½£¬¶øÕâÈýÖÖ½Ó¿ÚµÄÿһÖÖ¶¼·Ö±ð´ú±íÁ˸ü¼ÊõµÄ²»Í¬·¢Õ¹½×¶Î¡£×îеÄÊÇADO£¬ËüÊDZÈRDOºÍDAO¸ü¼Ó¼òµ¥£¬È»¶ø¸ü¼ÓÁé»îµÄ¶ÔÏóÄ£ÐÍ¡£ÕýÒòÈç´Ë£¬Ô½À´Ô½¶àµÄÈËÔÚÓÃVB¿ª·¢Êý¾Ý¿âÈí¼þʱʹÓÃADO×÷ΪÊý¾Ý·ÃÎʽӿڡ£ÔÚ¿ª·¢¹ý³ÌÖУ¬ÎÒÃÇͨ³£µÄʹÓõķ½·¨ÊÇ£ºÏÈʹÓÃÊý¾Ý¿â¹ÜÀíϵͳ(ÀýÈ磺Microsoft Access)»òVBÖеĿÉÊÓ»¯Êý¾Ý¹ÜÀíÆ÷½¨Á¢ºÃÊý¾Ý¿âºÍÊý¾Ý±í½á¹¹£¬È»ºóÔÚ³ÌÐòÖÐͨ¹ýʹÓÃADODCÊý¾Ý¿â¿Ø¼þ»òÒýÓÃADO¶ÔÏóÓëÊý¾Ý¿âÖÐµÄ±í½¨Á¢Á¬½Ó£¬ÔÙͨ¹ýÊý¾Ý¿â¸ÐÖª¿Ø¼þ(ÀýÈ磺Îı¾¿ò¡¢DataGridµÈ)À´½øÐÐÊý¾Ý¿âµÄ¸÷ÖÖ²Ù×÷¡£ÔÚÕâÖÖ¿ª·¢¹ý³ÌÖУ¬ÎÒÃÇÓÐʱÐèÒªÃæ¶ÔÕâÑùÒ ......
VB´´½¨ACCESSÊý¾Ý¿âÈ«½â ¶¯Ì¬´´½¨Êý¾Ý¿â¡¢´´½¨±í£¬´´½¨¼Ç¼ ADO¡¢ADOX2009Äê04ÔÂ20ÈÕ ÐÇÆÚÒ» 10:17ÕªÒª£º ±¾ÎIJûÊöÁËÔÚVB³ÌÐòÖÐÀûÓÃADO¶ÔÏó¶¯Ì¬´´½¨Êý¾Ý¿âºÍÊý¾Ý±íµÄ·½·¨£¬ÕâЩ·½·¨ÔÚ¿ª·¢VBÊý¾Ý¿âÓ¦ÓóÌÐòÖкÜÓÐʵÓüÛÖµ£¬Ëü¿ÉÒÔÌá¸ßÊý¾Ý¿â³ÌÐòÁé»îÐÔ¡£
¡¡¡¡¹Ø¼ü´Ê£ºÊý¾Ý¿â¡¢Êý¾Ý±í¡¢ADO¡¢ADOX
¡¡¡¡1: ÎÊÌâµÄÌá³ö
¡¡¡¡ÔÚVisual BasicÖУ¬³£ÓõÄÊý¾Ý·ÃÎʽӿÚÓÐÏÂÁÐÈýÖÖ£ºÊý¾Ý¿â·ÃÎʶÔÏó(DAO£¬Data Access Object)¡¢Ô¶³ÌÊý¾Ý¿â¶ÔÏó(RDO£¬Remote Data Object)ºÍActiveXÊý¾Ý¶ÔÏó(ADO£¬ActiveX Data Object )¡£Êý¾Ý¿â·ÃÎʼ¼ÊõÒ»Ö±ÔÚ²»¶Ï½ø²½£¬¶øÕâÈýÖÖ½Ó¿ÚµÄÿһÖÖ¶¼·Ö±ð´ú±íÁ˸ü¼ÊõµÄ²»Í¬·¢Õ¹½×¶Î¡£×îеÄÊÇADO£¬ËüÊDZÈRDOºÍDAO¸ü¼Ó¼òµ¥£¬È»¶ø¸ü¼ÓÁé»îµÄ¶ÔÏóÄ£ÐÍ¡£ÕýÒòÈç´Ë£¬Ô½À´Ô½¶àµÄÈËÔÚÓÃVB¿ª·¢Êý¾Ý¿âÈí¼þʱʹÓÃADO×÷ΪÊý¾Ý·ÃÎʽӿڡ£ÔÚ¿ª·¢¹ý³ÌÖУ¬ÎÒÃÇͨ³£µÄʹÓõķ½·¨ÊÇ£ºÏÈʹÓÃÊý¾Ý¿â¹ÜÀíϵͳ(ÀýÈ磺Microsoft Access)»òVBÖеĿÉÊÓ»¯Êý¾Ý¹ÜÀíÆ÷½¨Á¢ºÃÊý¾Ý¿âºÍÊý¾Ý±í½á¹¹£¬È»ºóÔÚ³ÌÐòÖÐͨ¹ýʹÓÃADODCÊý¾Ý¿â¿Ø¼þ»òÒýÓÃADO¶ÔÏóÓëÊý¾Ý¿âÖÐµÄ±í½¨Á¢Á¬½Ó£¬ÔÙͨ¹ýÊý¾Ý¿â¸ÐÖª¿Ø¼þ(ÀýÈ磺Îı¾¿ò¡¢DataGridµÈ)À´½øÐÐÊý¾Ý¿âµÄ¸÷ÖÖ²Ù×÷¡£ÔÚÕâÖÖ¿ª·¢¹ý³ÌÖУ¬ÎÒÃÇÓÐʱÐèÒªÃæ¶ÔÕâÑùÒ ......