473,698 Members | 2,376 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VB2005 registering a dll

I have an app using a VB6 ActiveX.dll which I also have made as an exe. Both
the dll and exe have exactly the same code and start in Sub Main. There is
no form involved.

I start this activex as a Process like so:

Dim NewProcess As Process = New Process

Then I use one of these:

Process.Start(" D:\Test\VB6\dll \MyProg.dll", CStr(Arg1) & " " &
CStr(Arg2))

Process.Start(" D:\Test\VB6\MyP rog.exe", CStr(Arg1) & " " & CStr(Arg2))

If I start the exe version all goes well. But if I start the dll version a
MsgBox pops up (and screws up the timing) with this message

"Dll RegisterServer in D:\Test\VB6\dll \MyProg.dll succeeded"

Ive tried putting the MyProg.dll in System32 folder and the VB2005 app's Bin
folder. Of course I unregister all other appearances.

The message pops up every time I run the app not just the first time.

Help !!!!

Galen

Dec 29 '06 #1
15 1964
Hi Galen,

I'm not sure if I fully understand your question. So please feel free to
correct me if I missed anything.

The Process.Start by default uses
ShellExecuteEx(http://msdn2.microsoft.com/en-us/library/ms647733.aspx) to
start the file. For an EXE file, the EXE gets executed directly. For a DLL
file, the default verb
(http://msdn.microsoft.com/library/en...l/programmersg
uide/shell_basics/shell_basics_ex tending/fileassociation s/fa_verbs.asp?fr ame
=true) is used to execute file. In your case, I guess some COM register
tool is associated with the DLL file and it's executed with your DLL and
other parameters passed to it as command line. In this case, the tool
reports that your DLL is registered successfully.

To register your DLL, you can use regsvr32.exe in your system32 directory:

Dim NewProcess As Process = Process.Start(" regsvr32.exe", "/s
d:\Test\VB6\MyP rog.exe " & CStr(Arg1) & " " & CStr(Arg2))
To know whether the registration is successful or not, wait it to exit and
read its ExitCode:

NewProcess.Wait ForExit()
if NewProcess.Exit Code = 0 then
Console.WriteLi ne("Registratio n successful")
else
Console.WriteLi ne("Registratio n failed")
end if
Hope this helps.
Sincerely,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Dec 29 '06 #2
"Galen Somerville" <ga***@communit y.nospamschrieb :
>I have an app using a VB6 ActiveX.dll which I also have made as an exe.
Both the dll and exe have exactly the same code and start in Sub Main.
There is no form involved.

I start this activex as a Process like so:

Dim NewProcess As Process = New Process

Then I use one of these:

Process.Start(" D:\Test\VB6\dll \MyProg.dll", CStr(Arg1) & " " &
CStr(Arg2))

Process.Start(" D:\Test\VB6\MyP rog.exe", CStr(Arg1) & " " & CStr(Arg2))

If I start the exe version all goes well. But if I start the dll version a
MsgBox pops up (and screws up the timing) with this message

"Dll RegisterServer in D:\Test\VB6\dll \MyProg.dll succeeded"
DLLs cannot be started directly except maybe using "rundll.exe ". However,
just start your executable file that uses the DLL file. This will work if
the DLL has been registered properly, which can be archieved using
"regsvr32.e xe" for use with VB6 and "regasm.exe " for use within .NET-based
applications.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Dec 29 '06 #3

"Herfried K. Wagner [MVP]" <hi************ ***@gmx.atwrote in message
news:eF******** *****@TK2MSFTNG P04.phx.gbl...
"Galen Somerville" <ga***@communit y.nospamschrieb :
>>I have an app using a VB6 ActiveX.dll which I also have made as an exe.
Both the dll and exe have exactly the same code and start in Sub Main.
There is no form involved.

I start this activex as a Process like so:

Dim NewProcess As Process = New Process

Then I use one of these:

Process.Start(" D:\Test\VB6\dll \MyProg.dll", CStr(Arg1) & " " &
CStr(Arg2))

Process.Start(" D:\Test\VB6\MyP rog.exe", CStr(Arg1) & " " & CStr(Arg2))

If I start the exe version all goes well. But if I start the dll version
a MsgBox pops up (and screws up the timing) with this message

"Dll RegisterServer in D:\Test\VB6\dll \MyProg.dll succeeded"

DLLs cannot be started directly except maybe using "rundll.exe ". However,
just start your executable file that uses the DLL file. This will work if
the DLL has been registered properly, which can be archieved using
"regsvr32.e xe" for use with VB6 and "regasm.exe " for use within .NET-based
applications.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Thanks for the replies Herfried and Walter.

By it's very nature the dll is registered when it's created. If I move it I
use Regsvr32 to register it. Just made me curious.

Using either the dll or the exe doesn't solve my real problem. As Walter
knows, this process makes a USB device call based on COM for speed. The
VB2005 app uses a referenced VB6 dll which contains all of the USB
interfacing code.

This works fine but the USB responses are very slow. Too slow to capture
real time data. So the one USB call that needs to be fast is in this Process
running in it's own COM thread. The problem is that the USB call returns a
status of "Device not found". A Jungo monitoring program shows no activity
on the USB connection when this takes place.

Since one of the USB setup parameters is the Main form hWdw (or whatever)
the problem may be that the separate Process is not under that hWdw. To get
help from Jungo is a problem as I let my subscription lapse ($1000+).

Galen
Dec 29 '06 #4
Hi Galen,

When a COM component is registered in registry, a full path to it is saved.
If you move it around, you need to register it again to update the path to
it.

Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Jan 2 '07 #5
However every time I run the program I get the same message. Even within the
same run, when I call for a different file to be processed, I get the same
message.

Again, this is with the ActiveX dll. I will look in RegEdit before, after
and during a run to see what changes.

Galen

"Walter Wang [MSFT]" <wa****@online. microsoft.comwr ote in message
news:RJ******** ******@TK2MSFTN GHUB02.phx.gbl. ..
Hi Galen,

When a COM component is registered in registry, a full path to it is
saved.
If you move it around, you need to register it again to update the path to
it.

Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no
rights.

Jan 2 '07 #6
Hi Galen,

Do you mean the message that prompts you that the dll is registered? If
this is the case, you can use "/s" switch to "regsvr32.e xe" to let it
register the COM dll silently.
Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Jan 4 '07 #7
Galen Somerville wrote:
I have an app using a VB6 ActiveX.dll which I also have made as an exe. Both
the dll and exe have exactly the same code and start in Sub Main. There is
no form involved.

I start this activex as a Process like so:

Dim NewProcess As Process = New Process

Then I use one of these:

Process.Start(" D:\Test\VB6\dll \MyProg.dll", CStr(Arg1) & " " &
CStr(Arg2))

Process.Start(" D:\Test\VB6\MyP rog.exe", CStr(Arg1) & " " & CStr(Arg2))

If I start the exe version all goes well. But if I start the dll version a
MsgBox pops up (and screws up the timing) with this message

"Dll RegisterServer in D:\Test\VB6\dll \MyProg.dll succeeded"
<snip>

As others pointed out, you can't "execute" a dll. A dll is a just
library of functions (or classes, in the case of COM dlls). The fact
that you had a Sub Main somewhere in code when you compiled your VB6
project into a dll doesn't change the dll's nature: the Sub Main is
just ignored (for executing purposes.It is used for the dll
initialization, if I remember correctly).

As you may know, Process.Start is used to directly run executables as
well as to launch the appropriate application related to a given file
type. If you call, for instance, Process.Start(" Sometext.txt"), the
system will look for the application associated with .txt files
(usually Notepad) and will call this application passing "Sometext.t xt"
as a parameter, just as if you had typed on the command line:

Notepad.exe Sometext.txt

What happens in your case is that there's an application associated
with the ".dll" type in your computer. When you launch
Process.Start(" D:\Test\VB6\dll \MyProg.dll" ...), the system calls that
application (probably regsrv32.exe), passing
"D:\Test\VB6\dl l\MyProg.dll" as a parameter, just as if you had typed

regsrv32 D:\Test\VB6\dll \MyProg.dll

on the command line.

Now for why would you try to "run" the dll...

It seems that the VB6 executable exposes some class(es) that you want
to use from your VB.Net app. In this case, exposing the classes from a
dll instead of an exe may give you a performance advantage. That's
because the classes created from the dll would exist in the same
address space as the .Net app. To use them from the exe, on the other
hand, would require costly interop calls. There are many issues to
consider when changing an exe into a dll, mostly related to
initialization code, window management, data persistence, to name a
few. I suppose you considered these issues and dealt with them
accordingly... =)

Now, to use the classes from the dll, you must first create a .Net
compatible wrapper assembly and reference the wrapper from your .Net
app. From what I've been reading, you'll probably achieve this by
navigating to the dll from VS 2005 Project References COM tab, or
using tlbimp to generate the .Net wrapper assembly for you and adding a
reference to the generated assembly into your VB.Net project.

HTH.

Regards,

Branco.

Jan 4 '07 #8

"Branco Medeiros" <br************ *@gmail.comwrot e in message
news:11******** *************@v 33g2000cwv.goog legroups.com...
Galen Somerville wrote:
>I have an app using a VB6 ActiveX.dll which I also have made as an exe.
Both
the dll and exe have exactly the same code and start in Sub Main. There
is
no form involved.

I start this activex as a Process like so:

Dim NewProcess As Process = New Process

Then I use one of these:

Process.Start(" D:\Test\VB6\dll \MyProg.dll", CStr(Arg1) & " " &
CStr(Arg2))

Process.Start(" D:\Test\VB6\MyP rog.exe", CStr(Arg1) & " " & CStr(Arg2))

If I start the exe version all goes well. But if I start the dll version
a
MsgBox pops up (and screws up the timing) with this message

"Dll RegisterServer in D:\Test\VB6\dll \MyProg.dll succeeded"
<snip>

As others pointed out, you can't "execute" a dll. A dll is a just
library of functions (or classes, in the case of COM dlls). The fact
that you had a Sub Main somewhere in code when you compiled your VB6
project into a dll doesn't change the dll's nature: the Sub Main is
just ignored (for executing purposes.It is used for the dll
initialization, if I remember correctly).

As you may know, Process.Start is used to directly run executables as
well as to launch the appropriate application related to a given file
type. If you call, for instance, Process.Start(" Sometext.txt"), the
system will look for the application associated with .txt files
(usually Notepad) and will call this application passing "Sometext.t xt"
as a parameter, just as if you had typed on the command line:

Notepad.exe Sometext.txt

What happens in your case is that there's an application associated
with the ".dll" type in your computer. When you launch
Process.Start(" D:\Test\VB6\dll \MyProg.dll" ...), the system calls that
application (probably regsrv32.exe), passing
"D:\Test\VB6\dl l\MyProg.dll" as a parameter, just as if you had typed

regsrv32 D:\Test\VB6\dll \MyProg.dll

on the command line.

Now for why would you try to "run" the dll...

It seems that the VB6 executable exposes some class(es) that you want
to use from your VB.Net app. In this case, exposing the classes from a
dll instead of an exe may give you a performance advantage. That's
because the classes created from the dll would exist in the same
address space as the .Net app. To use them from the exe, on the other
hand, would require costly interop calls. There are many issues to
consider when changing an exe into a dll, mostly related to
initialization code, window management, data persistence, to name a
few. I suppose you considered these issues and dealt with them
accordingly... =)

