Board index » delphi » Calling 16-bit DLL from D3 - Possible??

Calling 16-bit DLL from D3 - Possible??

Is it possible to call a 16-bit DLL, eg written in D1 from a D3
application?  

Thanks
--
Dave

 

Re:Calling 16-bit DLL from D3 - Possible??


In article <36DC2DD5.1...@gecm.DONT.SPAM.ME.com>, Dave Ansell <dave.anse
l...@gecm.DONT.SPAM.ME.com> writes
Quote
>Is it possible to call a 16-bit DLL, eg written in D1 from a D3
>application?  

I have seen various articles on this subject. Even though it is frowned
upon by some people, there is a process called "thunking" which can
bridge the 32-to-16-bit gap. However, the thunking mechanism appears to
vary depending upon the version of Windows being used. There is an
article (plus example code) on thunking on the Delphi Magazine's web
site at

http://www.itecuk.com/delmag.

The article is titled: "Calling 16-Bit Code From 32-Bit In Windows 95".

Of course, a simpler alternative is to design a 16-bit "wrapper"
application, which you can load onto the 32-bit Windows OS and
communicate with the DLL via Windows messages.

HTH
--
Steve Turner
Leeds, England

Re:Calling 16-bit DLL from D3 - Possible??


Dave Ansell schrieb in Nachricht <36DC2DD5.1...@gecm.DONT.SPAM.ME.com>...

Quote
>Is it possible to call a 16-bit DLL, eg written in D1 from a D3
>application?

>Thanks
>--

Dont't try it.

Heiko

(look for thunking at dsp or mdsn, if you want many many problems)

Re:Calling 16-bit DLL from D3 - Possible??


Steve

   Many thanks for the info.  I had a look but decided I to find another
way - it looks like a minefield!

   Do I undestand correctly from the second part of you posting that
windows messages are compatible between 16 and 32 bit apps?  ie is
possible to send a user defined windows message from a 32 bit app and
respond to it in a 16 bit one?

--
Dave

Quote
Steve Turner wrote:

> In article <36DC2DD5.1...@gecm.DONT.SPAM.ME.com>, Dave Ansell <dave.anse
> l...@gecm.DONT.SPAM.ME.com> writes
> >Is it possible to call a 16-bit DLL, eg written in D1 from a D3
> >application?

> I have seen various articles on this subject. Even though it is frowned
> upon by some people, there is a process called "thunking" which can
> bridge the 32-to-16-bit gap. However, the thunking mechanism appears to
> vary depending upon the version of Windows being used. There is an
> article (plus example code) on thunking on the Delphi Magazine's web
> site at

> http://www.itecuk.com/delmag.

> The article is titled: "Calling 16-Bit Code From 32-Bit In Windows 95".

> Of course, a simpler alternative is to design a 16-bit "wrapper"
> application, which you can load onto the 32-bit Windows OS and
> communicate with the DLL via Windows messages.

> HTH
> --
> Steve Turner
> Leeds, England

Re:Calling 16-bit DLL from D3 - Possible??


In article <36DC6CF2.5...@gecm.DONT.SPAM.ME.com>, Dave Ansell <dave.anse
l...@gecm.DONT.SPAM.ME.com> writes

Quote
>   Do I undestand correctly from the second part of you posting that
>windows messages are compatible between 16 and 32 bit apps?  ie is
>possible to send a user defined windows message from a 32 bit app and
>respond to it in a 16 bit one?

Yes. The only thing to be aware of is the type of data that you pass in
the WParam and LParam parameters of the message. For example, 16-bit
pointers and handles cannot be directly interpreted by 32-bit apps.
However, I do know of a way of converting 16-bit pointers and handles to
their 32-bit equivalents. Send a post to this thread and I will respond
with the info if needed.

HTH
--
Steve Turner
Leeds, England

Re:Calling 16-bit DLL from D3 - Possible??


Quote
Steve Turner wrote:

> In article <36DC6CF2.5...@gecm.DONT.SPAM.ME.com>, Dave Ansell <dave.anse
> l...@gecm.DONT.SPAM.ME.com> writes
> >   Do I undestand correctly from the second part of you posting that
> >windows messages are compatible between 16 and 32 bit apps?  ie is
> >possible to send a user defined windows message from a 32 bit app and
> >respond to it in a 16 bit one?

> Yes. The only thing to be aware of is the type of data that you pass in
> the WParam and LParam parameters of the message. For example, 16-bit
> pointers and handles cannot be directly interpreted by 32-bit apps.
> However, I do know of a way of converting 16-bit pointers and handles to
> their 32-bit equivalents. Send a post to this thread and I will respond
> with the info if needed.

Steve
   I tried this last night and as you suggested it is a lot simpler!
   I have not yet started passing any data, only empty messages, so it
would be a great help if you could post and/or mail the additional info
you mentioned.

   Thanks very much for the help,

--
Dave

Re:Calling 16-bit DLL from D3 - Possible??


In article <36DD6896.6...@gecm.DONT.SPAM.ME.com>, Dave Ansell <dave.anse
l...@gecm.DONT.SPAM.ME.com> writes

Quote
>Steve
>   I tried this last night and as you suggested it is a lot simpler!
>   I have not yet started passing any data, only empty messages, so it
>would be a great help if you could post and/or mail the additional info
>you mentioned.

>   Thanks very much for the help,

I have written some example Delphi projects to demonstrate the
mechanisms involved. They are on the web at

http://www.dmg-hq.demon.co.uk/steve/downloads/32_16

--
Steve Turner
Leeds, England

Re:Calling 16-bit DLL from D3 - Possible??


Quote
"Heiko Lttge" <luet...@sunpool.cs.uni-magdeburg.de> wrote:

> Dave Ansell schrieb in Nachricht <36DC2DD5.1...@gecm.DONT.SPAM.ME.com>...
> >Is it possible to call a 16-bit DLL, eg written in D1 from a D3
> >application?

> Dont't try it.

But sometimes it's nessesary to do it.

--
Venlig hilsen / Best regards
        Henning

 _H_P_C_o_n_s_u_l_t_    E-mail:  mailto:henning.peter...@hpc.dk
 Skoletoften 9, Blans   Work:    http://www.hpc.dk
 DK - 6400 Soenderborg  Private: http://www.blans.dk/henning.petersen

Re:Calling 16-bit DLL from D3 - Possible??


Quote
Steve Turner <st...@dmg-hq.demon.co.uk> wrote:
> Yes. The only thing to be aware of is the type of data that you pass in
> the WParam and LParam parameters of the message. For example, 16-bit
> pointers and handles cannot be directly interpreted by 32-bit apps.
> However, I do know of a way of converting 16-bit pointers and handles to
> their 32-bit equivalents. Send a post to this thread and I will respond
> with the info if needed.

Please forward the info to do that.

I'm going to do the same thing in a short time.

--
Venlig hilsen / Best regards
        Henning

 _H_P_C_o_n_s_u_l_t_    E-mail:  mailto:henning.peter...@hpc.dk
 Skoletoften 9, Blans   Work:    http://www.hpc.dk
 DK - 6400 Soenderborg  Private: http://www.blans.dk/henning.petersen

Other Threads