[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 213
  • Last Modified:

What I can do using Windows API, that I can not do using native .NET code?


This may appear as a bit strange question, but I would really like to know the answer to it!

The question is:
Is there something that I can do using only Windows API (from say VB6), which I can not do using pure managed code (native code) in VB.NET or C#.NET?
Or put it the other way: Using VB.NET or C#.NET native managed code, can I do absolutely everything that I can do using Windows API?
In other words, do I have the ENTIRE functionality of the  Windows API, using pure VB.NET or C#.NET managed code (native code)?

Thank you.
2 Solutions

There are a lot of things you cannot do using .NET managed code which you can using API.

Some functions will be:
Getting the handle of active window or other special windows like the desktop.
Sending messages and commands to other windows and applications.
Setting the cursor position to a specific point.
Mike TomlinsonMiddle School Assistant TeacherCommented:
"In other words, do I have the ENTIRE functionality of the  Windows API, using pure VB.NET or C#.NET managed code (native code)?"

No, the .Net framework does NOT encapsulate every single Win API that is available in the operating system.

Some big ones:

(1) Global Keyboard and Mouse Hooking
(2) System Wide Hotkeys
(3) Hooking/Subclassing an External applications windows
(4) Manipulation of External application windows such as moving windows, changing window states, enumerating child controls of a specific window, etc...
(5) Many, many more...too many too list!
BigBossAuthor Commented:
iHadi, thank you for your comment! Greatly appreciated!
I would like to hear from some other experts, please!
Can anyone add to these indicated by iHadi?

Thank you.
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

I think the responses above are enough. Just would like to comment that despite these functionalities are not available when using managed code (.NET), you can still use P/INVOKE to call unmanaged code that does the work you need. Take a look at the System.Runtime.InteropServices namespace.
Bob LearnedCommented:
It is easier to know what it can do, than what it can't:

Microsoft Win32 to Microsoft .NET Framework API Map

This is an old article and applies to 1.1, but you get the idea.

BigBossAuthor Commented:
Many thanks to all of you...

Best regards.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now