473,231 Members | 1,961 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,231 software developers and data experts.

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 FileSystemObject


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 FileSystemObject without using the keyword "New"
Can anyone help me with syntax?

Please help.

Padhu
Jan 18 '07 #1
3 2348
axtens
32
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 FileSystemObject


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 FileSystemObject without using the keyword "New"
Can anyone help me with syntax?

Please help.

Padhu
Expand|Select|Wrap|Line Numbers
  1. Sub main()
  2.    Dim fso As Object
  3.    Dim d As Object
  4.    Dim s As String
  5.    Dim drvPath As String
  6.    drvPath = "C:\"
  7.    Set fso = CreateObject("Scripting.FileSystemObject")
  8.    Set d = fso.GetDrive(fso.GetDriveName(drvPath))
  9.    s = "Drive " & UCase(drvPath) & " - "
  10.    s = s & d.VolumeName & vbNewLine
  11.    s = s & "Free Space: " & FormatNumber(d.FreeSpace / 1024, 0)
  12.    s = s & " Kbytes"
  13.    MsgBox s
  14.  
  15. End Sub
  16.  
Kind regards,
Bruce.
Jan 18 '07 #2
Hi,
Thank you for the code.

Is it possible to create for ADODB.Connection and ADODB.Recordset?

I tried the following the code

Dim conn As Object
Set conn = CreateObject("ADODB.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
Jan 18 '07 #3
Sorry, managed to solve the problem.
Thanks!
Regards,
Padhu
Jan 18 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

30
by: seesaw | last post by:
Is it right thing to always avoid using "new" to create objects? What if after starting the application, then decide which and how many objects to create? (Seems like under such situation is there...
24
by: Rv5 | last post by:
Rookie c++ question, but Ive spent the last 5 years doing Java, where everytime I created an object I used new. In c++ I can create my objects without and its confusing me just a little. I have...
12
by: Ola Johansson | last post by:
Can anyone explain to me a meningfull use of the "new" keyword (Shadows in VB). I think i understand how it works fully but i cant figure out why you would use it. Why would you want to declare...
5
by: Sam | last post by:
Hi everyone Could anyone help me understand the usage of the "New" keyword I'm new to VB.Net. 1. Why do we use the "New" keyword on some object type variables such as the myPen of the...
4
by: Ben R. | last post by:
I'm curious about the differeng behavior of the "new" keyword when dealing with value versus object types. If I'm correct, when I do: dim x as integer There's no need for "new" to be called...
24
by: M O J O | last post by:
Hi, Instead of doing this.... Public Class Form1 Public Shared Sub CreateAndShow() Dim f As New Form1 f.Show() End Sub
4
by: Ronald S. Cook | last post by:
So most of the time I need to write the following to instantiate an object: Dim cnn As New SqlConnection() But sometimes Intellisense tells me not to include the "new": Dim dst As DataSet ...
350
by: Lloyd Bonafide | last post by:
I followed a link to James Kanze's web site in another thread and was surprised to read this comment by a link to a GC: "I can't imagine writing C++ without it" How many of you c.l.c++'ers use...
30
by: Medvedev | last post by:
i see serveral source codes , and i found they almost only use "new" and "delete" keywords to make they object. Why should i do that , and as i know the object is going to be destroy by itself at...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.