Creating a DLL from an existing VB6 application

Thread Solved

Join Date: Apr 2006
Posts: 6
Reputation: George Jump is an unknown quantity at this point 
Solved Threads: 0
George Jump George Jump is offline Offline
Newbie Poster

Creating a DLL from an existing VB6 application

 
0
  #1
Aug 21st, 2006
Hello - I wrote an application to read mag stripe data from a card, parse it and display it's contents. Now I'm attempting to create a DLL out of that logic. I have trimmed down the program to eliminate all those modules, functions, subs etc., that won't be necessary in the DLL. What following is a brief synopsis of the code I currently have.

frmMain.frm

(contains KeyUp and KeyPress functions to process each character read. Also contains AfterCheck which is the response to an event indicating that the last character has been read. It is shown here:

Sub AfterCheck()
cmdDecode 'function in frmMain that parses all the inputted data
'and places it in the Global string IDData
Unload Me
End Sub

I have a .bas module called MainForm.bas which contains the DLL function name to be called by an outside program:

Global IDData As String
Dim ShowForm as New CShowForm
Public Function ID() As String
ShowForm.CShowForm
ID = IDData
End Function

Finally, I have the class module CShowForm.cls:

Public Function CShowForm()
frmMain.Show vbModal
End Function

That's basically to total amount of code. When I initiate the package and deployment wizard, I get the following error message:

In order to proceed, the wizard requires the executable file 'identifier.dll' for this project (THIS IS THE FILE I'M TRYING TO CREATE IN THE FIRST PLACE!). Click browse to find the file or compile to compile the project.

I select COMPILE and I get the following error:

Unexpected error number 800004005 has occurred. Automation error. Unspecified error.

Anyone have any ideas?

Thanks, George
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 239
Reputation: extofer is an unknown quantity at this point 
Solved Threads: 5
extofer's Avatar
extofer extofer is offline Offline
Posting Whiz in Training

Re: Creating a DLL from an existing VB6 application

 
0
  #2
Aug 21st, 2006
Did you start your project as a VB EXE project or Active X DLL??
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 6
Reputation: George Jump is an unknown quantity at this point 
Solved Threads: 0
George Jump George Jump is offline Offline
Newbie Poster

Re: Creating a DLL from an existing VB6 application

 
0
  #3
Aug 22nd, 2006
Yes, the project was started as an ActiveX DLL
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: Creating a DLL from an existing VB6 application

 
0
  #4
Aug 22nd, 2006
Does it compile though the IDE (without the use of the package and deployment wizard)?
Last edited by Comatose; Aug 22nd, 2006 at 5:08 pm.
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 6
Reputation: George Jump is an unknown quantity at this point 
Solved Threads: 0
George Jump George Jump is offline Offline
Newbie Poster

Re: Creating a DLL from an existing VB6 application

 
0
  #5
Aug 22nd, 2006
Thanks for your help but I've solved the problem. It seems if you select "Make *.dll" under "File" in the VB IDE, it creates the DLL. All that is then necessary is to register the DLL with the calling routine by checking its box under "References" under "Project". I now have the DLL working properly. Plus, I'm not using a Declare statement which none of my six VB6 books makes any mention of and two of those are Microsoft VB6 books!!

Thanks again for your help. If you would like to see how the DLL and the caller work, I'll be happy to post the code.

Let me know.

Thanks, George
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: Creating a DLL from an existing VB6 application

 
0
  #6
Aug 22nd, 2006
Right on. There are two types of .dll's. A "Real" dll, which has an entry point, and usually doesn't have any dependencies... and an ActiveX Dll. The declare statement is used to reference a function that is in a "Real" DLL, while going to "project/references" and adding a references to a DLL works only for ActiveX Dll's. So, to my knowledge, you actually can't use the declare statement on an ActiveX dll.....

Since you found the solution, however, I'm going to go ahead and mark this thread as solved.
Last edited by Comatose; Aug 22nd, 2006 at 7:46 pm.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC