🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.controls
Article #8

Re: calling files from DLL's

#8
From: Paul Meyer
Date: Thu, 11 Apr 1996 20:29
56 lines
3731 bytes
(followups restricted to comp.os.ms-windows.programmer.controls since
this looks more like a Windows- and VB-specific thing)

Ken Shaner wrote:
> Does anyone know how to call a file from a DLL made in MS VC++ or Borland
> C++.  I can make a DLL to add integers together, but that's about it.  I
> want to use a DLL to manipulate an Array of data, or data in a file, and
> then be able to return this stuff to VB.  For instance, take and array of
> 10 numbers, from a VB app, call the DLL function which adds them together
> or something, and returns the sum.  Another example would be calling the
> DLL from VB that gets 10 numbers from a text file and returns the sum.

I'm confused. What do you mean by "call" a file from a DLL? Read it? Write
it? ???

As for writing a DLL callable from Visual Basic, you need to export your
interface via OLE Automation. That latter is a specific thing built on the
same low-level abstraction (COM) as OLE, but designed for run-time linkage
by name, which is perfect for scripting engines and things like VB.

> If these kinds of things aren't possible, or if using a DLL to do these
> things is stupid, then you can call me a moron, it wont hurt my feelings
> much.  Also, if MFC makes you happier than a pig in @#!%, then dont pick
> on me for using VB.  I think VB is easy enough for user interface.  When
> you write your response (if anyone actually reads my message this far)
> please keep in mind that I am just a Physicist trying to learn something
> new (dont spare any details unless you're really in a hurry).  Thanks for
> your patience.

In order to write that DLL you're going to have to use a language capable
of manipulating COM interfaces. The built-in stuff that modern MFC provides
makes exporting an OLE Automation interface pretty easy--but I'm a firm
disbeliever in the popular myth that if MFC does something you can use it
as a black box instead of learning how it works.

(Lest I start a flamewar in two groups I don't frequent, yes, I do believe
in reusable, more-or-less opaque objects. But Windows is a complicated system,
and the results of people learning MFC and *believing* themselves to be
"Windows programmers" are at best annoying and at worst disastrous. If they
called themselves "MFC programmers" I wouldn't object to them as much, but I
also wouldn't hire one to do something that requires understanding the system
behind the abstraction. I hope that's clear and reasonable enough.)

> Oh, and if you want to e-mail something, please mail to eas1171@sjfc.edu,
> I am not in my account, and I am not quite sure how all this newsgroup
> stuff works anyway.  - Thanks again (in advance)

Diffidence is almost as good as knowledge, compared to some of the really
annoying things people who ignored the news.announce.newusers articles
have done. Thank *you* for being polite and trying to choose the right
newsgroups!

--
Paul Meyer        | When the Tremere ask you about your style of
pem@radmedia.com  | magic, just feel really confident and say,
pem@amurgsval.org | "These aren't the Druids you're looking for."
Technical Details
Message-ID: <316D6B8C.284E@radmedia.com>
Path: arc1-ca.pugleaf.net!clients1.news.internex.net!usenet
References: <4k7f69$jr6@guava.epix.net>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!clients1.news.internex.net!usenet
From: Paul Meyer <pem@radmedia.com>
Newsgroups: comp.os.ms-windows.programmer.controls,comp.lang.c++,comp.lang.c
Subject: Re: calling files from DLL's
Followup-To: comp.os.ms-windows.programmer.controls
Date: Thu, 11 Apr 1996 13:29:00 -0700
Organization: RadMedia, Inc.
Message-ID: <316D6B8C.284E@radmedia.com>
References: <4k7f69$jr6@guava.epix.net>
NNTP-Posting-Host: 205.158.20.71
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 2.0 (WinNT; I)
To: eas1171@sjfc.edu