»ñµÃ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 to the following syntax:
Private Declare Function SendMessage Lib "user32" _
Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg _
As Long, ByVal wParam As Long, lParam As Any) As Long
Since
we want to gather the listbox: selected items, we'll send the
LB_GETSELITEMS constant in the wMsg argument, which you declare like so:
Private Const LB_GETSELITEMS = &H191
The LB_GETSELITEMS message fills an array with the index numbers of all the selected items.
Dim ItemIndexes() As Long, x As Integer, iNumItems As Integer
iNumItems = ThisBox.SelCount
If iNumItems Then
ReDim ItemIndexes(iNumItems - 1)
SendMessage ListBox1.hwnd, LB_GETSELITEMS, iNumItems, ItemIndexes(0)
End If
For x = 0 To iNumItems - 1
MsgBox ListBox1.List(ItemIndexes(x)) 'µ¯³ö¶Ô»°¿ò
Next x
After
being passed to the SendMessage function, iNumItems holds the total
number of selected items, and the ItemIndexes array holds the selected
item index values. Notice, that you must pass a pointer to the
ItemIndexes array, and not the array itself. Thus, we passed
ItemIndexes(0) into the SendMessage function, not ItemIndexes().
Ïà¹ØÎĵµ£º
Ò» ľÂíµÄÓÉÀ´
ľÂí£¬¼´“ÌØÂåÒÁľÂ픣¨trojan horse£©¡£
¶þ ËùÐèÒªµÄ¼¼Êõ
Ò»¸ö³É¹¦µÄľÂí£¬³ýÁËÖÆ×÷³öÏà¹ØµÄ³ÌÐòÒÔÍ⣬»¹ÐèҪʵÏÖÒÔϼ¸·½ÃæµÄ¹¦ÄÜ¡£1£¬Ä¾ÂíµÄÒþ²Ø 2£¬Ä¾ÂíµÄÔËÐÐ 3£¬Ä¾ÂíµÄ¸´ÖÆ 4£¬Ä¾ÂíµÄ´«²¥µÈ ......
VB Treeview¿Ø¼þÏêϸʹÓ÷½·¨
1¡¢ÊôÐÔ
ÕâÀïÖ»¸ø´ó¼Ò½éÉÜTreeview¿ ......
VB¸ù¾Ý´°¿Ú±êÌâ»ñÈ¡Ó¦ÓóÌÐòÍêÕû·¾¶(À´×ÔÍøÂç)
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId A ......
Private Sub Cmd_OK_Click()
Dim ExcelAppX As Excel.Application
Dim ExcelBookX As Excel.Workbook
Dim ExcelSheetX As Excel.Worksheet
Dim a(1 To 3) As Single
Dim strFormat As Variant
......
ʹÓÃVB°ÑExcelµ¼Èëµ½SqlÊý¾Ý¿âÖУ¬ÆäʵÓм¸ÖÖ·½·¨¡£
ÏÂÃæÎÒ½éÉܵÄÕâÖÖ·½·¨£¬½ÏΪ¼òµ¥¡£
ÆäʵÕâÖÖ·½·¨µÄ»°£¬ÊÇÖ±½ÓʹÓÃT-SQL²Ù×÷µÄ£¬Òò´Ë£¬µ½ÁËVBÀïÃ棬ֱ½ÓeccuteÕâ¸ö´úÂë¾ÍOKÁ˵ġ£
-----------------------------------------------------ÏÂÃæÊÇÔÚT-sqlÖеÄÓï¾ä
if object_id('NewTable') is not null/*ÅжϱíNewTabl ......