home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!noc.near.net!hri.com!spool.mu.edu!yale.edu!yale!actcnews!sun1x!charongw.res.utc.com!bsm
- From: bsm@utrcv1.res.utc.com (Brian S. McCarthy)
- Newsgroups: comp.os.ms-windows.programmer.misc
- Subject: Re: Problems calling a DLL function from a VB app. PLEASE HELP!
- Message-ID: <bsm.6.0@utrcv1.res.utc.com>
- Date: 15 Dec 92 21:09:49 GMT
- References: <1992Dec15.135809.5339@u.washington.edu>
- Sender: news@sun1x.actc.res.utc.com
- Organization: United Technologies Research Center
- Lines: 59
- Nntp-Posting-Host: 192.19.3.94
-
- In article <1992Dec15.135809.5339@u.washington.edu> tvp@gibdo.engr.washington.edu writes:
- >From: tvp@gibdo.engr.washington.edu
- >Subject: Problems calling a DLL function from a VB app. PLEASE HELP!
- >Date: 15 Dec 92 13:58:09 GMT
- >
- >Okay, I posted a few days ago about not wanting the screen to blank
- >for the few seconds it took me Shell() out to DOS to run an .exe
- >utility (written in C) that I was calling from inside my VB app.
- >
- >I rewrote the inside of my C source to compile it into a .dll file.
- >Then I followed the instructions in the VB manuals to declare and call
- >the function inside the DLL that was replacing the standalone C app I
- >used to use under DOS. But when I hit F5 to test the VB app, and get
- >to the part where I push the command button that will cause the DLL
- >function to be called, it fails and tells me:
- >
- > "Function or sub undefined"
- >
- >It also highlights the line where the function is called in the
- >source. This is pretty maddening because the function IS defined
- >right there in the Declarations section of the form. And it's defined
- >correctly as far as I can tell too, it's of the proper type, with no
- >mispellings in the Function name or the Lib path. Does anyone know
- >what's up and how I can fix it? I'M STUCK!
- >
- >Thanks in advance to anyone who can help me.
- >
- >------------------------------------------------------------------------
- >Tad Perry Internet: tvp@gibdo.engr.washington.edu
- > CompuServe: 70402,3020
- > NIFTY-Serve: GBG01266
- >------------------------------------------------------------------------
- Are you using Borland C? If so, I may have the answer. It may even apply
- to Microsoft C; I don't know. Is your DLL function declared as an export in
- your DEF file? Like this:
-
- LIBRARY DLLEX
- DESCRIPTION 'Borland C DLL example'
- EXETYPE WINDOWS
- CODE PRELOAD MOVEABLE DISCARDABLE
- DATA PRELOAD MOVEABLE SINGLE
- HEAPSIZE 20480
- EXPORTS MyOwnFunctionName <------- (right here)
- OtherFunctionName
- EtCetera
-
- I was able to duplicate your error message "sub or function not defined"
- simply by deleting the name of one of my functions from the
- EXPORTS list. Hope this helps.
- ---------------------------------------
- Any opinions expressed here are mine alone,
- and are not those of my employer or anyone else.
-
- Brian McCarthy
- United Technologies Research Center
- East Hartford, Connecticut
- (203)727-7638
- bsm@utrc.utc.com
- ---------------------------------------
-