Calling 32-bit DLLs from 16-bit-Applications 
Author Message
 Calling 32-bit DLLs from 16-bit-Applications

Hi,

my problem is following:
I must use a 32bit-DLL from Visual Basic 3.0 (a 16bit-application)
under WfW (the DLL also runs with Win32s) and Win95.

Calling the DLL directly doesn't work.

Which possibilities exist to solve this problem?

) Writing an own DLL for conversion between 16bit and 32bit?
   If yes, from where can I get more information about that?
   Do such DLL's exist anywhere?

) Writing a 32bit-OLE-Server? (I could use VC++ 4.0)
   Are there any examples of such servers, that also run under Win32s?
   Is it true, that OLE-container and OLE-server can be written
   for different APIs (16,32bit)?

) Any other suggestions?

Thanks
Wolfgang

--------------------------------------------------------------------
Wolfgang Steiner; MA 14 - ADV; Rathausstr.1; A-1082 Vienna; Austria
phone:  +43-1-4000/98601
fax:    +43-1-4000/7141

--------------------------------------------------------------------



Sun, 19 Jul 1998 03:00:00 GMT  
 Calling 32-bit DLLs from 16-bit-Applications
You need the 32 Windows Knowledge Base from Microsoft.

ftp://ftp.microsoft.com/Softlib/MSLFiles/WIN32KB.EXE

It has information on what you need, "Thunking".  You may also want
to check previous issues of Microsoft Journal.  The Miscrosoft
Developer Network CD's have more information along with VB examples
and a DLL used to call the 32 bit functions.

Hope this helps.

Mark



Sun, 19 Jul 1998 03:00:00 GMT  
 Calling 32-bit DLLs from 16-bit-Applications
Try http://198.105.232.5:80/kb/developr/vb/q141939.htm

Bryce Abbott



Mon, 20 Jul 1998 03:00:00 GMT  
 Calling 32-bit DLLs from 16-bit-Applications

Quote:

> my problem is following:
> I must use a 32bit-DLL from Visual Basic 3.0 (a 16bit-application)
> under WfW (the DLL also runs with Win32s) and Win95.

[snip]

Quote:
> ) Writing a 32bit-OLE-Server? (I could use VC++ 4.0)

This is probably your easiest way to get things done.  Write the OLE
server with automation exports, and call the automation calls in the
16-bit application.  The advantage here is that the OLE libraries will
automatically "marshall" the calls across 16- and 32-bit, regardless
of the operating system in use.

Thunking is also an option, but it's specific to the operating system,
so Win32s thunking would _only_ work under WfW.  For what it's worth,
though, the Win32s thunking is extremely easy to do.

See the Win32s documentation for information on thunking.

Quote:
>    Is it true, that OLE-container and OLE-server can be written
>    for different APIs (16,32bit)?

OLE will automatically marshall across the bit boundary, as long as
both are executables.  In-process servers (DLLs) do not have the benefit
of the automatic marshalling.

--
class CBradWilson : public CWorldWatchProgrammingTeam {
  public:

    void GetE164Addr  ( CString& s ) { s = "+1 (810) 620-9803";      }
    void GetURL       ( CString& s ) { s = "http://www.exptech.com"; }
    void GetDisclaimer( CString& s ) { s = "All I say is fact :-p";  }

Quote:
};

//  QOTW:  "Don't think of yourself as the least intelligent creature in this
//          room ... if you consider the entire planet, you're smarter than
//          literally hundreds of people."  - Dogbert to Dilbert


Mon, 20 Jul 1998 03:00:00 GMT  
 Calling 32-bit DLLs from 16-bit-Applications

Quote:

> I must use a 32bit-DLL from Visual Basic 3.0 (a 16bit-application)
> under WfW (the DLL also runs with Win32s) and Win95.

You must use universal Thunks. However, your program will not run under =

NT or Win32s.

-- =

---------------------------------------

---------------------------------------



Mon, 20 Jul 1998 03:00:00 GMT  
 Calling 32-bit DLLs from 16-bit-Applications

Quote:

>> ) Writing a 32bit-OLE-Server? (I could use VC++ 4.0)

>This is probably your easiest way to get things done.  Write the OLE
>server with automation exports, and call the automation calls in the
>16-bit application.  The advantage here is that the OLE libraries will
>automatically "marshall" the calls across 16- and 32-bit, regardless
>of the operating system in use.

I've tried this way. Under Win95 it works without problems, within
my Visual Basic program I can also start the OLE server with

Set MyObj = CreateObject("MyServer.xyz")

Under WfW it seems that it isn't possible to start a 32bit-OLE server from
a 16bit-application. I got an error message.
After starting the OLE-server from a 32bit-application, the VB3-application
could work together with the OLE-server

Set MyObj = GetObject(,"MyServer.xyz")

Regards
Wolfgang

--------------------------------------------------------------------
Wolfgang Steiner; MA 14 - ADV; Rathausstr.1; A-1082 Vienna; Austria
phone:  +43-1-4000/98601
fax:    +43-1-4000/7141

--------------------------------------------------------------------



Tue, 21 Jul 1998 03:00:00 GMT  
 Calling 32-bit DLLs from 16-bit-Applications

Quote:

>my problem is following:
>I must use a 32bit-DLL from Visual Basic 3.0 (a 16bit-application)
>under WfW (the DLL also runs with Win32s) and Win95.
>Calling the DLL directly doesn't work.
>Which possibilities exist to solve this problem?
>) Writing an own DLL for conversion between 16bit and 32bit?
>   If yes, from where can I get more information about that?
>   Do such DLL's exist anywhere?

There is a public domain thunking .DLL called CALL32.DLL.  I have a
copy available from one of my pages:
http://www.redshift.com/~arcatpet/vb.html

