Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Can one program native (Win32) code in Visual Basic .NET?

Posted on 2006-07-06
4
Medium Priority
?
352 Views
Last Modified: 2010-08-05
Hello,

I do not have much experience with .NET, but I do program in VB 6.  Can I still use Visual Basic .NET to program for Win32 and not the .NET or CLR environments?

If so, how?  I will be using Visual Studio 2003.

Thanks,

Todd
0
Comment
Question by:toddsab
  • 2
4 Comments
 
LVL 52

Assisted Solution

by:Carl Tawn
Carl Tawn earned 800 total points
ID: 17054852
Simple answer: No.

You can with VC++ but not VB.Net. You can access the Win32 API's but your app will still be dependent on the .Net framework.
0
 
LVL 64

Accepted Solution

by:
Fernando Soto earned 1200 total points
ID: 17055654
Hi toddsab;

There is a tool which will turn a VB .Net assembly into a Native Image called NGen.exe. Even though you turn it into a Native Image the assembly, IL code is still needed. Also; A native image is a file containing compiled processor-specific machine code. Note that the native image that Ngen.exe generates cannot be shared across Application Domains. Therefore, you cannot use Ngen.exe in application scenarios, such as ASP.NET, that require assemblies to be shared across application domains. The application using Native Image will load faster but also true is that certain function may run a little slower.

The tool may be found in c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\ngen.exe for version 1.1 of the framework and c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\ngen.exe for version 2.0 of the framework.

Here is a link to the Microsoft Documentation. Read the pros and cons of using it. http://msdn2.microsoft.com/en-us/library/6t9t5wcf.aspx


Fernando
0
 

Author Comment

by:toddsab
ID: 17058045
Thank you for your answers, I learned a lot.

I want to learn .NET and provide a solution using .NET, but at the same time I find it awkward to have to impose to users that they load the framework onto their computer.  It just gives me an uneasy feeling.  Am I wrong?

I guess I would be more comfortable if I knew a good portion of Windows users had the framework installed on their systems.

Regards,

Todd
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 17058311
A good proportion probably have, version 1.1 at least.

.Net framework is no big deal, its not different to having to install the VB6 runtime or the C runtime for MFC.
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month9 days, 14 hours left to enroll

926 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question