Activex.dll into one file


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 6 of 6

Thread: Activex.dll into one file

  1. #1
    Join Date
    Mar 2005
    Posts
    110

    Activex.dll into one file

    Good Morning!

    I wrote an Activex.dll, for example, the project name is test.vbp, class name is test.dll , including four .DBF file,A1.DBF,A2.DBF,A3.DBF,A4.DBF.

    I make the test.dll , if someone else want to reference my dll, Can I just give him Test.dll?

    If not, How can I put these files into one dll?

  2. #2
    Join Date
    Nov 2003
    Location
    Sweden
    Posts
    74
    Hi,

    To use an ActiveX component (dll or ocx) the ordinary way it has to be registered as a component in the local registry. This can be done manually by the user with the tool REGSVR32.EXE included in Windows. Just execute REGSVR32 <full_path_to_dll_file> (to unregister add a '/u') After it has been registered it can be loaded into any app supporting ActiveX.

    However, your component may depend on other components. If developed in VB there are a number of additional files, depending on how you created it, that should be supplied (and probably registered) as well. MSVBVM60.DLL is one of them for sure when created in VB6.

    Using the PDW (Packing and Deploy Wizard) solves those problems for you by checking each used component's dependency file (a simple textfile named as the component but with the DEP extension) containing info on dependant files).

    If you look in the system map you'll find plenty of DEP-files. Open a few with Notepad and study them. You'll see that most components need MSVCRT.DLL.

    Even though most of the dependant files may alredy 'be there' on a single machine you shouldn't rely on that. If Windows are installed 'minimized' plenty of them won't be there(!) or may be of a previous incompatible version.

    Now you may realize that when you create 'your own' customized component library (yes, you should really do that to improve your development) you must create your own DEP-file for each component. Then you assure that the PDW adds the nescessary files when creating the setup pack.

    All stuff mentioned above are unfortunatly often neglected even by professional developers. Too many commercial apps lacks of some file creating problems on some machines while working flawlessly on others.

    There is only ONE valid solution! Try setting up the app on a 'clean' machine (windows minimized installed and NO extra apps beside Windows). And do that on every Win-version you want the app to run on. Here is an old and outdated machine perfect combined with some disk image tool that helps you easily swap between clean Windows versions.

    Whow, Sorry I was carried away a bit here... But back to your questions. It's possible to 'bundle' the DBF files inside the dll. You CAN put them into the dll (maybe by put them as resources) and by code let the component create copies on the local disk.

    But why complicate the situation? Use the PDW and include the DBF files in the setup pack. Or use the free InnoSetup if you MUST have a single setup file.

    Best wishes,
    Bernie

  3. #3
    Join Date
    Mar 2005
    Posts
    110
    Thank your reply. Your English is perfect.

    I read it twice. I want to know How to do in order to bundle all the files into one dll.

    my team member need to call this dll (my fisrt dll ). then distribute his part to customers. I think, if I put them together, my dll would look like very neat .

  4. #4
    Join Date
    Nov 2003
    Location
    Sweden
    Posts
    74
    Hi,
    First of all, bundle the files as resources is possible only for very small files, less than 64k, since that is the limit for resource files. I some time ago did that with short WAV files containing the 'chirpy' DTMF sound a telephone emits when dialing a digit. So what's left is to 'store' the DBF files directly inside the DLL.

    Here is a sample where an icon is stored in hexadecimal form in a single stringvariable and reproduced to the disk as a functional file. The code may be completed with a test function to see if the file already exists before creating the file. Copy and paste it into a fresh Form...

    What I do is storing the file's hexadecimal style in a string variable (there are virtually no size limitation of a string variable). Why the hex format? Well, it's hard to 'store' it in the code any other way. The file may contain LF's and/or CR's or other non printable characters making it impossible to type when coding. The hex format can be caught by any Hex Viewer like Hex Workshop or any other of all those free ones on the web.

    Before writing it back to a file we must convert each hex pair back to characters by using the function Val(), since that is the only function I know of that acts like Hex() but backwards. Chr(Val("&H" & "08")) represents this way a Backspace.

    It's important to recreate the file purely binary so that no CR and LF are added.

    Regards,
    Bernie

    '=Code starts here================================================
    Private Sub Form_Load()

    Dim FileNumber As Integer

    'Create a simple icon file from data contained in this EXE...
    FileNumber = FreeFile(0)
    Open "C:\test.ico" For Binary As FileNumber
    Put FileNumber, , FileData()
    Close FileNumber

    End Sub

    Private Function FileData() As String

    Dim HexString As String
    Dim Tmp As String

    'Here is the file represented in hexadecimal form.
    'That is the way you see it in any hexviewer.
    'This one is a simple icon.
    HexString = "0000010001002020100000000000E802" & _
    "00001600000028000000200000004000" & _
    "00000100040000000000800200000000" & _
    "00000000000000000000000000000000" & _
    "00000000800000800000008080008000" & _
    "00008000800080800000C0C0C0008080" & _
    "80000000FF0000FF000000FFFF00FF00" & _
    "0000FF00FF00FFFF0000FFFFFF00CCCC" & _
    "CCCCCCCCCCCCCCCCCCCCCCCC00000CCC" & _
    "CCCCCCCCCCCCCCCCCCCCCCCC000000CC" & _
    "CCCCCCCCCCCCCCCCCCCCCCCC00000000" & _
    "00000000000000000000000000000000" & _
    "00000000000000000000000000000000" & _
    "00000000000000000000000000000000" & _
    "0CCCCCCCCCCCCCCCCCCCCCCCC0000000" & _
    "00CCCCCCCCCCCCCCCCCCCCCCC0000000" & _
    "000CCCCCCCCCCCCCCCCCCCCCC0000000" & _
    "00000000000000000000000000000000" & _
    "00000000000000000000000000000000" & _
    "00000000000000000000000000000000" & _
    "0000000CCCCCCCCCCCCCCCCCCC000000" & _
    "00000000CCCCCCCCCCCCCCCCCC000000" & _
    "000000000CCCCCCCCCCCCCCCCC000000" & _
    "00000000000000000000000000000000" & _
    "00000000000000000000000000000000"
    'VB doesn't handle more line concatenations than this....

    HexString = HexString & _
    "00000000000000000000000000000000" & _
    "000000000000CCCCCCCCCCCCCC000000" & _
    "0000000000000CCCCCCCCCCCCC000000" & _
    "00000000000000CCCCCCCCCCCCC00000" & _
    "00000000000000000000000000000000" & _
    "00000000000000000000000000000000" & _
    "00000000000000000000000000000000" & _
    "000000000000000000CCCCCCCCC00000" & _
    "0000000000000000000CCCCCCCC00000" & _
    "0000000000000000000CCCCCCCC00000" & _
    "00000000000000000000000000000000" & _
    "00000000000000000000000000000000" & _
    "00000000000000000000000000000000" & _
    "00000000000000000000000CCCCC0000" & _
    "000000000000000000000000CCCC0000" & _
    "000F8000000FC000000FFFFFFFFFFFFF" & _
    "FFFFFFFFFFFFF8000007FC000007FE00" & _
    "0007FFFFFFFFFFFFFFFFFFFFFFFFFFE0" & _
    "0003FFF00003FFF80003FFFFFFFFFFFF" & _
    "FFFFFFFFFFFFFFFF0003FFFF8003FFFF" & _
    "C001FFFFFFFFFFFFFFFFFFFFFFFFFFFF" & _
    "FC01FFFFFE01FFFFFE01FFFFFFFFFFFF" & _
    "FFFFFFFFFFFFFFFFFFE0FFFFFFF0"

    'Funny, I can actually SEE the icon (upside down) in the pattern above(!)...

    'Now convert everything to a pure characterstring
    Do While Not Len(HexString) = 0
    Tmp = Tmp & Chr(Val("&H" & Left$(HexString, 2)))
    HexString = Right$(HexString, Len(HexString) - 2)
    Loop

    FileData = Tmp

    End Function
    '=Code ends here================================================

  5. #5
    Join Date
    Nov 2003
    Location
    Sweden
    Posts
    74
    Hi,
    Sorry posting it agin but I had to see if those code tags works....

    Code:
    '=Code starts here============================================== ==
    Private Sub Form_Load()
    
    Dim FileNumber As Integer
    
    'Create a simple icon file from data contained in this EXE...
    FileNumber = FreeFile(0)
    Open "C:\test.ico" For Binary As FileNumber
    Put FileNumber, , FileData()
    Close FileNumber
    
    End Sub
    
    Private Function FileData() As String
    
    Dim HexString As String
    Dim Tmp As String
    
    'Here is the file represented in hexadecimal form.
    'That is the way you see it in any hexviewer.
    'This one is a simple icon.
    HexString = "0000010001002020100000000000E802" & _
    "00001600000028000000200000004000" & _
    "00000100040000000000800200000000" & _
    "00000000000000000000000000000000" & _
    "00000000800000800000008080008000" & _
    "00008000800080800000C0C0C0008080" & _
    "80000000FF0000FF000000FFFF00FF00" & _
    "0000FF00FF00FFFF0000FFFFFF00CCCC" & _
    "CCCCCCCCCCCCCCCCCCCCCCCC00000CCC" & _
    "CCCCCCCCCCCCCCCCCCCCCCCC000000CC" & _
    "CCCCCCCCCCCCCCCCCCCCCCCC00000000" & _
    "00000000000000000000000000000000" & _
    "00000000000000000000000000000000" & _
    "00000000000000000000000000000000" & _
    "0CCCCCCCCCCCCCCCCCCCCCCCC0000000" & _
    "00CCCCCCCCCCCCCCCCCCCCCCC0000000" & _
    "000CCCCCCCCCCCCCCCCCCCCCC0000000" & _
    "00000000000000000000000000000000" & _
    "00000000000000000000000000000000" & _
    "00000000000000000000000000000000" & _
    "0000000CCCCCCCCCCCCCCCCCCC000000" & _
    "00000000CCCCCCCCCCCCCCCCCC000000" & _
    "000000000CCCCCCCCCCCCCCCCC000000" & _
    "00000000000000000000000000000000" & _
    "00000000000000000000000000000000" 
    'VB doesn't handle more line concatenations than this....
    
    HexString = HexString & _
    "00000000000000000000000000000000" & _
    "000000000000CCCCCCCCCCCCCC000000" & _
    "0000000000000CCCCCCCCCCCCC000000" & _
    "00000000000000CCCCCCCCCCCCC00000" & _
    "00000000000000000000000000000000" & _
    "00000000000000000000000000000000" & _
    "00000000000000000000000000000000" & _
    "000000000000000000CCCCCCCCC00000" & _
    "0000000000000000000CCCCCCCC00000" & _
    "0000000000000000000CCCCCCCC00000" & _
    "00000000000000000000000000000000" & _
    "00000000000000000000000000000000" & _
    "00000000000000000000000000000000" & _
    "00000000000000000000000CCCCC0000" & _
    "000000000000000000000000CCCC0000" & _
    "000F8000000FC000000FFFFFFFFFFFFF" & _
    "FFFFFFFFFFFFF8000007FC000007FE00" & _
    "0007FFFFFFFFFFFFFFFFFFFFFFFFFFE0" & _
    "0003FFF00003FFF80003FFFFFFFFFFFF" & _
    "FFFFFFFFFFFFFFFF0003FFFF8003FFFF" & _
    "C001FFFFFFFFFFFFFFFFFFFFFFFFFFFF" & _
    "FC01FFFFFE01FFFFFE01FFFFFFFFFFFF" & _
    "FFFFFFFFFFFFFFFFFFE0FFFFFFF0"
    
    'Funny, I can actually SEE the icon (upside down) in the pattern above(!)...
    
    'Now convert everything to a pure characterstring 
    Do While Not Len(HexString) = 0
    Tmp = Tmp & Chr(Val("&H" & Left$(HexString, 2)))
    HexString = Right$(HexString, Len(HexString) - 2)
    Loop
    
    FileData = Tmp
    
    End Function
    '=Code ends here============================================== ==

  6. #6
    Join Date
    Nov 2003
    Location
    Sweden
    Posts
    74
    Wow, they did....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center