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

Posted on 2007-08-09
Last Modified: 2013-12-17

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.
Question by:BigBoss
    LVL 13

    Accepted Solution


    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.
    LVL 85

    Assisted Solution

    by:Mike Tomlinson
    "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!

    Author Comment

    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.
    LVL 2

    Expert Comment

    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.
    LVL 96

    Expert Comment

    by:Bob Learned
    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.


    Author Comment

    Many thanks to all of you...

    Best regards.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (…
    More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    729 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

    20 Experts available now in Live!

    Get 1:1 Help Now