delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/02/23/22:26:59

From: cheekai AT gen DOT co DOT jp (Chin Chee-Kai)
Subject: Re: A simple window
23 Feb 1997 22:26:59 -0800 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <Pine.3.07.9702241340.A5968-b100000.cygnus.gnu-win32@sumimasen.gen.co.jp>
Reply-To: Chin Chee-Kai <cheekai AT gen DOT co DOT jp>
Mime-Version: 1.0
X-Authentication-Warning: gatekeeper.gen.co.jp: smap set sender to <cheekai AT gen DOT co DOT jp> using -f
Original-To: Sebastian Niesen <Sebastian DOT Niesen AT post DOT rwth-aachen DOT de>
Original-Cc: gnu-win32 AT cygnus DOT com
In-Reply-To: <01IFCH5FZQFMBB1GHT@mail>
Original-Sender: owner-gnu-win32 AT cygnus DOT com

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 AT gen DOT co DOT 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 AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019