Subject: Re: A simple window
From: [email-masked] (Chin Chee-Kai)

23 Feb 1997 22:26:59 -0800
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Reply-To: Chin Chee-Kai <[email-masked]>
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
X-Authentication-Warning: gatekeeper.gen.co.jp: smap set sender to <[email-masked]> using -f
Original-To: Sebastian Niesen <[email-masked]>
Original-Cc: [email-masked]
In-Reply-To: <01IFCH5FZQFMBB1GHT@mail>
Original-Sender: [email-masked]

On Wed, 12 Feb 1997, Sebastian Niesen wrote:

> I can't get a simple window to open with the latest
> version of gnuwin32.

I was working on another project and decided to try out some of 
the Win95 GUI through gnu-win32.  Here's a simple program that
opens a roughly quarter-screen size window on Win95 and bounces
it around for about 15secs (depending on your machine speed;  mine
was a 486/66MHz).  

To compile it, save the file as "testwin.c", then:
   gcc -o testwin testwin.c -luser32 -lkernel32 -lwin32spl -lcomctl32
   ./testwin

Chin Chee-Kai (Last, First)
Internet Email-ID:	[email-masked]
Gen Tech Corporation

------------------------------------------------------------------
#include <windows.h>

int main(int argc, char *argv[])
{
  HWND parent;
  HWND win;
  int i, j;
  int x, y, xinc, yinc;

  InitCommonControls();
  parent = GetActiveWindow();
  x  = 0;  y = 0;
  win = CreateWindow(ANIMATE_CLASS, "Win32", 0 /*style */,
	x /*x*/, y /*y*/,  200 /*width*/, 200 /*height*/,
	parent, NULL, NULL, NULL);
  ShowWindow(win, 1);
  SetCursor(IDC_UPARROW);
  ShowCursor(TRUE);
  BringWindowToTop(win);
  Beep(500, 100);
  j = 1;
  xinc = 40;
  yinc = 40;
  for (i = 0; i < 800; i++) {
    FlashWindow(win, j);
    j = !j;
    x	+= xinc;
    if (x >= 640) {
      x = 640;
      xinc = -xinc;
    }
    else if (x < 0) {
      x = 0;
      xinc = -xinc;
    }
    y 	+= yinc;
    if (y >= 480) {
      y = 480;
      yinc = -yinc;
    }
    else if (y < 0) {
      y = 0;
      yinc = -yinc;
    }
    MoveWindow(win, x, y, 200, 200, TRUE);
  }
  DestroyWindow(win);
  Beep(1500, 300);
}

-
For help on using this list, send a message to
"[email-masked]" with one line of text: "help".