Discussion:
please help a vb programmer compile this 1 line dll
(too old to reply)
s***@gmail.com
2013-08-24 07:23:46 UTC
Permalink
Gentle souls,

I need a little help with this 1 line dll program .
I am a VB6 programmer but I do understand a little c.
I do have MS c/c++ v4.0 but I have not used it for 15+ years.

The source code is from http://support.microsoft.com/kb/137093

I do have MS c/c++ v4.0 but have not used it for 15+ years.

Here's the code:

HCTL FAR PASCAL _export GetTheHctl(HWND hwnd)
{
return VBGetHwndControl(hwnd);
}

What include files should I use?

I would appreciate any help.
TIA
softie
Geoff
2013-08-24 21:22:08 UTC
Permalink
Post by s***@gmail.com
Gentle souls,
I need a little help with this 1 line dll program .
I am a VB6 programmer but I do understand a little c.
I do have MS c/c++ v4.0 but I have not used it for 15+ years.
The source code is from http://support.microsoft.com/kb/137093
I do have MS c/c++ v4.0 but have not used it for 15+ years.
HCTL FAR PASCAL _export GetTheHctl(HWND hwnd)
{
return VBGetHwndControl(hwnd);
}
What include files should I use?
I would appreciate any help.
TIA
softie
There is no such function as VBGetHwndControl in Win32. This is old
enough (1996 from whence this KB article dates) to be a Win16
function. Its use was probably deprecated a long time ago. I've
searched my Windows 7 system for it and it no longer exists in any
Win32 DLL.

The naming of the function is also suspicious, MS used vb in their
libraries, not VB. It also doesn't fit as the article states it's not
supported in VB, therefore the VC wrapper function but then it calls a
VB function? Does not compute.
s***@gmail.com
2013-08-25 00:14:52 UTC
Permalink
Post by s***@gmail.com
Gentle souls,
I need a little help with this 1 line dll program .
I am a VB6 programmer but I do understand a little c.
I do have MS c/c++ v4.0 but I have not used it for 15+ years.
The source code is from http://support.microsoft.com/kb/137093
I do have MS c/c++ v4.0 but have not used it for 15+ years.
HCTL FAR PASCAL _export GetTheHctl(HWND hwnd)
{
return VBGetHwndControl(hwnd);
}
What include files should I use?
I would appreciate any help.
TIA
softie
Farnsworth
2013-08-26 03:55:29 UTC
Permalink
Post by s***@gmail.com
Gentle souls,
I need a little help with this 1 line dll program .
I am a VB6 programmer but I do understand a little c.
I do have MS c/c++ v4.0 but I have not used it for 15+ years.
The source code is from http://support.microsoft.com/kb/137093
I do have MS c/c++ v4.0 but have not used it for 15+ years.
HCTL FAR PASCAL _export GetTheHctl(HWND hwnd)
{
return VBGetHwndControl(hwnd);
}
What include files should I use?
I would appreciate any help.
TIA
softie
It seems that VBGetHwndControl() function was implemented in VB4 runtime,
but not in VB5/6 runtime(MSVBVM60.DLL for VB6), so you have to use an
alternative solution, like looping through the Controls collection.
s***@gmail.com
2013-08-26 06:30:54 UTC
Permalink
Post by Farnsworth
It seems that VBGetHwndControl() function was implemented in VB4 runtime,
but not in VB5/6 runtime(MSVBVM60.DLL for VB6), so you have to use an
alternative solution, like looping through the Controls collection.
Thank you for your help.
Yes, I am now looping thru controls and after some rough starts, all is well.

The pseudo code I used was like this:
function getctl(Findhwnd as long) as object
Dim frm As Form
Dim ctl As Control
On Error Resume Next
For Each frm In Forms
For Each ctl In frm.Controls
If ctl.hwnd = FindHwnd Then
getctl = ctl
exit function
End If
Next
next

The problem was that without testing the control type,
you don't know if it has as property hwnd
So in the above pseudo code, note the on error resume next
Now, scan thru the list of controls,
The first control that doesnt have hwnd property will cause the if test to fail.
The resume next causes that control to be returned as if it was a correct match.

thanks again

Continue reading on narkive:
Loading...