
Now you might be thinking of what is FindWindow and what it does for us. In above statement we are trying to use FindWindow function of declaring such a function we prefix extern keyword with that, which indicate that the declared function is an external function. NET you have to declare that function in your program. This statement will import the user32.dll in your program after that you can make use of its function in your program.īefore using any external function in. Let us discuss the code: In above code I have taken two namespace one of them is, Which is useful when you are interacting with external application. Public static extern Int32 FindWindow(String lpClassName,String lpWindowName) So by use of namespace in your application you get some functionality by which you can make a call to external application. NET has Interop Services to work with external DLL's. Let us start with API Declaration, As I mention earlier. I am covering these usage is some steps them we will go and discuss some live example which will show you beauty of Win32 API.
NET application to enjoy the luxury of Win32 API.
Now I am coming to how can use these Win32 API in your. There are many more API are available which you can use in your programming.
Winmm.dll - does all the groovy multimedia thingies. Comdlg32.dll - holds all regular dialog boxes, etc. These three files are collectively known as the 'Win32 API' - in other words, the main collection of accessible Windows 95/98 code.īut there are a few other DLL files available too, including: Gdi32.dll - involved in graphical whatnots. Kernel32.dll - file operations, memory management. User32.dll - handles user interface stuff. These basic win32 API's are splits into three different flavors, depending on code resides in them. The windows API resides in the DLL's like User32.dll, GDI32.dll, Shell32.dll etc in the windows system directory. Say for example when you press a button on the form, windows sends a message to your windows procedure that eventually hidden from the user. Whenever you perform any task in window, it gets executed by giving one or more calls to windows API. NET we can call Win 32 API using platform Interop Services, which resides at namespace. Other languages just act as a shell to provide an automated and easier way to access APIs. It is something like the native code of Windows. Every user action causes the execution of several or more API function telling Windows what's happened. Now you might have question in your mind that What is API?ĪPI (Application Program Interface) is a set of predefined Windows functions used to control the appearance and behavior of every Windows element (from the outlook of the desktop window to the allocation of memory for a new process). Using these API you can perform direct operation in windows, which increases performance of your application. Windows exposes lots of functionality in the form of Win32 API.