There are also a couple of VB3 program source code samples there that
use the .DLL, one for Win95 taskbar tray usage, and another for
Win95/NT registry reading/writing.  Note that internal documentation
for CALL32.DLL says it will only work on NT, but it was written before
the WOW in Win95 became compliant with the NT version.  No problems
experienced with Win95 - haven't tested with Win32s.

--
Don Bradner

author of WWPlus, ImgViewer/16, and BirdData
http://www.redshift.com/~arcatpet



Tue, 21 Jul 1998 03:00:00 GMT  
 Calling 32-bit DLLs from 16-bit-Applications
If you use a 16 bit VB4 written OLE file and read the public
properties from a 32 bit VB program, Does that mean that the user of
your program will need to have both vb40016.dll and vb40032.dll files?


Tue, 21 Jul 1998 03:00:00 GMT  
 Calling 32-bit DLLs from 16-bit-Applications

Quote:

> You must use universal Thunks. However, your program will not run under
> NT or Win32s.

  Not true. In fact Universal Thunk only works under Win32s. Under
Win 95 he needs to use the thunk compiler to generate thunk code. Under
Win NT no thunking is possible.


Tue, 21 Jul 1998 03:00:00 GMT  
 Calling 32-bit DLLs from 16-bit-Applications


Quote:

>> I must use a 32bit-DLL from Visual Basic 3.0 (a 16bit-application)
>> under WfW (the DLL also runs with Win32s) and Win95.

>You must use universal Thunks. However, your program will not run under =

>NT or Win32s.

Wrong. Universal thunks are ONLY available on Win32s. What's needed here
are "generic thunks"; these are available under Win95 and NT, but NOT
Win32s.

There is no thunking mechanism which works under all 3 Win32 platforms :-<

Chris
--
--------------------------------------------------------------------------
 Chris Marriott, Warrington, UK      | Author of SkyMap v3 award-winning

            For full info, see http://www.execpc.com/~skymap  
      Author member of Association of Shareware Professionals (ASP)
--------------------------------------------------------------------------



Tue, 21 Jul 1998 03:00:00 GMT  
 Calling 32-bit DLLs from 16-bit-Applications

Quote:

> Wrong. Universal thunks are ONLY available on Win32s. What's needed here
> are "generic thunks"; these are available under Win95 and NT, but NOT
> Win32s.

> There is no thunking mechanism which works under all 3 Win32 platforms :-<

> Chris
> --
> --------------------------------------------------------------------------

   I just finished a device driver VXD for some non-linear video
hardware we made.  Under Win32s it uses "Universal Thunks" to thunk
from a 32bit dll to a 16bit dll, at this point the 16 bit dll calls
directly into the VXD.  It's almost the same for Win95, but it uses
"Flat Thunks" and a thunk compiler to create the thunk obj files.
After MANY calls to Microsofts DDK support,  and tons of docs, there
is NO WAY to thunk and call a VXD under WinNT.  Thunking don't exist
in WinNT!

   If you could prove me wrong I'd be happy! Soon I might have to port
the VXD code to WinNT.  My understanding is I will have to do some
reading on HAL ;-)



Wed, 22 Jul 1998 03:00:00 GMT  
 Calling 32-bit DLLs from 16-bit-Applications

Quote:

> Wrong. Universal thunks are ONLY available on Win32s. What's needed here
> are "generic thunks"; these are available under Win95 and NT, but NOT
> Win32s.

Chris:

Have you found a way to thunk between 16 and 32 bits under NT?

-- Kevin



Wed, 22 Jul 1998 03:00:00 GMT  
 Calling 32-bit DLLs from 16-bit-Applications
Hopefully thunking will be a thing of the past.

Left to philosophers anyway :-)

32bit flat memory models are good, and most tools now
support 32bit.  (overhead schmoverhead)

B.

(Actually this brings up a question.  How long will 16bit
be with us?)



Thu, 23 Jul 1998 03:00:00 GMT  
 Calling 32-bit DLLs from 16-bit-Applications

Quote:


> > You must use universal Thunks. However, your program will not run under
> > NT or Win32s.

>   Not true. In fact Universal Thunk only works under Win32s. Under
> Win 95 he needs to use the thunk compiler to generate thunk code. Under
> Win NT no thunking is possible.

Hi,
Do you know where I could find the MS thunk compiler?  I
thought it would be on the VC4 CD, but no.  So, where is it??

Thanks! :-(

Eric Morin
INFORMISSION Group Inc.
Canada

WWW:     http://www.informission.ca



Thu, 23 Jul 1998 03:00:00 GMT  
 Calling 32-bit DLLs from 16-bit-Applications

Quote:

> Hi,
> Do you know where I could find the MS thunk compiler?  I
> thought it would be on the VC4 CD, but no.  So, where is it??

  I think it's on one of the Microsoft developer disks. Probably the
Win32 DDK. I forget where I got it from, and am not at the office so
I cant look around.


Thu, 23 Jul 1998 03:00:00 GMT  
 
 [ 19 post ]  Go to page: [1] [2]

 Relevant Pages 

1. calling a 16-bit dll from a 32-bit application

2. How to call a 16-bit dll in a 32-bit application

3. Need Help calling 16-bit from 32-bit application

4. Calling 16 bit DLL's in VB5 ENV(32 bit)

5. calling a 16-bit dll from VB 32-bit

6. Need to write 32-bit DLL to do 16-bit calls to a software interrupt

7. Calling 16 bit DLL from 32 bit app

8. Can VB4.0 32 Bit call a 16 bit DLL

9. Thunking, 16-bit app calls 32-bit DLL???

10. 32 Bit Program to call 16 Bit DLL

11. Advantages of 32 bit applications over 16 bit applications

 

 
Powered by phpBB® Forum Software