»ñµÃ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().
Ïà¹ØÎĵµ£º
VB Treeview¿Ø¼þÏêϸʹÓ÷½·¨
1¡¢ÊôÐÔ
ÕâÀïÖ»¸ø´ó¼Ò½éÉÜTreeview¿ ......
´ÓÍøÉÏËѼ¯µ½µÄVB´úÂ룬ÓÃEXE·½Ê½ÊµÏÖÁËÔ¶³Ì×¢È룬²»¹ýÔÚ·´²¡¶¾Èí¼þµÄ±£»¤Ï£¬ÓпÉÄܵ¼ÖÂ×¢Èëʧ°Ü¡£×ªÌùÕâ¸ö´úÂ룬½ö¹©´ó¼ÒѧϰºÍ²Î¿¼¡£
Ò»¡¢´°¿Ú´úÂ룺
Option Explicit
Private Sub cmdLock_Click()
If LockKeyboard(True) Then
cmdLock.Enabled = False
cmdUnLock.Enabled = Tr ......
ºÜ¶àÄêÇ°¾ÍÏë×öÒ»¸öÔ¶³Ì¿ØÖƵÄÈí¼þ£¬Ö»ÊÇÒ»Ö±ÒÔÀ´Í¼Æ¬µÄѹËõËÙ¶È×ÜÊÇÌáÉý²»ÉÏÈ¥£¬¶øÎÒÒ²²Î¿¼¹ýºÜ¶àÍøÉϵĹØÓÚͼƬѹËõµÄÀý×Ó£¬±ÈÈçzyl910µÄGIF_LZWѹËõ·½·¨£¬HuffmanѹËõ·½·¨£¬ÒÔÖÁµ½GDI+µÄÖ±½ÓÉú³ÉJPG¡¢PNGµÄ·½·¨£¨ÕâÖÖ·½·¨ÎÞÂÛ´ÓѹËõÂʺÍËÙ¶ÈÉ϶¼ÊÇ×î¼ÑµÄ£¬¿ÉϧÕâÖÖ·½·¨ÍøÉÏһֱûÕÒµ½Ö±½Ó±£´æΪByte()µÄÀý×Ó£¬¼ûµÃ×î¶àµÄ ......
ÔÚ¿ª·¢IP-MACɨÃè¼àÊÓÆ÷ʱ£¬ÉèÖÃÁË¿ª»ú×Ô¶¯ÔËÐУ¬µ«Êǵ±WINDOWSÆô¶¯ºó£¬³ÌÐòÔËÐкóÈ´´ò¿ª´°ÌåÁË£¬²»ÊÇ×îС»¯ÔËÐеġ£ÕâÔõô°ìÄØ£¿ÓÚÊÇÏëµ½¼ÓÒ»¸ö²ÎÊý¸ø³ÌÐòÆô¶¯Ê±£¬µ«²»ÖªµÀÔõôʵÏÖ£¬½á¹û·¢ÏÖVBÖÐÓÐcommand£¬ÊÇ¿ÉÒÔ½ÓÊܲÎÊýµÄ¡£Ö±½Ó£ºAAA.EXE xxx,
ÔÚ³ÌÐòÖÐÓÃÒ»¸ö±äÁ¿µÃµ½Õâ¸ö²ÎÊý£¬ÄǾͿÉÒÔÁË¡£×ö·¨£º
1¡¢ÔÚ×¢²á±í×ÔÆô¶ ......