The overlap does not prove anything.
I think you still have vfp2c32.fll, don't you? From the thread where you added/extended the AdirEx() function.
Then you should be able to get this running. It needs the vfp2c32.fll and accompanying files and you should CD into the directory with the FLL, of course.
Code:
#INCLUDE vfp2c.h
Clear
Set Library To vfp2c32.fll Additive
CountAllWindows()
Local loForm
loForm = Createobject("form")
loForm.Left=200
loForm.Show()
CountAllWindows()
Create Cursor c_data ;
( ;
cItem c(120) ;
)
Insert Into c_data Values ("Item 1 Item 1 Item 1 Item 1 Item 1 Item 1 Item 1 Item 1 Item 1 Item 1 Item 1")
Insert Into c_data Values ("Item 2 Item 2 Item 2 Item 2 Item 2 Item 2 Item 2 Item 2 Item 2 Item 2 Item 2")
Insert Into c_data Values ("Item 3 Item 3 Item 3 Item 3 Item 3 Item 3 Item 3 Item 3 Item 3 Item 3 Item 3")
loForm.AddObject("combobox1","combobox")
With loForm.combobox1
.RowSource = "c_data"
.RowSourceType = 2
.Visible=.T.
Endwith
CountAllWindows()
Keyboard '{Alt+DNARROW}'
CountAllWindows()
On Key Label CTRL+F5 Clear Events
? 'CTRL+F5 to exit'
Read Events
Procedure CountAllWindows()
Local loCallback
loCallback = Createobject('WNDENUMPROC')
Declare Integer EnumChildWindows In user32.Dll Integer, Integer, Integer
EnumChildWindows(_vfp.hwnd,loCallback.Address,0)
nStart = Seconds()
Do while Seconds()-nStart<.1
Doevents
EndDo
loCallback = .null.
Define Class WNDENUMPROC As Exception
Address = 0
nCount=0
Function Init
This.Address = CreateCallbackFunc('EnumWindowsCallback','BOOL','LONG, LONG',This)
Endfunc
Function Destroy
Activate Screen
? This.nCount
If This.Address != 0
DestroyCallbackFunc(This.Address)
Endif
Endfunc
Function EnumWindowsCallback(hHwnd,Lparam)
This.nCount = This.nCount + 1
Return .T.
Endfunc
Enddefine
I'm open to be corrected, but you'll see generating the loForm creates a new hwnd, creating a combobox on it not, dropping down the list neither.
You can draw on the desktop, whatever VFP does, it does not introduce a new HWND for the list as far as I can see from this.
I'm counting all child windows of _Vfp.hwnd, you could also start at the Desktop hwnd, when you won't count child windows of applications, though. The only possibility for another hwnd is somewhere burried in some other hwnd not exposed and still belonging to VFP, but I don't see the benefit, it should be a child of the desktop, as it can in circumstances stick out of _screen. too. But the desktop child window count stays constant for me, even when a new form is clearly creating a new hwnd.
Anyway, I think VFP just draws directly on the desktop and that always was a reason VFP applications slip through the control of automation tools, WinSpector, Spy++ and the like, that require controls to have their own HWND. All VFP controls are not their own Windows including dropdown parts of them.
Chriss