473,396 Members | 1,833 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,396 software developers and data experts.

Create a DLL with VB.NET and use with VBScript

I don't know if this can be done, but here goes...

The following is a code snippet from VB 6 that I used to read/write to INI
files. Is it possible to create a DLL with .NET and use it with VBScript?
Where would I begin?

Option Explicit

Private Declare Function GetPrivateProfileString Lib "kernel32" Alias
"GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal
lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As
String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Private Declare Function WritePrivateProfileString Lib "kernel32" Alias
"WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal
lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long

Public Function GetINIInfo(ByVal sSection As String, ByVal sKeyWord As
String, _
ByVal sDefVal As String, ByVal sINIFile As String) As String
Dim sTempVar As String * 256
Dim lRet As Long

'Get value from INI file
lRet = GetPrivateProfileString(CStr(sSection), CStr(sKeyWord),
CStr(sDefVal), sTempVar, 256, CStr(sINIFile))

'Strip off NULL and return value
If lRet > 0 Then
GetINIInfo = RTrim(Left$(Mid$(sTempVar, 1, lRet), InStr(sTempVar,
Chr$(0)) - 1))
Else
GetINIInfo = ""
End If
End Function

Public Function WriteINIInfo(ByVal sSection As String, ByVal sKeyWord As
String, _
ByVal sValue As String, ByVal sINIFile As String) As String
WriteINIInfo = WritePrivateProfileString(CStr(sSection), CStr(sKeyWord),
CStr(sValue), CStr(sINIFile))
End Function
--

-Kevin
Nov 22 '05 #1
2 2720
On Fri, 19 Aug 2005 19:54:03 -0700, "Kevin Buchanan" <Ke***********@discussions.microsoft.com>
wrote:

¤ I don't know if this can be done, but here goes...
¤
¤ The following is a code snippet from VB 6 that I used to read/write to INI
¤ files. Is it possible to create a DLL with .NET and use it with VBScript?
¤ Where would I begin?
¤

It's already been done:

http://www.mentalis.org/soft/class.qpx?id=6

To register the .NET DLL for COM interop you can use the Regasm tool:

http://msdn.microsoft.com/library/de...lRegasmexe.asp
Paul
~~~~
Microsoft MVP (Visual Basic)
Nov 22 '05 #2
Thanks - that did it!

--

-Kevin
"Paul Clement" wrote:
On Fri, 19 Aug 2005 19:54:03 -0700, "Kevin Buchanan" <Ke***********@discussions.microsoft.com>
wrote:

¤ I don't know if this can be done, but here goes...
¤
¤ The following is a code snippet from VB 6 that I used to read/write to INI
¤ files. Is it possible to create a DLL with .NET and use it with VBScript?
¤ Where would I begin?
¤

It's already been done:

http://www.mentalis.org/soft/class.qpx?id=6

To register the .NET DLL for COM interop you can use the Regasm tool:

http://msdn.microsoft.com/library/de...lRegasmexe.asp
Paul
~~~~
Microsoft MVP (Visual Basic)

Nov 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jiang | last post by:
Does anybody know how to create client side Excel.Application objects from aspx code? I know in vbscript you can put into <script language="vbscript"> Dim oXL, oBook Set oXL =...
6
by: Steve Richter | last post by:
I am getting error in a vbscript: ActiveX component cant create object: Excel.Application. The vbscript code is: Dim objExcel Set objExcel = CreateObject("Excel.Application") I am pretty...
8
by: Paw | last post by:
Greetings. I use asp. what I need is is when a visitor comes to the site, I need it to check the host name. if "www.hometowndigest.com" is the host, then check a folder named "something" and if...
2
by: thisis | last post by:
Hi All, What options/methos/properties/functions/objects do I have in order to create a Function in ASP/VBScript that process/create binary data as an image file type? The Function is...
7
by: thisis | last post by:
Hi All, i have this.asp page: <script type="text/vbscript"> Function Body_Onload() ' create the object Set obj = Server.CreateObject("UploadImage.cTest") ' use method of the object...
20
by: Highlander | last post by:
Hello all. Consider the following HTA: <html> <head> <title>Date Pulldowns</title> <HTA:APPLICATION ID="HTAUI" APPLICATIONNAME="Date Pulldowns" SCROLL="no" SINGLEINSTANCE="yes"
3
by: Michael | last post by:
Hi. I have COM+ component installed on my XP. I have problem to create instance of it inside vbscript. How can I do it? The error I get is : ActiveX component can't create object. Thanks
0
by: jonyoung | last post by:
I think I need to use WIA Windows Image Acquisition to load an image file and create a thumbnail of it and write it out again. Can anyone think of a better way to do it in ASP? I need to upload...
1
by: niveknornev | last post by:
Anyone ever used a script to create RDP session files? You can edit an RDP file using any text editor, however if you try to use simple batch, or vbscript to append text to that file, it doesn't...
1
by: jdub33 | last post by:
I have a web project that used a vb6 class library. The asp page would call a createobject() to access the class library. I recently updated the vb6 class library to .net2005. I unregistered the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.