• Пожаловаться

Brook Miles: theForger's Win32 API Tutorial

Здесь есть возможность читать онлайн «Brook Miles: theForger's Win32 API Tutorial» весь текст электронной книги совершенно бесплатно (целиком полную версию). В некоторых случаях присутствует краткое содержание. категория: Программирование / на английском языке. Описание произведения, (предисловие) а так же отзывы посетителей доступны на портале. Библиотека «Либ Кат» — LibCat.ru создана для любителей полистать хорошую книжку и предлагает широкий выбор жанров:

любовные романы фантастика и фэнтези приключения детективы и триллеры эротика документальные научные юмористические анекдоты о бизнесе проза детские сказки о религиии новинки православные старинные про компьютеры программирование на английском домоводство поэзия

Выбрав категорию по душе Вы сможете найти действительно стоящие книги и насладиться погружением в мир воображения, прочувствовать переживания героев или узнать для себя что-то новое, совершить внутреннее открытие. Подробная информация для ознакомления по текущему запросу представлена ниже:

libcat.ru: книга без обложки

theForger's Win32 API Tutorial: краткое содержание, описание и аннотация

Предлагаем к чтению аннотацию, описание, краткое содержание или предисловие (зависит от того, что написал сам автор книги «theForger's Win32 API Tutorial»). Если вы не нашли необходимую информацию о книге — напишите в комментариях, мы постараемся отыскать её.

Visit Software! Code North This tutorial attempts to get you started developing with the Win32 API as quickly and clearly as possible. It's meant to be read as a whole You may use this tutorial for absolutely no charge, however there are costs associated with hosting it on the web. If you found it to be of use to you and want to give something back, I would be grateful for donations of any amount to help pay for this website. This page gets approximately 11 thousand hits a month, and it adds up after a while :) Enjoy the tutorial, Brook I would like to thank the following for the contributions they've made: Yih Horng, Todd Troxell, T Frank Zvovushe, Suzanne Lorrin, Seth McCarus, Crispina Chong, John Crutchfield, Scott Johnstone, Patrick Sears. As well as those who have simply written to say they've found the tutorial useful. It's much appreciated! Welcome to Version 2.0 of theForger's Win32 API Tutorial

Brook Miles: другие книги автора


Кто написал theForger's Win32 API Tutorial? Узнайте фамилию, как зовут автора книги и список всех его произведений по сериям.

theForger's Win32 API Tutorial — читать онлайн бесплатно полную книгу (весь текст) целиком

Ниже представлен текст книги, разбитый по страницам. Система сохранения места последней прочитанной страницы, позволяет с удобством читать онлайн бесплатно книгу «theForger's Win32 API Tutorial», без необходимости каждый раз заново искать на чём Вы остановились. Поставьте закладку, и сможете в любой момент перейти на страницу, на которой закончили чтение.

Тёмная тема

Шрифт:

Сбросить

Интервал:

Закладка:

Сделать

What's New

First of all, this isn't a sequal to the original, it's a replacement. As such, there isn't really a whole lot of new stuff if you already know everything in the first one, sorry :(

So what's changed? Obviously the format is different, I've split it up into multiple sections to make it easier to view peice by peice, some people liked the one page style, some people didn't, but this way makes it a bit easier to maintain I think.

It also looks better :) I've put slightly more thought into the way it looks, still not fancy or anything, but it's better than before.

One important improvement is the fact that all the code works without changes in VC++, which should cut down on confusion a lot. The last one was written while I was using Borland C++ (not C++ Builder) and so certain minor details needed changing to work under VC++, mostly type casts. To an experianced programmer this is trivial and wouldn't present a problem, but if you're new to this (and pretty much anyone reading this is) then it can be a confusing setback, and you might accuse me of making a mistake, which I assure you never happens :D

I've also provided VC++ project files for the examples so you don't need to fumble through making your own to compile them.

As well as being VC++ friendly, I will be testing all of the examples with the Borland C++ command line tools (the free ones, see Appendix) to make sure they compile without errors, and I will provide makefiles for those of you using this compiler. If you use something like LCC-Win32 or cygwin, you're on your own, but all of the code does work, you might just need to tweak things for compatibility. Anyone who uses these compilers, feel free to send me updated files if you needed to change anything to get it to work and I will post it for others.

Basics

Getting Started

What this tutorial is all about

This tutorial is intended to present to you the basics (and common extras) of writing programs using the Win32 API. The language used is C, most C++ compilers will compile it as well. As a matter of fact, most of the information is applicable to any language that can access the API, inlcuding Java, Assembly and Visual Basic. I will not however present any code relating to these languages and you're on your own in that regard, but several people have previously used this document in said languages with quite a bit of success.

This tutorial will not teach you the C language, nor will it tell you how to run your perticular compiler (Borland C++, Visual C++, LCC-Win32, etc…) I will however take a few moments in the appendix to provide some notes on using the compilers I have knowledge of.

If you don't know what a macro or a typedef are, or how a switch() statement works, then turn back now and read a good book or tutorial on the C language first. Important notes

Sometimes throughout the text I will indicate certain things are IMPORANT to read. Because they screw up so many people, if you don't read it, you'll likely get caught too. The first one is this:

The source provided in the example ZIP file is not optional!I don't include all the code in the text itself, only that which is relevant to whatever I'm currently discussing. In order to see how this code fits in with the rest of the program, you must take a look at the source provided in the ZIP file.

And here's the second one:

Read the whole thing!If you have a question during one section of the tutorial just have a little patience and it might just be answered later on. If you just can't stand the thought of not knowing, at least skim or search (yes computers can do that) the rest of the document before asking the nice folks on IRC or by email.

Another thing to remember is that a question you might have about subject A might end up being answered in a discussion of B or C, or maybe L. So just look around a little.

Ok I think that's all the ranting I have to do for the moment, lets try some actual code.

The simplest Win32 program

If you are a complete beginner lets make sure you are capable of compiling a basic windows application. Slap the following code into your compiler and if all goes well you should get one of the lamest programs ever written.

Remember to compile this as C, not C++. It probably doesn't matter, but since all the code here is C only, it makes sense to start off on the right track. In most cases, all this requires if you add your code to a .c file instead of a .cpp file. If all of this hurts your head, just call the file test.c and be done with it.

#include

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {

MessageBox(NULL, "Goodbye, cruel world!", "Note", MB_OK);

return 0;

}

If that doesn't work, your first step is to read whatever errors you get and if you don't understand them, look them up in the help or whatever documents accompany your compiler. Make sure you have specified a Win32 GUI (NOT "Console") project/makefile/target, whatever applies to your compiler.Unfortunately i can't help much with this part either, as errors and how to fix them vary from compiler to compiler (and person to person).

You may get some warnings about you not using the parameters supplied to WinMain() . This is OK. Now that we've established you can in fact compile a program, lets go through that little bit of code….

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

WinMain() is windows equivalent of main() from DOS or UNIX. This is where your program starts execution. The parameters are as follows:

HINSTANCE hInstance

Handle to the programs executable module (the .exe file in memory)

HINSTANCE hPrevInstance

Always NULL for Win32 programs.

LPSTR lpCmdLine

The command line arguments as a single string. NOT including the program name.

int nCmdShow

An integer value which may be passed to ShowWindow() . We'll get to this later.

hInstance is used for things like loading resources and any other task which is performed on a per-module basis. A module is either the EXE or a DLL loaded into your program. For most (if not all) of this tutorial, there will only be one module to worry about, the EXE.

hPrevInstance used to be the handle to the previously run instance of your program (if any) in Win16. This no longer applies. In Win32 you ignore this parameter.

Calling Conventions

WINAPI specifies the calling convention and is defined as _stdcall . If you don't know what this means, don't worry about it as it will not really affect us for the scope of this tutorial. Just remember that it's needed here.

Win32 Data Types

You will find that many of the normal keywords or types have windows specific definitions, UINT for unsigned int , LPSTR for char* etc… Which you choose is really up to you. If you are more comfortable using char* instead of LPSTR , feel free to do so. Just make sure that you know what a type is before you substitute something else.

Just remember a few things and they will be easy to interpret. An LP prefix stands for Long Pointer . In Win32 the Long part is obsolete so don't worry about it. And if you don't know what a pointer is, you can either 1) Go find a book or tutorial on C, or 2) just go ahead anyway and screw up a lot. I'd really recommend #1, but most people go with #2 (I would :). But don't say I didn't warn you.

Читать дальше
Тёмная тема

Шрифт:

Сбросить

Интервал:

Закладка:

Сделать

Похожие книги на «theForger's Win32 API Tutorial»

Представляем Вашему вниманию похожие книги на «theForger's Win32 API Tutorial» списком для выбора. Мы отобрали схожую по названию и смыслу литературу в надежде предоставить читателям больше вариантов отыскать новые, интересные, ещё не прочитанные произведения.


Борис Акунин: Квест. Tutorial
Квест. Tutorial
Борис Акунин
libcat.ru: книга без обложки
libcat.ru: книга без обложки
Oskar Andreasson
libcat.ru: книга без обложки
libcat.ru: книга без обложки
Неизвестный Автор
libcat.ru: книга без обложки
libcat.ru: книга без обложки
Dimitrios Christopoulos
Oskar Andreasson: Iptables Tutorial 1.1.19
Iptables Tutorial 1.1.19
Oskar Andreasson
Отзывы о книге «theForger's Win32 API Tutorial»

Обсуждение, отзывы о книге «theForger's Win32 API Tutorial» и просто собственные мнения читателей. Оставьте ваши комментарии, напишите, что Вы думаете о произведении, его смысле или главных героях. Укажите что конкретно понравилось, а что нет, и почему Вы так считаете.