-1

I was looking for some vb6 that would allow me to populate a listbox with a directory of files when I found the following elegant piece of code.

List1.hwnd, &H18D, &H20, "directory*.*"

Most of the other examples I found were 4 or more lines of code. Can someone help me understand what is happening here? What is the

List1.hwnd, &H18D, &H20

Part doing?

There was a general declaration I left out.

  Private Declare Function SendMessageStr Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
JForgie
  • 193
  • 1
  • 14
  • Thats the whole code. I can use this and either hard code the "directory" part or use open dialog and populate a listbox with every file inside of the directory. I described what the code does in the first sentence. – JForgie Jan 05 '15 at 15:39
  • it seems to me these are the values which are submitted to a function call ... the functionname is missing though ... are you sure this is the complete line ? maybe this line of code started 1 line earlier and continued on this line ? – Hrqls Jan 05 '15 at 16:00
  • please post a large part of the code : the whole function this is in, or at least a few lines before this line and 1 or 2 lines after this line – Hrqls Jan 05 '15 at 16:01
  • This can't be the entire code, as there is no definition of what `List1` is to be seen. The line as written won't do anything, because there is nothing functional there. – Ken White Jan 05 '15 at 16:02
  • 1
    You are all correct. Apologies. Fairly new at this. Main question has been updated. – JForgie Jan 05 '15 at 16:23

1 Answers1

2

Your edit still makes not enough sense - unless the code was

SendMessageStr List1.hwnd, &H18D, &H20, "directory*.*"

and you thought the space means it's a stand-alone bit (it isn't).

That code is

SendMessage (List1.hwnd, LB_DIR, DDL_ARCHIVE, "directory*.*")
- it sends a documented Windows message to a ListBox control named List1 to fill it with files that match the mask "directory*.*", including the archived ones.
Community
  • 1
  • 1
GSerg
  • 76,472
  • 17
  • 159
  • 346