Вот блин, перед экзаменом тренеруюсь... ещё надо негативные эффекты описать будет.
Windows API: Хорошо или плохо?
Many peope believe, that using Windows API function in programming has a lot of negative effect such as low reliability or operating system dependence. Some people think, that even a small error may cause an application crash. But everything has its advantages and disadvantages. Moreover, nothing will work properly if it is used incorrectly. I am sure, using Win32Api in programming has many benefits, because it works
fast, it opens up new possibilities and it allows to reduce the size of an executable file.
Firstly, API functions work much faster than their standard visual basic analogues. Written on best compillers and optimized for speed by highly skilled programmers, API functions guarantee the excellent perfomance. Using API for game creation or working with large value of information may accelerate your program by a factor of two or even more. For example, using BitBlt function to draw a picture instead of standard vb function will make your program executing three times more faster than usual. This is why it is so widely used nowadays in game creation. In addition, you can use API if you work with great values of data. For instance, if you have a list, which contains hundreds of items and you need to find one of them, you can use SendMessageByString function to find needed item five times more faster than using cycle. Thus, API allows you to make your programs much faster.
In addition to working fast, API functions open up a lot of new possibilities.Visual Basic was created as a relyable and compatible compiller and this is why it lost some if its functions. API allows you to make up this deficiency and you will get acces to new properties and events of standard controls, which you could not use directly in VB. For example, SetWindowLong is a function, that can modify standard control such as button
as you need to improve your program's interface. Moreover, it can help you to modify the appearence of another application! In addition, API allows to get an extended information about hardware, system parametres
and tools or to set them. SystemParametresInfo, for exmaple, is one of these functions which can help you to modify the appearence and actions of windows. Moreover, API allows you to edit the system registry, what
is impossible via vb functions. Thus we see, API functions can be widely used to open up new possibilities.
Finally, using API finctions allows you to reduce the size of your executable file. If you call an API function, you load a code from standard DLL files, which exist on each computer. This is why it is not necessery
anymore to include the same code in each EXE file. You just need to do a few declarations. It can also help you not to include OCX controls and replace it by windows functions. For instance, if you work with network,
you just declare needed API functions to avoid adding Winsock component.
In conclusion, I like Win32API, because it help me to optimize my program to work faster, to discover new abilities and to make my exe file smaller. I am sure, API is the best way to program, so it should be widely
used.
Ответить
|