Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old August 25th, 2006, 01:18 PM
Authorized User
Join Date: Feb 2005
Location: , , Netherlands.
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Default store variables from DLL file

Hi all,

I have created a DLL with Visual Basic 6.0. Now, when I run subroutines in this DLL from, for example, a standard EXE, all the variables used in this specific subroutine are cleared from the memory after being run. I would like to use the values from these variables further in my Executable (I already tried a Static statement, but somehow this makes my DLL crash).

So, to the question: Does anyone know how to store variables from a DLL in such a way that I can easily use/retrieve their values in an executable? (I have created a link between the DLL and the Executable)

Thanks in advance
Max (18)
  #2 (permalink)  
Old August 25th, 2006, 01:21 PM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi

hi there.. why no store the variables on the exe side and pass is to the dll by ref???

couldn't you do that??


  #3 (permalink)  
Old August 25th, 2006, 04:15 PM
Authorized User
Join Date: Feb 2005
Location: , , Netherlands.
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts


The dll has code which is independent on the executable. It does check items on the form of the executable, either in variables or arrays. I need to be able to just store/remember them, since after the procedure in the DLL is finished the variables are cleared from the memory.

Thanks for your help though
  #4 (permalink)  
Old August 26th, 2006, 05:01 PM
Friend of Wrox
Join Date: Jun 2003
Location: Alameda, ca, USA.
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts

are you talking about an ActiveX library right?

in the public class that is used by the exe declare your variables at module level, i.e. outside any methods like

private m_myVar as Double

then in your exe keep a copy of that class, and do not create and destroy it any time you use it (same trick, declare it at module level

private m_myClass as MyDLL.MyClass

In this way the class will be destroyed only when the app terminates (unless you set it to nothing) and thus it will keep its data

Similar Threads
Thread Thread Starter Forum Replies Last Post
Read file and store it to database sparsh2010 Access VBA 3 July 17th, 2008 08:27 AM
how to store a text file vivekkumar_23 SQL Server 2000 2 July 4th, 2006 09:18 AM
how to store text file in database vivekkumar_23 Servlets 1 February 13th, 2006 05:29 AM
How to store a file name in a field ? SKE Access ASP 6 May 14th, 2005 04:46 AM
App Code store in DLL Aal Pro VB 6 2 December 23rd, 2004 11:00 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.