March 14th, 2003, 06:43 PM
very general question about win32 api progging
Hi, after a couple of years of C++ console programming i started this year to learn win32 api programming. My first impression was, "damn thank god for visual basic!!" because it was very confusing to me. all sorts of different variable types among a million other things made it feel like a new language almost. My teacher is always telling us, dont worry if u dont understand all the details, just know how to implement stuff... and that kind of annoys me, i like to know exactly what im doing, exactly what parameters i am passing etc.. so my question to u guys is, Do you know all this stuff inside and out? Or do u just look up stuff when u have to? maybe this sounds kind of confusing, so heres and example:
something like that, do u know what every variable in there does? or do u just know how to use them? i dont need an explanation of the above code, i know what it does after i study it for 15 minutes ;) , but im just curious if my teacher is right or just BSing us...
LRESULT CALLBACK MyWndProc (HWND hWnd, UINT msg,
WPARAM wP, LPARAM lP) ;
int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst,
PSTR sCmdLine, int iCmdShow)
Last edited by infamous41md; March 14th, 2003 at 06:45 PM.
March 14th, 2003, 09:27 PM
i think that your teacher was Right AND Wrong.
he was wrong because of what you said, that it is important to know what you are doing, and he was right because almost no one can know ALL about win32 api. you look up what you need when you need it. besides all the tiny details are not important when you have some wizards doing the basics for you (and i'm not talking about MFC)
as for the above code, every win32 programmer should the meaning of it.
oh, and some helpfull book:
Programming Applications for Windows / Jeffrey Richter
Programming Windows / Charles Petzold
these considered the ultimate book for API i think...
Last edited by Gmorphus; March 14th, 2003 at 09:30 PM.
"Gravitation can NOT be responsible for people falling in Love"
(one of the most significant characters in the history, can you guess?)
March 14th, 2003, 10:52 PM
hmm, well its good to know that im not gonna have to know EVERYTHING!! I was just really overwhelmed at the start of learning this stuff. It is totally different approach to learning than i've been used to. It's like, cram all this down ur throat and one day u will understand it...hopefully! All the 32 bit variables, functions with absurd numbers of parametes, ehh i could go on, but its a lot to digest at once. One thing it did make me do is appreciate VB a whole lot more! But even though VB is easier on the eyes/brain, i m gonna stick with this b/c it seems a lot more powerful than VB. Funny sidenote, i used to always hate writing comments in my code, but now i see the importance of commenting the hell out of it so i can actually understand what in god's name is goin on :D
March 14th, 2003, 11:07 PM
I'm learning C++ and I'm moving into Visual C++, and I've only learned enough windows programming to program a basic window using the win API. All I can say is, I would never get to Visual C++ and actually write some sophisticated programs if I had to learn all the windows programming stuff first. What a waste of time in my opinion. I think it has to be way more efficient to use the MFC and wizards in Visual C++ 6.0 to create windows programs and then drill down into windows programming as needed. Good luck to you. Just remember there is another way if you get bogged down and frustrated.
August 1st, 2003, 11:53 AM
^^ yeah ... he's going to get hte job ... :rolleyes: Their's something to say aobut someone who'll stick with it through hte tough times and learn something ... the payoff will be a hell of a lot bigger than use the MFC and wizards in Visual C++ ...
August 1st, 2003, 12:25 PM
Thanks for the reply to a thread thats 3 months old.
August 1st, 2003, 02:59 PM
lol where did that come from! actually 7stud, i tend to agree with some of what you said. now that i understand win32, it seems to be an incredible waste of time. i'd rather spend time developing algorithms then mucking thru all that garbage honestly. i really DISLIKE programming in win32 all together right now, this whole summer i've been working on low level networking stuff with gcc and to me its much more fun.:) but also i think MFC is garbage as well, just too abstract from what's going on for me.
August 27th, 2003, 05:08 AM
No, you are not right about Win32API programming, it is very logical and the most powerfull since all is built on top of it. It is hard at the beginning, but when you know the basics you will see that it is very simple. About the Windows types: there are the basic C types and all the other is just a #defines, for example HWND, HBRUSH, HPEN, HINSTANCE, etc are just #defines of HANDLE. DWORD,WPARAM,LPARAM,INT,LONG are also #defines of the basic C variable types. Some of them are needed only for backward compatibility with 16 bit Windows.
It's worth to know the API, because all is built on top of it, including the latest development tools like .NET. In fact learning the API is a must for every Windows programmer, if not, you are not a Windows programmer. Once you reveal the workings of the API you will know everything about Windows, frameworks, programs. For me it is not worth to learn a framework, learn the API and you will know to work with any framework. MFC is a thin wrapper over the API and when it was created it was intended for proficient Windows C API programmers just to speed up development, so it is not right to start with MFC, because you will trip up on every next step. To be a good MFC programmer you will need to know the API first. I prefer writing programs at the API with ANSI C, since it is not confusing and bloated like most of the frameworks, you can define your application architecture and have the freedom to do anything you want in any way you want.
When i started with the API i was feeling just like you looking at an enormous extraneous code and i was just about giving up, so there is such a period at the beginning, but i carried on learning and now i think knowing the API is invaluable.
Read "Programming Windows 5th Edition" by Charles Petzold as a start and you will feel more comfortable. Also check the Platform SDK at the MSDN. There is a detailed description of all the services that the Windows OS provides to programmers.
August 27th, 2003, 08:58 AM
LOL! "Read Programming Windows by Charles Petzold as a start..." It's like 1200 pages! Most all of if very technical. Not exactly bedside reading, though I will say it is an excellent reference, and I do own a copy. My advice is to stick with the class you're taking-- You'll get an overview how to do things, and smattering of understanding that can be expanded on. Enough to be able to open to any chapter or section in that book and have a decent understanding of what it's telling you. Over time you'll need the book less and less. I guess the moral is that there's no quick way to learn win32 API. It's just too big.
August 27th, 2003, 01:33 PM
well...drag up the dead and sing them a song! i still stand by what i said, i have learned all the variables, i know the API fairly well, and i have absolutely no interest whatsoever in furthering my studies in this area. one of the ony things that i actually liked and found useful in win32 was the WSAASyncSelect() function and the ability to recieve asynchronous socket messages so easily. of course this is all jsut personal opinion and i respect yours, but i'd much rather gcc and gdb anyday over MSVC++