Solved

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

Posted on 2006-07-06
4
342 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 200 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 62

Accepted Solution

by:
Fernando Soto earned 300 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

911 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now