Solved

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

Posted on 2006-07-06
4
341 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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 …
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

707 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

12 Experts available now in Live!

Get 1:1 Help Now