Now, to use the classes from the dll, you must first create a .Net
compatible wrapper assembly and reference the wrapper from your .Net
app. From what I've been reading, you'll probably achieve this by
navigating to the dll from VS 2005 Project References COM tab, or
using tlbimp to generate the .Net wrapper assembly for you and adding a
reference to the generated assembly into your VB.Net project.

HTH.

Regards,

Branco.
Very clear now. Process.Start, as I was using it, cannot run the dll. Yes I
am using the VB6 exe for the performance. It is using memory mapping for
speed. I interface with a USB device (proprietary) which has 99% of the USB
calls in a dll referenced by VB2005.

There is one USB call that collects Real Time data in the VB6 exe. If I
place this call in net, with the other 99%, it is way too slow. My current
problem is that, apparently, the USB device isn't recognized because it's in
a separate thread.

I think I will have to move 100% of the USB stuff to this VB6 exe with a
hidden form. The USB initialization needs an hWdw reference.

Now if I can figure out how to copy the whole VB2005 to a new location, I
can try it out. VB6 was easy, just copy all files to a new folder and make a
minor change to the vbp file.

Galen
Jan 4 '07 #9
Galen,

I'm not sure about your following question:

---------
Now if I can figure out how to copy the whole VB2005 to a new location, I
can try it out. VB6 was easy, just copy all files to a new folder and make
a
minor change to the vbp file.
---------

