I created a C# dll using Visual Studio 2010.
I'm able to register it using regasm. I also used [ComVisible(true)] for my class.
The issue is, I'm not able to access this dll from VBScript.
I remeber there was a setting in the Project | Properties screen.
What is that setting? Or is there another way?
see this excellent post on creating COM components using Visual C#.NET
http://blog.stevedoria.net/20051008/creating-com-components-using-visual-csharp-dot-net
Related
I'm not that advanced with C# and need some assistance compiling a code. Honestly it's first time I'm doing that. I have a code that is aimed to automatically block rdp bruteforce.
Here is acode I'm trying to compile: https://pastebin.com/CJEapWyi
I've got problems interacting with firewall api.
In the internet people say I have to add reference to FirewallAPI.dll and I'm compiling code using following CLI:
c:\Windows\Microsoft.NET\Framework\v4.0.30319>csc.exe /r:"c:\windows\system32\FirewallApi.dll" c:\Users\Administrator\Documents\rdpbrute.cs
and it says:
error CS0006: Metadata file 'FirewallApi.dll' could not be found
Is there any way to compile a program that interacts with firewall using this compiler or I have to install visual studio?
Thanks for your time.
Instead of referencing c:\windows\system32\FirewallApi.dll you should first create COM interop library Interop.FirewallApi.dll and then add reference to it.
Interop library can be created with use of tlbimp.exe tool that is part of Visual Studio installation. A more simple approach is to use Add reference feature inside of VS (just select c:\windows\system32\FirewallApi.dll and interop library will be created automatically).
So you have to install VS as you suggested.
I want to apply dll to my aspx (with code behind), I didn't create a project, just opening the aspx and cs file using visual studio 2012
http://www.microsoft.com/en-us/download/details.aspx?id=8422
Microsoft Developer Support OLE File Property Reader (the dsofile.dll)
I'm trying to read the file properties by using this dll.
What is the easiest and fastest way to import this dll without using add reference in visual studio?
i put the dsofile.dll under the bin folder, and use "using DSOfile", but the dll not been found.
It says here:
The Dsofile.dll sample file is an in-process ActiveX component for
programmers that use Microsoft Visual Basic .NET or the Microsoft .NET
Framework.
These articles will tell you what to do:
Calling COM Components from .NET Clients
C# 4.0, the Dynamic Keyword and COM
I have been trying to monitor video memory for a highly performance intensive program.
So I used the NVIDIA CUDA libraries in a C++ Visual Studio Application to collect the data I need.
Unfortunately I need a package that can be used with Ruby, C# and the Software Testing tools my company has.
So I decided to compile a C++ DLL and import it into a C# Visual Studio Project for testing.
I was able to compile the DLL but importing it into my Visual C# Program has been an issue.
I right Click on References -> Add Reference. Then I click on the Browse tab and browse to the location of my DLL; "TestProgram.dll" and I click "OK"
Then I get the following Error message "A reference to C:.... could not be added. Please make sure that the file is accessible, and that it is a valid assembly or COM component."
What I have tried so far:
1. Importing the DLL from several different locations on my system.
2. Moving the DLL into my Solution Explorer and importing it
3. Using the "Invoke" method: [DllImport("PathToMyDll")]
4. Using the "Invoke" method with just my dll name.
5. Typing 'using' path to my DLL
6. Exporting the dll as a .lib file instead
What am I doing wrong? I thought that if I exported a DLL using Visual Studio 2010 then surely that same DLL could be Added into a Visual Studio 2010 project.
Well, is it a valid Assembly or COM component? Just because it's a C++ DLL doesn't mean it can be used with just a reference, in fact, most can't. It needs to be a managed DLL or a COM object. If it's none of those, then you have to invoke unmanaged code from a managed assembly. That means defining each function in a stub.
More info here: how to call a C++ dll exported function from c#
Be aware, you also have to deal with 64/32 bit issues, since if the DLL is compiled for 32 bit, you can't use it in a 64 bit application.
I found the solution to this problem. CUDA creates a Windows Console Application project. So the solution was to just use that instead of a DLL.
This worked well because Ruby, Test Complete and Visual C# can read the output from a basic .exe console program (with some work).
The compiled exe is simple. All I need to do is pass in an integer as an argument when I launch the program and the program will get the data I need from my NVIDIA card.
The challenge now will be finding a good way to interface with the .exe.
I have a C# class library which I also use via COM Interop. To test the library I added a C# test app to the solution, set it to the startup project and I can test it that way. The library works fine this way but one function is not working when called via COM Interop from a Visual C++ 6 test application. How do I debug the library in this situation? I searched for a solution on Google but the only advice I can find is to add a test app to the solution which of course I can't do in this situation.
EDIT: Very sorry. I forgot to say the Visual C++ test application is Visual C++ 6.
First, open boot Visual Studio and Visual C++. Start your test application in VC++. After that, in VS, open the Debug menu and choose the Attach to process. This will show you a list of current process that are running, choose the one corresponding to your test application and click on Attach. This will enabled you to put breakpoint and debug your DLL.
I created a COM C++ and register it in the Windows system.
Now, If I'm creatine a C++ application and would like to load it and call the function objects, I'm using the CoCreateInstance function.
What should I do instead that if I want to create .NET (C#) application and load the COM C++?
Thanks
Assuming you are using Visual Studio:
Right click on your project, then select "Add Reference". In the following dialog, just select the Tab "COM". There you can select your COM library, Visual Studio will take care of creating an Interop assembly and you can start using your library from C#.