Click here to Skip to main content
Click here to Skip to main content

The Windows API: Learn It - Live It

By , 22 May 2010
 
I've noticed something since I started writing DotNet code. It seems that people aren't being taught or are simply ignorant of the Windows API, and don't know to think that far outside the box when they need to do something that more experienced programmers (people that started programming before 2001) are more ready/able to fall back to.
 
One of my favorite sites is pInvoke.net[^]. It contains invaluable information regarding the use of the Windows API via the System.Runtime.InteropServices namespace, and it contains not only the correct method prototypes, but examples for using most of the API calls.
 
Using the Windows API is an essential part of the development process regardless of what Microsoft tries to tell you.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

John Simmons / outlaw programmer
Software Developer (Senior)
United States United States
Member
I've been paid as a programmer since 1982 with experience in Pascal, and C++ (both self-taught), and began writing Windows programs in 1991 using Visual C++ and MFC. In the 2nd half of 2007, I started writing C# Windows Forms and ASP.Net applications, and have since done WPF, Silverlight, WCF, web services, and Windows services.
 
My weakest point is that my moments of clarity are too brief to hold a meaningful conversation that requires more than 30 seconds to complete. Thankfully, grunts of agreement are all that is required to conduct most discussions without committing to any particular belief system.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
QuestionAn example perhapsmemberlvcamvn27 Aug '12 - 7:49 
Can you give an example how Windows API works better?
Is it true that Windows API only works for desktop applications?
Thank you.
AnswerRe: An example perhapsmvpJohn Simmons / outlaw programmer27 Aug '12 - 23:13 
My point wasn't that it's "better". My point was that you shouldn't avoid learning it because there are times when only the Windows API offers what you need to do. Beyond that, knowing how to get to the Windows API also teaches you how to access unmanaged DLLs,
".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997

GeneralRe: An example perhapsmemberlvcamvn28 Aug '12 - 9:35 
Thanks for the clarification. I bet you are right about the unmanaged DLLs.
GeneralReason for my vote of 5 MVCmembereg_Anubhava22 Sep '11 - 18:56 
Reason for my vote of 5
MVC
GeneralWhy bother to understand anything - you can always post your...memberReiss22 Sep '11 - 4:35 
Why bother to understand anything - you can always post your problem requirements in QA and wait for someone else to do it for you Wink | ;)
 
Joking aside good tip +5
GeneralReason for my vote of 1 not really a tipmemberSledgeHammer0122 May '10 - 8:06 
Reason for my vote of 1
not really a tip
QuestionAny nice reference of vb.net-formatted declarations for API functions/structures?membersupercat918 Jan '10 - 7:54 
Is there any nice source containing definitions for all API functions and structures? It would be possible in many cases to manually create such things by examining the header files bundled with a C compiler, but that's a bit of a nuisance.
AnswerRe: Any nice reference of vb.net-formatted declarations for API functions/structures?memberJohn Simmons / outlaw programmer18 Jan '10 - 10:16 
Well, structures and parameters are listed in one of the header files athat comes with the latest windows sdk. For methods, you could use the DEPENDS utility (free utility) on all of the system DLLs. However, I've found the stuff on pInvoke.net to be fairly complete. They've never not had the API I was looking for. Some of the stuff is thin on content regarding examples, but the prototypes are pretty much all there.
 
.45 ACP - because shooting twice is just silly
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001

AnswerRe: Any nice reference of vb.net-formatted declarations for API functions/structures?mvpDaveyM6920 Jan '10 - 9:10 
I've found this[^] to be useful - does C# and VB Big Grin | :-D
 
Dave

BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Why are you using VB6? Do you hate yourself? (Christian Graus)

AnswerRe: Any nice reference of vb.net-formatted declarations for API functions/structures?memberpranav9512 Jun '10 - 19:29 
API Guide[^] is a really good resource. Provides good information on each and every function in all the APIs along with examples in Native and .NET Code(only few examples for .NET)

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web02 | 2.6.130516.1 | Last Updated 22 May 2010
Article Copyright 2010 by John Simmons / outlaw programmer
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid