How to create File System Object with using keyword "New"

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • padhuwork
    New Member
    • Dec 2006
    • 30

    How to create File System Object with using keyword "New"

    Hi,

    I m actually making a Windows DLL using VB 6.
    I have modified the Link.exe, so that, it compiles a Windows DLL.

    I m now struck with this.

    I add reference "Microsoft Scripting Runtime"
    Dim fsr As New FileSystemObjec t


    This keyword "New" creates the problem, when compiled DLL is being accessed from Delphi EXE, the application crashes.


    I want to create an object of FileSystemObjec t without using the keyword "New"
    Can anyone help me with syntax?

    Please help.

    Padhu
  • axtens
    New Member
    • Dec 2006
    • 32

    #2
    Originally posted by padhuwork
    Hi,

    I m actually making a Windows DLL using VB 6.
    I have modified the Link.exe, so that, it compiles a Windows DLL.

    I m now struck with this.

    I add reference "Microsoft Scripting Runtime"
    Dim fsr As New FileSystemObjec t


    This keyword "New" creates the problem, when compiled DLL is being accessed from Delphi EXE, the application crashes.


    I want to create an object of FileSystemObjec t without using the keyword "New"
    Can anyone help me with syntax?

    Please help.

    Padhu
    Code:
    Sub main()
       Dim fso As Object
       Dim d As Object
       Dim s As String
       Dim drvPath As String
       drvPath = "C:\"
       Set fso = CreateObject("Scripting.FileSystemObject")
       Set d = fso.GetDrive(fso.GetDriveName(drvPath))
       s = "Drive " & UCase(drvPath) & " - "
       s = s & d.VolumeName & vbNewLine
       s = s & "Free Space: " & FormatNumber(d.FreeSpace / 1024, 0)
       s = s & " Kbytes"
       MsgBox s
        
    End Sub
    Kind regards,
    Bruce.

    Comment

    • padhuwork
      New Member
      • Dec 2006
      • 30

      #3
      Hi,
      Thank you for the code.

      Is it possible to create for ADODB.Connectio n and ADODB.Recordset ?

      I tried the following the code

      Dim conn As Object
      Set conn = CreateObject("A DODB.Recorset")

      I get an error saying "ActiveX component can't create object"

      I did a search in Google, but not able to find the desired one.

      Can you help?
      Regards,
      Padhu

      Comment

      • padhuwork
        New Member
        • Dec 2006
        • 30

        #4
        Sorry, managed to solve the problem.
        Thanks!
        Regards,
        Padhu

        Comment

        Working...