From: cclark@trentu.ca (J. Chris Clark)
Subject: Re: Windows Programming
News-Software: VAX/VMS VNEWS 1.41    
Organization: Trent University Computer Services Department
Date: Thu, 12 Nov 1992 02:48:00 GMT

In article <BxKuI1.162@mach1.wlu.ca>, wool8657@mach1.wlu.ca (john woolsey 9209 U) writes...
>...I am doing in windows. My problem is this. Every time I run the create
>windows program it cashes with a segmentation fault. The kernel catches it,
>but it doesn't help my program to work. I think that I am somehow defining
>some variables wrong that are crashing the machine (brilliant eh :-)


Off the top of my head, are you indiscriminately using pointers?  Windows does
it's own memory management and things get moved behind the scene, so you may
have problems using pointers (if you are).  Granted the Borland OWL seems to
use pointers all over the place, but still...

>When creating a window Class. I am having difficulty. I am unsure on what to
>use for an hInstance, hIcon, and hCursor value. I have basically made up
>numbers with varying results for all of them. I also do not know what to do
>with the variable lpszMenuName. These variables are all from the record used
>in RegisterClass call, which should be standard from all forms of windows
>libraries.

Um...
Ever thought of investing $40 in a good book?  These are some of the most
basic things in Windows.  If you don't understand them, you're not going to 
get very far.  Here's some help, though:
lpszMenuName is a pointer to a string which contains the name of a menu in 
the resource script file (if you don't know what a .rc file is, BUY A BOOK!)
which you want bound to this window.
hInstance is a handle to the application instance.  Windows makes a distinction
between a window and the overall application program.   This can't be NULL
if you want the program to work (at least for the main window and I'm pretty
sure every window).  I've been using OWL, so don't know all the details, but
I believe it is used in conjunction with the callback function--I could be
entirely wrong here, though.  No flames please.
The hIcon and hCursor are also handles to resources.  They indicate which
graphics image should be used for the default cursor (mouse image) and icon.

[Stuff deleted]

>Basically I can't create a window using the standard routines, and I am
>frustrated. I have found a lot of neat little toys that would come in handy,
>and I am pretty sure that I understand how they work, but on most of these
>variables I have little idea where to start, or which one is causing the
>program to crash uncerimoniously. I can create a window with the object
>oriented fation, but there are many things I can't do if I go through that
>method.

I agree that OWL makes some things really difficult (conceptually at the least).
I'm not sure if OWL is what you are talking about, though...
Windows is a quasi-OOP system, though, so you're going to have to embrace some
Object Oriented ideas.  The biggest hurdle though is understanding the message
based nature of Windows.
As I said before:  Buy a book!
You can't just dabble in Windows and pick it up like you can with C.  It isn't
just a language, but a whole "way of thinking".

Hope some of this helps.

Chris C.

flames > /dev/nul