[AccessD] A2k3 Object Browser

DWUTKA at marlow.com DWUTKA at marlow.com
Sat Nov 5 14:46:10 CST 2005


You can grab the contents of a listbox with API calls.  I wrote a VB project
to do this a few years ago.  Had a spam filter that displayed the current
list of 'filters' in a listbox, and I needed to switch to a text file
instead. However, there was no export function.  So I used the following
code to 'grab' the items in the listbox.

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
private Declare Function GetTextSendMessage Lib "user32" Alias
"SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As
Long, lParam As String) As Long
private Const LB_GETCOUNT = &H18B
private Const LB_GETTEXT = &H189
private Const LB_GETTEXTLEN = &H18A
private Const CB_GETLBTEXT = &H148
private Const CB_GETLBTEXTLEN = &H149
Private Sub Command1_Click()
Dim i As Long
Dim dwReturn As Long
Dim strTemp As String
ListBoxCount = 0
'inthWnd = 1377856
'inthWnd = 655826
inthWnd = Me.txthWnd
Me.lstReturnedData.Clear
dwReturn = SendMessage(inthWnd, LB_GETCOUNT, 0, 0)
'MsgBox dwReturn
'Exit Sub
ListBoxCount = dwReturn
For i = 0 To ListBoxCount - 1
    dwReturn = SendMessage(inthWnd, LB_GETTEXTLEN, i, 0)
    'strTemp = Space(255) 'Space(dwReturn + 1)
    strTemp = String(dwReturn, 0)
    dwReturn = SendMessage(inthWnd, LB_GETTEXT, i, ByVal strTemp$)
    Me.lstReturnedData.AddItem strTemp
Next i
End Sub

To make this work, you need the hWnd value of the listbox.  I have a little
VB .exe I wrote that displays the window information (including the hWnd
value) of whatever window the mouse is over.  This worked perfect for what I
needed it for. However, I already tried to use this on the Object browser.
It will pull the lists from the drop down menus, but not from the items
lists.  I think that is because they are custom drawn.  It does 'detect' the
right number of items... (ie, the LB_GETCOUNT) returns the right number of
items in the list, however, it retrieves a length of 4 every time.  With a
cursory look at the MSDN for LB_GETTEXT, it looks like if it is drawn a
certain way, the text returned is a 32 bit pointer, and not the actual text.
Hopefully this gives you something to go on.

Drew
	-----Original Message-----
	From:	John Bartow [SMTP:john at winhaven.net]
	Sent:	Saturday, November 05, 2005 2:16 PM
	To:	'Access Developers discussion and problem solving'
	Subject:	Re: [AccessD] A2k3 Object Browser

	Marty,
	Tried that. Don't get much at all.

	Is it possible to interate through the an Active-X object model and
pull out
	all of its events, properties and methods, constants, etc. into a
report or
	a text file? My gut feeling is yes since the Object Browser display
all of
	it. But I would need to do this in VBA.

	I have code to do this for Access container objects but I never
attempted it
	with ActiveX objects. 

	-----Original Message-----
	From: accessd-bounces at databaseadvisors.com
	[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
MartyConnelly
	Sent: Saturday, November 05, 2005 12:41 PM
	To: Access Developers discussion and problem solving
	Subject: Re: [AccessD] A2k3 Object Browser

	You could try copy to clipboard icon. I think it will only do
individual
	items though.
	It is meant for cut and pasting to code.

	John Bartow wrote:

	>Is there a way to print the properties, methods, and events for a 
	>particular object from the object browser?
	>
	>  
	>

	--
	Marty Connelly
	Victoria, B.C.
	Canada



	-- 
	AccessD mailing list
	AccessD at databaseadvisors.com
	http://databaseadvisors.com/mailman/listinfo/accessd
	Website: http://www.databaseadvisors.com

	-- 
	AccessD mailing list
	AccessD at databaseadvisors.com
	http://databaseadvisors.com/mailman/listinfo/accessd
	Website: http://www.databaseadvisors.com



More information about the AccessD mailing list