Another programming question...

Wanna understand E=mc2, English grammer, or maybe just build a computer? We can help!

Moderator: Moderators

Post Reply
XMEN Ashaman DTM
Inmate
Posts: 2369
Joined: Mon Oct 02, 2000 12:09 am
Location: Silverdale, WA

Another programming question...

Post by XMEN Ashaman DTM »

How do you compile a program for windows if you don't have the MS windows.h or windows.c (or the files that are referred to in windows.h)?<br><br><br>I was thinking about this a bit today and yesterday and did a bit of poking around. It seems that there is a windows header file posted in the MS visual studio sdk pages. I'm not sure if this is the file that would be needed though. Problem is, that I've needed it for compiling stuff at work.<br><br>I guess what I'm asking is <!--EZCODE ITALIC START--><em>why</em><!--EZCODE ITALIC END--> is it needed? What's it used for? I know the obvious answer is that it's needed for the program to interface with windows. But is there more than that?<br> <p></p><i></i>
User avatar
XMEN Gambit
Site Admin
Posts: 4122
Joined: Thu Nov 18, 1999 12:00 am

Re: Another programming question...

Post by XMEN Gambit »

Um, if your program is going to run in windows, and is not a console app, then you need to be able to define memory structures such as a window itself. You'd need a window struct (since we're talking C and not C++) that contains things like width, height, screen position, title, etc. and at the right places. You also have to tie into the message handler. Since everything in windows is event-driven (mouse clicks, etc) there's a loop in the system that doles out messages to your application when your window has focus. So the message handler has to know about your window, and it has to know about your app, and so these (standardized) connections are made with the things you find in these files, like window structs, messages, and your application's equivalent of a main() routine and/or its own message loop.<br><br>True, you don't strictly need those files, but you'd have to duplicate a lot of the stuff in there if you want a working Windows application when you're done. The windows SDK is pretty much a necessity unless you want to get into the nightmare that writing an windows app in assembly would be. Even then you'd need to know the memory structures to set up.<br><br>(It's actually been done, but it was the windows equivalent of "Hello, world" and just to prove it's possible.)<br><br><br> <p><!--EZCODE IMAGE START--><img src="http://www.xmenclan.org/xmengambit.gif"/><!--EZCODE IMAGE END--><br>XMEN member<br>Card-carrying DTM<br>OKL Fish-napper<br><br>Though a program be but three lines long, someday it will have to be maintained.<br><!--EZCODE ITALIC START--><em> The Tao of Programming</em><!--EZCODE ITALIC END--></p><i></i>
Image
Post Reply