This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: A simple window


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:	cheekai@gen.co.jp
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
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]