Would you please depict more? Thanks.

Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Jan 5 '07 #10

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

Similar topics

2
1991
by: glenn | last post by:
I have written a COM Server in C# and its working perfectly. I am not ready to deploy to client computers to begin the real testing and am now wondering how to perform. The part that confuses me is that you can not use regsvr32 to register the COM server so I'm wondering if placing it inside the .NET library will automatically take care of registering it so non managed code programs can access it or do I have to manually use the regasm...
5
3699
by: Chris Devol | last post by:
My dial-up connection sometimes hangs up and has to re-connect. The VB2005 installer/downloader apparently doesn't know how to resume when the connection is re-established. It just aborts! I've wasted many hours on this. Can the whole package be obtained at once with a "smart" download manager instead of having to use the VB2005 installer????? --
3
1878
by: Diarmuid | last post by:
I have the MS book, introducing Microsoft Visual Basic 2005 for Developers. No sample code comes with it.The location according to the book is http://msdn.microsoft.com/vbasic/VB6Migration but I don't see it there either. Anyone know where it is? Also, where would I find the 101 VB Code samples for VB2005? Or, indeed, some links to any VB2005 samples would be appreciated. Thanks Diarmuid
2
1313
by: Jerry Spence1 | last post by:
1. Is there a more suitable, dedicated newsfeed for VB2005 yet? 2. I'm confused as to which version to get. I work for a small company and we will just need VB2005 on my PC. Therefore that tends to suggest the express version, but I write some pretty complicated stuff (including SQLServer transactions, network programming etc) and I am wondering what is missing from the Express version in terms of components, functionality etc. I don't...
0
2021
by: Rich | last post by:
Hello, I just upgraded a vb2003 app to vb2005. The vb2003 app had/has a statusbar object - which contains panels and I can see the properties of the statusbar in the properties window in vb2005. But in the tools list of vb2005 I do not see a statusbar selection. Instead I see a statusStrip, and even though the Items collection has a property to set the statusStrip labels to sunken, etched,... I can see these appearances when I...
1
1661
by: erickwan88 | last post by:
I am doing a final year project for my school and is going to provide for an organization, so I am asking for some help on here. Indeed, I have no idea on how to get the input from my pen driver and use on vb2005 as when I activate the pen driver, it will run its own program itself and when I deactivate it, it become a mouse. Therefore, I need to find out how to use the pen to write words on the vb2005 program instead of being either a...
15
2023
by: Aalaan | last post by:
I am presently a user of classic vb6 and hang out on those newsgroups. Some of you may be aware that there is a very anti MS and vb2005 feeling there. I have tried to get them to tell me which features of vb2005 are actually worse then vb6 in practice, and forget the philosophy of backward compatibility for a moment. I would now like to hear "the other side". Could *anyone who previously used vb6* (only those pleased; I feel the others...
1
4432
by: Jeffrey Christiansen | last post by:
I wanted to add a toggle button to a VB2005 form to be used for a simple Windows Application (i.e. compiled to a "*.exe"), so I added the ActiveX Microsoft Forms Object toggle button, however I can't get this button does work properly. The documentation I found in the FM20.CHM files says the button state can be determined from its "Value" property, but the property list shown in VB2005 does not have a "Value" property. How is the button...
1
2243
by: Vae07 | last post by:
Ok so here is a brief summary of my problem. I need a pop up form that submits input text box information to a pocket excel workbook upon a command botton click. Text box inputs are checked for validity upon individual text box exit (don't have a problem with this part). All this could be done with Excel VBA easily, but pocket excel doesn't have VBA/Macro support. In as much, I have been trying to create a VB2005 application that I can load...
0
9029
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8897
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8867
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7732
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2332
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2006
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.