Results 1 to 4 of 4

Thread: Recreating VB6 Dll

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2020
    Posts
    2

    Recreating VB6 Dll

    Our company creates new technologies for some very old equipment. I have been tasked with recreating a VB6 .exe dll. I have managed to get the entry points identified and I can call the new dll from the old application. The old application is looking for a specific global variable to be set before the the system can start. I have had no success with setting this variable from the main() nor can I set the value of this variable at compile time. When the application creates the DLL object, it loads and executes the dll main(). This part is working. But I have spent many hours and many tries to set the value in the class module. Everything that I have attempted appears to create a new data space when on object is created. With a test program I can set the vale of the variable just after the create object and then the test passes. Unfortunately, the customer will not allow a recompile of the host application. I have to solve the issue in the dll.

  2. #2
    Frenzied Member some1uk03's Avatar
    Join Date
    Jun 2006
    Location
    London, UK
    Posts
    1,540

    Re: Recreating VB6 Dll

    Where is this GLOBAL variable? In the .DLL or your VB APP ?

    How is the value determined? Is it a constant? or variable ? What determines the Value?
    _____________________________________________________________________

    ----If this post has helped you. Please take time to Rate it.
    ----If you've solved your problem, then please mark it as RESOLVED from Thread Tools.



  3. #3
    Hyperactive Member
    Join Date
    Jun 2015
    Posts
    390

    Re: Recreating VB6 Dll

    is the address of the variable static? in the main exe? if so a WriteProcessMemory should fix it.
    is the main exe passing in an object reference to any of the dll methods?
    maybe the dll is expected to call one of the object methods to set a property or call an init routine?
    regardless you have a fun job re-engineering old code is a favorite pastime

  4. #4

    Thread Starter
    New Member
    Join Date
    Oct 2020
    Posts
    2

    Re: Recreating VB6 Dll

    To All that replied Thank you I have resolved the issue with the following:
    The variable that I am attempting to set is NOT a Global variable as stated in the first post. It is an Object. With that stated, my new dll recreated a GET / LET for that object name.

    My Solution to set the correct state is as follows:

    Public iInternalModeState As MachineState

    Property LET Mode(iMode As MachineState)
    iInternalModeState = iMode)
    End Property

    Property GET Mode () As MachineState
    Mode = InternalMode
    End Property


    The Machinestate is define as an enumerated table of values


    The calling program issued a the following:

    AR = CreatObject( "OldStuff.dll")

    ' Here is where it would hang

    While AR.Mode = eStartMode
    Wend




    When I implemented the GET/LET code, I can set the program into the run mode and everything starts up correctly. I was able to add other function calls in the GET procedure to initialized features required in the new DLL.

    Thanks for the replies

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width