Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Your password is pitifully obvious.


devel / comp.os.ms-windows.programmer.win32 / simple 80 * 25

SubjectAuthor
* simple 80 * 25Paul Edwards
`* simple 80 * 25JJ
 `* simple 80 * 25Paul Edwards
  `* simple 80 * 25Uwe Sieber
   `* simple 80 * 25Paul Edwards
    `* simple 80 * 25Paul N
     `* simple 80 * 25Paul Edwards
      `* simple 80 * 25Paul Edwards
       `- simple 80 * 25Paul Edwards

1
simple 80 * 25

<cdd721b8-3271-4d50-ad0e-2116895c9929n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=9915&group=comp.os.ms-windows.programmer.win32#9915

  copy link   Newsgroups: comp.os.ms-windows.programmer.win32
X-Received: by 2002:a05:622a:1314:b0:403:b55e:d4b2 with SMTP id v20-20020a05622a131400b00403b55ed4b2mr91914qtk.9.1689741164038;
Tue, 18 Jul 2023 21:32:44 -0700 (PDT)
X-Received: by 2002:a05:6808:20a9:b0:39e:9757:6263 with SMTP id
s41-20020a05680820a900b0039e97576263mr2492264oiw.0.1689741163533; Tue, 18 Jul
2023 21:32:43 -0700 (PDT)
Path: i2pn2.org!rocksolid2!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.os.ms-windows.programmer.win32
Date: Tue, 18 Jul 2023 21:32:43 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=136.158.103.73; posting-account=CeHKkQoAAAAowY1GfiJYG55VVc0s1zaG
NNTP-Posting-Host: 136.158.103.73
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <cdd721b8-3271-4d50-ad0e-2116895c9929n@googlegroups.com>
Subject: simple 80 * 25
From: mutazi...@gmail.com (Paul Edwards)
Injection-Date: Wed, 19 Jul 2023 04:32:44 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 8627
 by: Paul Edwards - Wed, 19 Jul 2023 04:32 UTC

I remembered that a long time ago I wrote a very simple
Win32 graphics program. I can't remember where I got
the concepts from. I'm pretty sure this was before I was
even on the internet.

Original source is here:

https://sourceforge.net/p/mvs380/mvssrc/ci/master/tree/ozpd/c/simpwin.c

And I have made modifications (below) after consulting some
online documentation.

I was able to see that I got a stack of messages.

However, if I press a key, I don't get a WM_CHAR message.

And when I move the window, I don't get another WM_WINDOWPOSCHANGED message.

Which suggests to me that there is something technically
incorrect about my original simple program, even though
it nominally works (ie if you don't inspect the messages
that are being received and given to the default handler).

So the first thing I'd like is for that bug to be fixed.

It's a simple program. I'm not trying to win Miss America
(any such competition can be done another day). But I
do want it to be technically correct.

I also want it to conform to Win32s 1.25 (the last version
to be supported by OS/2) as well as Windows 11.

After that I can see (via experimentation) that I am currently
getting proportional fonts, when I actually want console
fonts I believe. But any fixed width font will do (highest
quality for 80 * 25 to help distinguish between B and 8).

Note that when the keyboard is actually working, I will want
a fullscreen window, not the default one that I am apparently
getting now.

Note that I am after simplicity, so if an application wants to
print a single character, and my handler updates a 80 * 25
buffer and repaints the entire screen - that's perfectly fine.
If there is an alternative that is almost as simple and much
more efficient, that's fine too.

The goal is to get my 32-bit Win32 console back, on two
environments where that is gone/difficult.

Also I'm guessing that to position on the second row, I
need to divide the number of pixels high (from WM_SIZE)
by 25. And it would be convenient to do the same for
width and use TextOut one character at a time. This would
circumvent the problem of proportional fonts too, but
perhaps not the best solution.

Current code below.

Thanks. Paul.

/*********************************************************************/
/* */
/* This Program Written by Paul Edwards. */
/* Released to the Public Domain */
/* */
/*********************************************************************/
/*********************************************************************/
/* */
/* simpwin - the simplest windows program (roughly speaking) */
/* */
/*********************************************************************/

#include <stdio.h>

#include <windows.h>

LONG FAR PASCAL simpwin(HWND hwnd, WORD msg, WORD wparam, LONG lparam);

int WINAPI WinMain(IN HINSTANCE inst,
IN HINSTANCE previnst,
IN LPSTR cmd,
IN int cmdshow)
{ WNDCLASS wndClass = { 0, (WNDPROC)simpwin, 0, 0, 0, NULL, NULL,
(HBRUSH)(COLOR_WINDOW+1), "simpwin", "simpwin" };
HWND hwnd;
MSG msg;
(void)previnst;
(void)cmd;
wndClass.hInstance = inst;
RegisterClass(&wndClass);
hwnd = CreateWindow("simpwin", "Simple Windows",
WS_SYSMENU,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, inst, NULL );
ShowWindow(hwnd, cmdshow);
UpdateWindow(hwnd);
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return (msg.wParam);
}

LONG FAR PASCAL simpwin(HWND hwnd, WORD msg, WORD wparam, LONG lparam)
{ int calldefault = 1;
LONG ret = 0;

switch (msg)
{
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc;
RECT rect;

hdc = BeginPaint(hwnd, &ps);
GetClientRect(hwnd, &rect);
/* DrawText(hdc, "Hello There", -1, &rect,
DT_SINGLELINE | DT_CENTER | DT_VCENTER); */
/* TextOut(hdc, 0, 0, "WWWW", 4); */
/* TextOut(hdc, 1, 1, "IIII", 4); */
EndPaint(hwnd, &ps);
break;
}
case WM_DESTROY:
PostQuitMessage(0);
calldefault = 0;
break;

case WM_NCPAINT:
case WM_GETICON:
case WM_WINDOWPOSCHANGING:
case WM_ACTIVATEAPP:
case WM_NCACTIVATE:
case WM_ACTIVATE:
case WM_IME_NOTIFY:
break;

case WM_IME_SETCONTEXT:
lparam &= ~ISC_SHOWUICOMPOSITIONWINDOW;
break;

case WM_SETFOCUS:
ret = 0;
calldefault = 0;
break;

case WM_ERASEBKGND:
/* not sure how to actually erase the background - print spaces? */
ret = 1;
calldefault = 0;
break;

case WM_WINDOWPOSCHANGED:
{
char buf[80];
PAINTSTRUCT ps;
HDC hdc;
RECT rect;
static int cnt = 0;

sprintf(buf, "%d %d %X %X\n",
cnt++, (int)msg, (int)wparam, (int)lparam);
hdc = BeginPaint(hwnd, &ps);
GetClientRect(hwnd, &rect);
TextOut(hdc, 0, 0, buf, strlen(buf));
EndPaint(hwnd, &ps);
break;
}
/* lparam is WINDOWPOS and may have useful information */
ret = 0;
calldefault = 0;
break;

case WM_SIZE:
/* low 16 bits of lparam are width - in pixels it seems */
/* high 16 bits are height */
/* unclear why this message is being received in the first
place when the documentation says if I handle WINDOWPOSCHANGED
then these messages are not generated. Maybe what they mean
is that the WM_SIZE will just be a once-off message */
ret = 0;
calldefault = 0;
break;

case WM_MOVE:
/* low 16 bits of lparam are x-pos (start). high 16 bits are
y-pos - same consideration as WM_SIZE */
ret = 0;
calldefault = 0;
break;

case WM_KEYDOWN:
case WM_CHAR:
default:
{
char buf[80];
PAINTSTRUCT ps;
HDC hdc;
RECT rect;

sprintf(buf, "%d %X %X\n", (int)msg, (int)wparam, (int)lparam);
hdc = BeginPaint(hwnd, &ps);
GetClientRect(hwnd, &rect);
/* DrawText(hdc, "Hello There", -1, &rect,
DT_SINGLELINE | DT_CENTER | DT_VCENTER); */
TextOut(hdc, 0, 0, buf, strlen(buf));
EndPaint(hwnd, &ps);
break;
}
}
if (calldefault)
{
ret = DefWindowProc(hwnd, msg, wparam, lparam);
}
return (ret);
}

Re: simple 80 * 25

<1jmpc502cdvr4.v28jzmpitjka$.dlg@40tude.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=9916&group=comp.os.ms-windows.programmer.win32#9916

  copy link   Newsgroups: comp.os.ms-windows.programmer.win32
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: jj4pub...@outlook.com (JJ)
Newsgroups: comp.os.ms-windows.programmer.win32
Subject: Re: simple 80 * 25
Date: Wed, 19 Jul 2023 17:07:55 +0700
Organization: A noiseless patient Spider
Lines: 22
Message-ID: <1jmpc502cdvr4.v28jzmpitjka$.dlg@40tude.net>
References: <cdd721b8-3271-4d50-ad0e-2116895c9929n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="8e35715a43d279ad66039c886cf02220";
logging-data="2215391"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+joDZn7uHcKQ9ZYMlwSg1W/4LqKeGatZY="
User-Agent: 40tude_Dialog/2.0.15.84
Cancel-Lock: sha1:NQUzPSlpLK0Y3mxInT4bca9xlj0=
X-Bitcoin: 1LcqwCQBQmhcWfWsVEAeyLchkAY8ZfuMnS
X-Face: \*\`0(1j~VfYC>ebz[&O.]=,Nm\oRM{of,liRO#7Eqi4|!]!(Gs=Akgh{J)605>C9Air?pa d{sSZ09u+A7f<^paR"/NH_#<mE1S"hde\c6PZLUB[t/s5-+Iu5DSc?P0+4%,Hl
 by: JJ - Wed, 19 Jul 2023 10:07 UTC

On Tue, 18 Jul 2023 21:32:43 -0700 (PDT), Paul Edwards wrote:
> I remembered that a long time ago I wrote a very simple
> Win32 graphics program. I can't remember where I got
> the concepts from. I'm pretty sure this was before I was
> even on the internet.
>
> Original source is here:
>
> https://sourceforge.net/p/mvs380/mvssrc/ci/master/tree/ozpd/c/simpwin.c
>
> And I have made modifications (below) after consulting some
> online documentation.
>
> I was able to see that I got a stack of messages.
>
> However, if I press a key, I don't get a WM_CHAR message.
>
> And when I move the window, I don't get another WM_WINDOWPOSCHANGED message.

It's because there are more than one code which writes text at the same
window client position - overwriting each other's text. So you only see the
last written one.

Re: simple 80 * 25

<022ea208-2831-4311-a360-c9b0f8e653d3n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=9917&group=comp.os.ms-windows.programmer.win32#9917

  copy link   Newsgroups: comp.os.ms-windows.programmer.win32
X-Received: by 2002:a05:6214:5787:b0:634:80af:caec with SMTP id lv7-20020a056214578700b0063480afcaecmr15747qvb.0.1689768694968;
Wed, 19 Jul 2023 05:11:34 -0700 (PDT)
X-Received: by 2002:a05:6808:22a2:b0:3a3:7eca:3022 with SMTP id
bo34-20020a05680822a200b003a37eca3022mr3067420oib.2.1689768694697; Wed, 19
Jul 2023 05:11:34 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.os.ms-windows.programmer.win32
Date: Wed, 19 Jul 2023 05:11:34 -0700 (PDT)
In-Reply-To: <1jmpc502cdvr4.v28jzmpitjka$.dlg@40tude.net>
Injection-Info: google-groups.googlegroups.com; posting-host=1.37.88.166; posting-account=CeHKkQoAAAAowY1GfiJYG55VVc0s1zaG
NNTP-Posting-Host: 1.37.88.166
References: <cdd721b8-3271-4d50-ad0e-2116895c9929n@googlegroups.com> <1jmpc502cdvr4.v28jzmpitjka$.dlg@40tude.net>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <022ea208-2831-4311-a360-c9b0f8e653d3n@googlegroups.com>
Subject: Re: simple 80 * 25
From: mutazi...@gmail.com (Paul Edwards)
Injection-Date: Wed, 19 Jul 2023 12:11:34 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 8406
 by: Paul Edwards - Wed, 19 Jul 2023 12:11 UTC

On Wednesday, July 19, 2023 at 6:07:59 PM UTC+8, JJ wrote:

> > And when I move the window, I don't get another WM_WINDOWPOSCHANGED message.

> It's because there are more than one code which writes text at the same
> window client position - overwriting each other's text. So you only see the
> last written one.

Thanks. I had a static counter, but it turned out that I was
indeed missing some messages. So I have added those,
but I'm still back at the same spot.

I'm getting PPP 1 0 ... printed, and when I move the window,
that doesn't change. Nor do keypresses get through.

The 0 means that there are no messages that haven't
been handled.

The 1 means that poschanged is only called once.

Any ideas?

Thanks. Paul.

/*********************************************************************/
/* */
/* This Program Written by Paul Edwards. */
/* Released to the Public Domain */
/* */
/*********************************************************************/
/*********************************************************************/
/* */
/* simpwin - the simplest windows program (roughly speaking) */
/* */
/*********************************************************************/

#include <stdio.h>

#include <windows.h>

LONG FAR PASCAL simpwin(HWND hwnd, WORD msg, WORD wparam, LONG lparam);

int WINAPI WinMain(IN HINSTANCE inst,
IN HINSTANCE previnst,
IN LPSTR cmd,
IN int cmdshow)
{ WNDCLASS wndClass = { 0, (WNDPROC)simpwin, 0, 0, 0, NULL, NULL,
(HBRUSH)(COLOR_WINDOW+1), "simpwin", "simpwin" };
HWND hwnd;
MSG msg;
(void)previnst;
(void)cmd;
wndClass.hInstance = inst;
RegisterClass(&wndClass);
hwnd = CreateWindow("simpwin", "Simple Windows",
WS_SYSMENU,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, inst, NULL );
ShowWindow(hwnd, cmdshow);
UpdateWindow(hwnd);
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return (msg.wParam);
}

LONG FAR PASCAL simpwin(HWND hwnd, WORD msg, WORD wparam, LONG lparam)
{ int calldefault = 1;
LONG ret = 0;
static int cnt = 0;
static char newbuf[80];

switch (msg)
{
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc;
RECT rect;

hdc = BeginPaint(hwnd, &ps);
GetClientRect(hwnd, &rect);
/* TextOut(hdc, 0, 0, newbuf, strlen(newbuf)); */
EndPaint(hwnd, &ps);
break;
}
case WM_DESTROY:
PostQuitMessage(0);
calldefault = 0;
break;

case WM_NCPAINT:
case WM_GETICON:
case WM_WINDOWPOSCHANGING:
case WM_ACTIVATEAPP:
case WM_NCACTIVATE:
case WM_ACTIVATE:
case WM_IME_NOTIFY:
case WM_SHOWWINDOW:
break;

case WM_IME_SETCONTEXT:
lparam &= ~ISC_SHOWUICOMPOSITIONWINDOW;
break;

case WM_SETFOCUS:
ret = 0;
calldefault = 0;
break;

case WM_ERASEBKGND:
/* not sure how to actually erase the background - print spaces? */
ret = 1;
calldefault = 0;
break;

case WM_WINDOWPOSCHANGED:
{
char buf[80];
PAINTSTRUCT ps;
HDC hdc;
RECT rect;
static int loccnt = 0;

loccnt++;
sprintf(buf, "PPP %d %d %d %X %X\n",
loccnt, cnt, (int)msg, (int)wparam, (int)lparam);
hdc = BeginPaint(hwnd, &ps);
GetClientRect(hwnd, &rect);
/* TextOut(hdc, 0, 0, newbuf, strlen(newbuf)); */
TextOut(hdc, 0, 0, buf, strlen(buf));
EndPaint(hwnd, &ps);
break;
}
/* lparam is WINDOWPOS and may have useful information */
ret = 0;
calldefault = 0;
break;

case WM_SIZE:
/* low 16 bits of lparam are width - in pixels it seems */
/* high 16 bits are height */
/* unclear why this message is being received in the first
place when the documentation says if I handle WINDOWPOSCHANGED
then these messages are not generated. Maybe what they mean
is that the WM_SIZE will just be a once-off message */
ret = 0;
calldefault = 0;
break;

case WM_MOVE:
/* low 16 bits of lparam are x-pos (start). high 16 bits are
y-pos - same consideration as WM_SIZE */
ret = 0;
calldefault = 0;
break;

case WM_GETMINMAXINFO:
/* MINMAXINFO in lparam may be useful or need to be set */
ret = 0;
calldefault = 0;
break;

case WM_NCCALCSIZE:
/* if 0, this may have useful information in RECT */
if (wparam == 0)
{
ret = 0;
/* if we don't call the default, we don't get a window! */
calldefault = 1;
}
else
{
cnt += 50000; /* detect if we're getting true */
}
break;

case WM_NCCREATE:
/* lparam is CREATESTRUCT which may have useful information */
ret = 1;
calldefault = 0;
break;

case WM_CREATE:
/* lparam is CREATESTRUCT which may have useful information */
ret = 0;
calldefault = 0;
break;

case WM_KEYDOWN:
case WM_CHAR:
default:
{
char buf[80] = "DUMMY";
PAINTSTRUCT ps;
HDC hdc;
RECT rect;

cnt++;
sprintf(newbuf, "ZZZ %d %X %X\n", (int)msg, (int)wparam, (int)lparam);
hdc = BeginPaint(hwnd, &ps);
GetClientRect(hwnd, &rect);
TextOut(hdc, 0, 0, buf, strlen(buf));
EndPaint(hwnd, &ps);
break;
}
}
if (calldefault)
{
ret = DefWindowProc(hwnd, msg, wparam, lparam);
}
return (ret);
}

Re: simple 80 * 25

<khur43Fm1coU1@mid.individual.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=9918&group=comp.os.ms-windows.programmer.win32#9918

  copy link   Newsgroups: comp.os.ms-windows.programmer.win32
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: mai...@uwe-sieber.de (Uwe Sieber)
Newsgroups: comp.os.ms-windows.programmer.win32
Subject: Re: simple 80 * 25
Date: Fri, 21 Jul 2023 09:11:51 +0200
Lines: 233
Message-ID: <khur43Fm1coU1@mid.individual.net>
References: <cdd721b8-3271-4d50-ad0e-2116895c9929n@googlegroups.com> <1jmpc502cdvr4.v28jzmpitjka$.dlg@40tude.net> <022ea208-2831-4311-a360-c9b0f8e653d3n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: individual.net bg8K4hfdf1TW80Y8wAJlWgi8fnVGWVbpyhzFWlcXUbjnCYug==
Cancel-Lock: sha1:ZVaitJbK+TK2tiAS+7WAjFy2ly8= sha256:0XUsqwrXBR3mRq2kboE1qwoEvEafWIV7f05e774qcPk=
User-Agent: nix Hamster/1.3.23.4
In-Reply-To: <022ea208-2831-4311-a360-c9b0f8e653d3n@googlegroups.com>
 by: Uwe Sieber - Fri, 21 Jul 2023 07:11 UTC

MSDN:
"An application should not call BeginPaint except in response to a WM_PAINT message."

Replace BeginPaint + EndPaint by GetDC + ReleaseDC in any other place then WM_PAINT.

At WM_CHAR you print to newbuf but TextOut(buf)

Paul Edwards wrote:
> On Wednesday, July 19, 2023 at 6:07:59 PM UTC+8, JJ wrote:
>
>>> And when I move the window, I don't get another WM_WINDOWPOSCHANGED message.
>
>> It's because there are more than one code which writes text at the same
>> window client position - overwriting each other's text. So you only see the
>> last written one.
>
> Thanks. I had a static counter, but it turned out that I was
> indeed missing some messages. So I have added those,
> but I'm still back at the same spot.
>
> I'm getting PPP 1 0 ... printed, and when I move the window,
> that doesn't change. Nor do keypresses get through.
>
> The 0 means that there are no messages that haven't
> been handled.
>
> The 1 means that poschanged is only called once.
>
> Any ideas?
>
> Thanks. Paul.
>
>
> /*********************************************************************/
> /* */
> /* This Program Written by Paul Edwards. */
> /* Released to the Public Domain */
> /* */
> /*********************************************************************/
> /*********************************************************************/
> /* */
> /* simpwin - the simplest windows program (roughly speaking) */
> /* */
> /*********************************************************************/
>
> #include <stdio.h>
>
> #include <windows.h>
>
> LONG FAR PASCAL simpwin(HWND hwnd, WORD msg, WORD wparam, LONG lparam);
>
> int WINAPI WinMain(IN HINSTANCE inst,
> IN HINSTANCE previnst,
> IN LPSTR cmd,
> IN int cmdshow)
> {
> WNDCLASS wndClass = { 0, (WNDPROC)simpwin, 0, 0, 0, NULL, NULL,
> (HBRUSH)(COLOR_WINDOW+1), "simpwin", "simpwin" };
> HWND hwnd;
> MSG msg;
>
> (void)previnst;
> (void)cmd;
> wndClass.hInstance = inst;
> RegisterClass(&wndClass);
> hwnd = CreateWindow("simpwin", "Simple Windows",
> WS_SYSMENU,
> CW_USEDEFAULT, CW_USEDEFAULT,
> CW_USEDEFAULT, CW_USEDEFAULT,
> NULL, NULL, inst, NULL );
> ShowWindow(hwnd, cmdshow);
> UpdateWindow(hwnd);
> while (GetMessage(&msg, NULL, 0, 0))
> {
> TranslateMessage(&msg);
> DispatchMessage(&msg);
> }
> return (msg.wParam);
> }
>
> LONG FAR PASCAL simpwin(HWND hwnd, WORD msg, WORD wparam, LONG lparam)
> {
> int calldefault = 1;
> LONG ret = 0;
> static int cnt = 0;
> static char newbuf[80];
>
> switch (msg)
> {
> case WM_PAINT:
> {
> PAINTSTRUCT ps;
> HDC hdc;
> RECT rect;
>
> hdc = BeginPaint(hwnd, &ps);
> GetClientRect(hwnd, &rect);
> /* TextOut(hdc, 0, 0, newbuf, strlen(newbuf)); */
> EndPaint(hwnd, &ps);
> break;
> }
> case WM_DESTROY:
> PostQuitMessage(0);
> calldefault = 0;
> break;
>
> case WM_NCPAINT:
> case WM_GETICON:
> case WM_WINDOWPOSCHANGING:
> case WM_ACTIVATEAPP:
> case WM_NCACTIVATE:
> case WM_ACTIVATE:
> case WM_IME_NOTIFY:
> case WM_SHOWWINDOW:
> break;
>
> case WM_IME_SETCONTEXT:
> lparam &= ~ISC_SHOWUICOMPOSITIONWINDOW;
> break;
>
> case WM_SETFOCUS:
> ret = 0;
> calldefault = 0;
> break;
>
> case WM_ERASEBKGND:
> /* not sure how to actually erase the background - print spaces? */
> ret = 1;
> calldefault = 0;
> break;
>
> case WM_WINDOWPOSCHANGED:
> {
> char buf[80];
> PAINTSTRUCT ps;
> HDC hdc;
> RECT rect;
> static int loccnt = 0;
>
> loccnt++;
> sprintf(buf, "PPP %d %d %d %X %X\n",
> loccnt, cnt, (int)msg, (int)wparam, (int)lparam);
> hdc = BeginPaint(hwnd, &ps);
> GetClientRect(hwnd, &rect);
> /* TextOut(hdc, 0, 0, newbuf, strlen(newbuf)); */
> TextOut(hdc, 0, 0, buf, strlen(buf));
> EndPaint(hwnd, &ps);
> break;
> }
> /* lparam is WINDOWPOS and may have useful information */
> ret = 0;
> calldefault = 0;
> break;
>
> case WM_SIZE:
> /* low 16 bits of lparam are width - in pixels it seems */
> /* high 16 bits are height */
> /* unclear why this message is being received in the first
> place when the documentation says if I handle WINDOWPOSCHANGED
> then these messages are not generated. Maybe what they mean
> is that the WM_SIZE will just be a once-off message */
> ret = 0;
> calldefault = 0;
> break;
>
> case WM_MOVE:
> /* low 16 bits of lparam are x-pos (start). high 16 bits are
> y-pos - same consideration as WM_SIZE */
> ret = 0;
> calldefault = 0;
> break;
>
> case WM_GETMINMAXINFO:
> /* MINMAXINFO in lparam may be useful or need to be set */
> ret = 0;
> calldefault = 0;
> break;
>
> case WM_NCCALCSIZE:
> /* if 0, this may have useful information in RECT */
> if (wparam == 0)
> {
> ret = 0;
> /* if we don't call the default, we don't get a window! */
> calldefault = 1;
> }
> else
> {
> cnt += 50000; /* detect if we're getting true */
> }
> break;
>
> case WM_NCCREATE:
> /* lparam is CREATESTRUCT which may have useful information */
> ret = 1;
> calldefault = 0;
> break;
>
> case WM_CREATE:
> /* lparam is CREATESTRUCT which may have useful information */
> ret = 0;
> calldefault = 0;
> break;
>
> case WM_KEYDOWN:
> case WM_CHAR:
> default:
> {
> char buf[80] = "DUMMY";
> PAINTSTRUCT ps;
> HDC hdc;
> RECT rect;
>
> cnt++;
> sprintf(newbuf, "ZZZ %d %X %X\n", (int)msg, (int)wparam, (int)lparam);
> hdc = BeginPaint(hwnd, &ps);
> GetClientRect(hwnd, &rect);
> TextOut(hdc, 0, 0, buf, strlen(buf));
> EndPaint(hwnd, &ps);
> break;
> }
> }
> if (calldefault)
> {
> ret = DefWindowProc(hwnd, msg, wparam, lparam);
> }
> return (ret);
> }

Re: simple 80 * 25

<e317f4c3-c902-433e-ab45-24dc243bc0d4n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=9919&group=comp.os.ms-windows.programmer.win32#9919

  copy link   Newsgroups: comp.os.ms-windows.programmer.win32
X-Received: by 2002:a05:620a:489:b0:767:3d3d:7cc4 with SMTP id 9-20020a05620a048900b007673d3d7cc4mr429qkr.1.1689950123819;
Fri, 21 Jul 2023 07:35:23 -0700 (PDT)
X-Received: by 2002:a05:6808:16a3:b0:3a1:e88d:98ab with SMTP id
bb35-20020a05680816a300b003a1e88d98abmr5480450oib.6.1689950123521; Fri, 21
Jul 2023 07:35:23 -0700 (PDT)
Path: i2pn2.org!i2pn.org!news.1d4.us!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.os.ms-windows.programmer.win32
Date: Fri, 21 Jul 2023 07:35:23 -0700 (PDT)
In-Reply-To: <khur43Fm1coU1@mid.individual.net>
Injection-Info: google-groups.googlegroups.com; posting-host=216.247.83.34; posting-account=CeHKkQoAAAAowY1GfiJYG55VVc0s1zaG
NNTP-Posting-Host: 216.247.83.34
References: <cdd721b8-3271-4d50-ad0e-2116895c9929n@googlegroups.com>
<1jmpc502cdvr4.v28jzmpitjka$.dlg@40tude.net> <022ea208-2831-4311-a360-c9b0f8e653d3n@googlegroups.com>
<khur43Fm1coU1@mid.individual.net>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e317f4c3-c902-433e-ab45-24dc243bc0d4n@googlegroups.com>
Subject: Re: simple 80 * 25
From: mutazi...@gmail.com (Paul Edwards)
Injection-Date: Fri, 21 Jul 2023 14:35:23 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 8578
 by: Paul Edwards - Fri, 21 Jul 2023 14:35 UTC

On Friday, July 21, 2023 at 3:40:56 PM UTC+8, Uwe Sieber wrote:
> MSDN:
> "An application should not call BeginPaint except in response to a WM_PAINT message."
>
> Replace BeginPaint + EndPaint by GetDC + ReleaseDC in any other place then WM_PAINT.
>
> At WM_CHAR you print to newbuf but TextOut(buf)

Thanks. I didn't really need it printed at that exact spot, so I
just changed it to stop printing. Am I expecting to get a
fresh WM_PAINT message after moving the window or
pressing a key?

Because currently I'm getting PPP 1 1 ...

which means that I'm just getting a single position changed, and
I'm not getting any keystrokes at all.

Unless I'm only ever receiving a single WM_PAINT message,
which would explain why I don't see any more action.

Thanks. Paul.

/*********************************************************************/
/* */
/* This Program Written by Paul Edwards. */
/* Released to the Public Domain */
/* */
/*********************************************************************/
/*********************************************************************/
/* */
/* simpwin - the simplest windows program (roughly speaking) */
/* */
/*********************************************************************/

#include <stdio.h>

#include <windows.h>

LONG FAR PASCAL simpwin(HWND hwnd, WORD msg, WORD wparam, LONG lparam);

int WINAPI WinMain(IN HINSTANCE inst,
IN HINSTANCE previnst,
IN LPSTR cmd,
IN int cmdshow)
{ WNDCLASS wndClass = { 0, (WNDPROC)simpwin, 0, 0, 0, NULL, NULL,
(HBRUSH)(COLOR_WINDOW+1), "simpwin", "simpwin" };
HWND hwnd;
MSG msg;
(void)previnst;
(void)cmd;
wndClass.hInstance = inst;
RegisterClass(&wndClass);
hwnd = CreateWindow("simpwin", "Simple Windows",
WS_SYSMENU,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, inst, NULL );
ShowWindow(hwnd, cmdshow);
UpdateWindow(hwnd);
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return (msg.wParam);
}

LONG FAR PASCAL simpwin(HWND hwnd, WORD msg, WORD wparam, LONG lparam)
{ int calldefault = 1;
LONG ret = 0;
static int cnt = 0;
static char newbuf[80];

switch (msg)
{
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc;
RECT rect;

hdc = BeginPaint(hwnd, &ps);
GetClientRect(hwnd, &rect);
TextOut(hdc, 0, 0, newbuf, strlen(newbuf));
EndPaint(hwnd, &ps);
break;
}
case WM_DESTROY:
PostQuitMessage(0);
calldefault = 0;
break;

case WM_NCPAINT:
case WM_GETICON:
case WM_WINDOWPOSCHANGING:
case WM_ACTIVATEAPP:
case WM_NCACTIVATE:
case WM_ACTIVATE:
case WM_IME_NOTIFY:
case WM_SHOWWINDOW:
break;

case WM_IME_SETCONTEXT:
lparam &= ~ISC_SHOWUICOMPOSITIONWINDOW;
break;

case WM_SETFOCUS:
ret = 0;
calldefault = 0;
break;

case WM_ERASEBKGND:
/* not sure how to actually erase the background - print spaces? */
ret = 1;
calldefault = 0;
break;

case WM_WINDOWPOSCHANGED:
{
char buf[80];
PAINTSTRUCT ps;
HDC hdc;
RECT rect;
static int loccnt = 0;

loccnt++;
cnt++;
sprintf(newbuf, "PPP %d %d %d %X %X\n",
loccnt, cnt, (int)msg, (int)wparam, (int)lparam);
#if 0
hdc = BeginPaint(hwnd, &ps);
GetClientRect(hwnd, &rect);
/* TextOut(hdc, 0, 0, newbuf, strlen(newbuf)); */
TextOut(hdc, 0, 0, buf, strlen(buf));
EndPaint(hwnd, &ps);
#endif
break;
}
/* lparam is WINDOWPOS and may have useful information */
ret = 0;
calldefault = 0;
break;

case WM_SIZE:
/* low 16 bits of lparam are width - in pixels it seems */
/* high 16 bits are height */
/* unclear why this message is being received in the first
place when the documentation says if I handle WINDOWPOSCHANGED
then these messages are not generated. Maybe what they mean
is that the WM_SIZE will just be a once-off message */
ret = 0;
calldefault = 0;
break;

case WM_MOVE:
/* low 16 bits of lparam are x-pos (start). high 16 bits are
y-pos - same consideration as WM_SIZE */
ret = 0;
calldefault = 0;
break;

case WM_GETMINMAXINFO:
/* MINMAXINFO in lparam may be useful or need to be set */
ret = 0;
calldefault = 0;
break;

case WM_NCCALCSIZE:
/* if 0, this may have useful information in RECT */
if (wparam == 0)
{
ret = 0;
/* if we don't call the default, we don't get a window! */
calldefault = 1;
}
else
{
cnt += 50000; /* detect if we're getting true */
}
break;

case WM_NCCREATE:
/* lparam is CREATESTRUCT which may have useful information */
ret = 1;
calldefault = 0;
break;

case WM_CREATE:
/* lparam is CREATESTRUCT which may have useful information */
ret = 0;
calldefault = 0;
break;

case WM_KEYDOWN:
case WM_CHAR:
default:
{
char buf[80] = "DUMMY";
PAINTSTRUCT ps;
HDC hdc;
RECT rect;

cnt++;
sprintf(newbuf, "ZZZ %d %X %X\n", (int)msg, (int)wparam, (int)lparam);
/* hdc = BeginPaint(hwnd, &ps);
GetClientRect(hwnd, &rect);
TextOut(hdc, 0, 0, buf, strlen(buf));
EndPaint(hwnd, &ps); */
break;
}
}
if (calldefault)
{
ret = DefWindowProc(hwnd, msg, wparam, lparam);
}
return (ret);
}

Re: simple 80 * 25

<e3e9f908-4dcb-4b2b-ab6e-5238e0892796n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=9920&group=comp.os.ms-windows.programmer.win32#9920

  copy link   Newsgroups: comp.os.ms-windows.programmer.win32
X-Received: by 2002:a37:bdc1:0:b0:768:2bf3:95cc with SMTP id n184-20020a37bdc1000000b007682bf395ccmr573qkf.3.1689951496233;
Fri, 21 Jul 2023 07:58:16 -0700 (PDT)
X-Received: by 2002:a05:6808:2028:b0:39e:de07:a6b7 with SMTP id
q40-20020a056808202800b0039ede07a6b7mr5651055oiw.1.1689951495802; Fri, 21 Jul
2023 07:58:15 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.os.ms-windows.programmer.win32
Date: Fri, 21 Jul 2023 07:58:15 -0700 (PDT)
In-Reply-To: <e317f4c3-c902-433e-ab45-24dc243bc0d4n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=92.28.31.24; posting-account=0B-afgoAAABP6274zLUJKa8ZpdIdhsYx
NNTP-Posting-Host: 92.28.31.24
References: <cdd721b8-3271-4d50-ad0e-2116895c9929n@googlegroups.com>
<1jmpc502cdvr4.v28jzmpitjka$.dlg@40tude.net> <022ea208-2831-4311-a360-c9b0f8e653d3n@googlegroups.com>
<khur43Fm1coU1@mid.individual.net> <e317f4c3-c902-433e-ab45-24dc243bc0d4n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e3e9f908-4dcb-4b2b-ab6e-5238e0892796n@googlegroups.com>
Subject: Re: simple 80 * 25
From: gw7...@aol.com (Paul N)
Injection-Date: Fri, 21 Jul 2023 14:58:16 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 7959
 by: Paul N - Fri, 21 Jul 2023 14:58 UTC

On Friday, July 21, 2023 at 3:35:25 PM UTC+1, Paul Edwards wrote:
> On Friday, July 21, 2023 at 3:40:56 PM UTC+8, Uwe Sieber wrote:
> > MSDN:
> > "An application should not call BeginPaint except in response to a WM_PAINT message."
> >
> > Replace BeginPaint + EndPaint by GetDC + ReleaseDC in any other place then WM_PAINT.
> >
> > At WM_CHAR you print to newbuf but TextOut(buf)
> Thanks. I didn't really need it printed at that exact spot, so I
> just changed it to stop printing. Am I expecting to get a
> fresh WM_PAINT message after moving the window or
> pressing a key?
>
> Because currently I'm getting PPP 1 1 ...
>
> which means that I'm just getting a single position changed, and
> I'm not getting any keystrokes at all.
>
> Unless I'm only ever receiving a single WM_PAINT message,
> which would explain why I don't see any more action.
> Thanks. Paul.
>
>
> /*********************************************************************/
> /* */
> /* This Program Written by Paul Edwards. */
> /* Released to the Public Domain */
> /* */
> /*********************************************************************/
> /*********************************************************************/
> /* */
> /* simpwin - the simplest windows program (roughly speaking) */
> /* */
> /*********************************************************************/
>
> #include <stdio.h>
>
> #include <windows.h>
>
> LONG FAR PASCAL simpwin(HWND hwnd, WORD msg, WORD wparam, LONG lparam);
>
> int WINAPI WinMain(IN HINSTANCE inst,
> IN HINSTANCE previnst,
> IN LPSTR cmd,
> IN int cmdshow)
> {
> WNDCLASS wndClass = { 0, (WNDPROC)simpwin, 0, 0, 0, NULL, NULL,
> (HBRUSH)(COLOR_WINDOW+1), "simpwin", "simpwin" };
> HWND hwnd;
> MSG msg;
>
> (void)previnst;
> (void)cmd;
> wndClass.hInstance = inst;
> RegisterClass(&wndClass);
> hwnd = CreateWindow("simpwin", "Simple Windows",
> WS_SYSMENU,
> CW_USEDEFAULT, CW_USEDEFAULT,
> CW_USEDEFAULT, CW_USEDEFAULT,
> NULL, NULL, inst, NULL );
> ShowWindow(hwnd, cmdshow);
> UpdateWindow(hwnd);
> while (GetMessage(&msg, NULL, 0, 0))
> {
> TranslateMessage(&msg);
> DispatchMessage(&msg);
> }
> return (msg.wParam);
> }
>
> LONG FAR PASCAL simpwin(HWND hwnd, WORD msg, WORD wparam, LONG lparam)
> {
> int calldefault = 1;
> LONG ret = 0;
> static int cnt = 0;
> static char newbuf[80];
>
> switch (msg)
> {
> case WM_PAINT:
> {
> PAINTSTRUCT ps;
> HDC hdc;
> RECT rect;
>
> hdc = BeginPaint(hwnd, &ps);
> GetClientRect(hwnd, &rect);
> TextOut(hdc, 0, 0, newbuf, strlen(newbuf));
> EndPaint(hwnd, &ps);
> break;
> }
> case WM_DESTROY:
> PostQuitMessage(0);
> calldefault = 0;
> break;
>
> case WM_NCPAINT:
> case WM_GETICON:
> case WM_WINDOWPOSCHANGING:
> case WM_ACTIVATEAPP:
> case WM_NCACTIVATE:
> case WM_ACTIVATE:
> case WM_IME_NOTIFY:
> case WM_SHOWWINDOW:
> break;
>
> case WM_IME_SETCONTEXT:
> lparam &= ~ISC_SHOWUICOMPOSITIONWINDOW;
> break;
>
> case WM_SETFOCUS:
> ret = 0;
> calldefault = 0;
> break;
>
> case WM_ERASEBKGND:
> /* not sure how to actually erase the background - print spaces? */
> ret = 1;
> calldefault = 0;
> break;
>
> case WM_WINDOWPOSCHANGED:
> {
> char buf[80];
> PAINTSTRUCT ps;
> HDC hdc;
> RECT rect;
> static int loccnt = 0;
>
> loccnt++;
> cnt++;
> sprintf(newbuf, "PPP %d %d %d %X %X\n",
> loccnt, cnt, (int)msg, (int)wparam, (int)lparam);
> #if 0
> hdc = BeginPaint(hwnd, &ps);
> GetClientRect(hwnd, &rect);
> /* TextOut(hdc, 0, 0, newbuf, strlen(newbuf)); */
> TextOut(hdc, 0, 0, buf, strlen(buf));
> EndPaint(hwnd, &ps);
> #endif
> break;
> }
> /* lparam is WINDOWPOS and may have useful information */
> ret = 0;
> calldefault = 0;
> break;
>
> case WM_SIZE:
> /* low 16 bits of lparam are width - in pixels it seems */
> /* high 16 bits are height */
> /* unclear why this message is being received in the first
> place when the documentation says if I handle WINDOWPOSCHANGED
> then these messages are not generated. Maybe what they mean
> is that the WM_SIZE will just be a once-off message */
> ret = 0;
> calldefault = 0;
> break;
>
> case WM_MOVE:
> /* low 16 bits of lparam are x-pos (start). high 16 bits are
> y-pos - same consideration as WM_SIZE */
> ret = 0;
> calldefault = 0;
> break;
>
> case WM_GETMINMAXINFO:
> /* MINMAXINFO in lparam may be useful or need to be set */
> ret = 0;
> calldefault = 0;
> break;
>
> case WM_NCCALCSIZE:
> /* if 0, this may have useful information in RECT */
> if (wparam == 0)
> {
> ret = 0;
> /* if we don't call the default, we don't get a window! */
> calldefault = 1;
> }
> else
> {
> cnt += 50000; /* detect if we're getting true */
> }
> break;
>
> case WM_NCCREATE:
> /* lparam is CREATESTRUCT which may have useful information */
> ret = 1;
> calldefault = 0;
> break;
>
> case WM_CREATE:
> /* lparam is CREATESTRUCT which may have useful information */
> ret = 0;
> calldefault = 0;
> break;
>
> case WM_KEYDOWN:
> case WM_CHAR:
> default:
> {
> char buf[80] = "DUMMY";
> PAINTSTRUCT ps;
> HDC hdc;
> RECT rect;
>
> cnt++;
> sprintf(newbuf, "ZZZ %d %X %X\n", (int)msg, (int)wparam, (int)lparam);
> /* hdc = BeginPaint(hwnd, &ps);
> GetClientRect(hwnd, &rect);
> TextOut(hdc, 0, 0, buf, strlen(buf));
> EndPaint(hwnd, &ps); */
> break;
> }
> }
> if (calldefault)
> {
> ret = DefWindowProc(hwnd, msg, wparam, lparam);
> }
> return (ret);
> }

WM_PAINT is sent when the computer thinks that what is actually on the screen needs to be updated. So you don't normally get one just because you have decided to change the content of the window. If you want what is actually on the screen to reflect what you now think ought to be there, the easiest way is to use the command InvalidateRect which will cause an WM_PAINT to be sent.

Re: simple 80 * 25

<f925abec-8daa-4324-9299-51af76af69d2n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=9921&group=comp.os.ms-windows.programmer.win32#9921

  copy link   Newsgroups: comp.os.ms-windows.programmer.win32
X-Received: by 2002:a37:b606:0:b0:767:f299:41a3 with SMTP id g6-20020a37b606000000b00767f29941a3mr1144qkf.0.1689953190380; Fri, 21 Jul 2023 08:26:30 -0700 (PDT)
X-Received: by 2002:a05:6808:1799:b0:3a1:ef89:a49d with SMTP id bg25-20020a056808179900b003a1ef89a49dmr5826992oib.2.1689953190103; Fri, 21 Jul 2023 08:26:30 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!feeder.usenetexpress.com!tr3.iad1.usenetexpress.com!69.80.99.11.MISMATCH!border-1.nntp.ord.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.os.ms-windows.programmer.win32
Date: Fri, 21 Jul 2023 08:26:29 -0700 (PDT)
In-Reply-To: <e3e9f908-4dcb-4b2b-ab6e-5238e0892796n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=216.247.83.34; posting-account=CeHKkQoAAAAowY1GfiJYG55VVc0s1zaG
NNTP-Posting-Host: 216.247.83.34
References: <cdd721b8-3271-4d50-ad0e-2116895c9929n@googlegroups.com> <1jmpc502cdvr4.v28jzmpitjka$.dlg@40tude.net> <022ea208-2831-4311-a360-c9b0f8e653d3n@googlegroups.com> <khur43Fm1coU1@mid.individual.net> <e317f4c3-c902-433e-ab45-24dc243bc0d4n@googlegroups.com> <e3e9f908-4dcb-4b2b-ab6e-5238e0892796n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <f925abec-8daa-4324-9299-51af76af69d2n@googlegroups.com>
Subject: Re: simple 80 * 25
From: mutazi...@gmail.com (Paul Edwards)
Injection-Date: Fri, 21 Jul 2023 15:26:30 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 227
 by: Paul Edwards - Fri, 21 Jul 2023 15:26 UTC

On Friday, July 21, 2023 at 10:58:17 PM UTC+8, Paul N wrote:

> WM_PAINT is sent when the computer thinks that what is
> actually on the screen needs to be updated. So you don't
> normally get one just because you have decided to change
> the content of the window. If you want what is actually on
> the screen to reflect what you now think ought to be there,
> the easiest way is to use the command InvalidateRect which
> will cause an WM_PAINT to be sent.

Thanks! That literally brought a smile to my face when I
started seeing activity, and I could indeed see the ASCII
character codes come through when I press keys.

That should be the vast bulk of what I need (at least as
far as Windows graphics code, anyway).

BFN. Paul.

/*********************************************************************/
/* */
/* This Program Written by Paul Edwards. */
/* Released to the Public Domain */
/* */
/*********************************************************************/
/*********************************************************************/
/* */
/* simpwin - the simplest windows program (roughly speaking) */
/* */
/*********************************************************************/

#include <stdio.h>

#include <windows.h>

LONG FAR PASCAL simpwin(HWND hwnd, WORD msg, WORD wparam, LONG lparam);

int WINAPI WinMain(IN HINSTANCE inst,
IN HINSTANCE previnst,
IN LPSTR cmd,
IN int cmdshow)
{ WNDCLASS wndClass = { 0, (WNDPROC)simpwin, 0, 0, 0, NULL, NULL,
(HBRUSH)(COLOR_WINDOW+1), "simpwin", "simpwin" };
HWND hwnd;
MSG msg;
(void)previnst;
(void)cmd;
wndClass.hInstance = inst;
RegisterClass(&wndClass);
hwnd = CreateWindow("simpwin", "Simple Windows",
WS_SYSMENU,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, inst, NULL );
ShowWindow(hwnd, cmdshow);
UpdateWindow(hwnd);
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return (msg.wParam);
}

LONG FAR PASCAL simpwin(HWND hwnd, WORD msg, WORD wparam, LONG lparam)
{ int calldefault = 1;
LONG ret = 0;
static int cnt = 0;
static char newbuf[80];

switch (msg)
{
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc;
RECT rect;

hdc = BeginPaint(hwnd, &ps);
GetClientRect(hwnd, &rect);
TextOut(hdc, 0, 0, newbuf, strlen(newbuf));
EndPaint(hwnd, &ps);
break;
}
case WM_DESTROY:
PostQuitMessage(0);
calldefault = 0;
break;

case WM_NCPAINT:
case WM_GETICON:
case WM_WINDOWPOSCHANGING:
case WM_ACTIVATEAPP:
case WM_NCACTIVATE:
case WM_ACTIVATE:
case WM_IME_NOTIFY:
case WM_SHOWWINDOW:
break;

case WM_IME_SETCONTEXT:
lparam &= ~ISC_SHOWUICOMPOSITIONWINDOW;
break;

case WM_SETFOCUS:
ret = 0;
calldefault = 0;
break;

case WM_ERASEBKGND:
/* not sure how to actually erase the background - print spaces? */
ret = 1;
calldefault = 0;
break;

case WM_WINDOWPOSCHANGED:
{
char buf[80];
PAINTSTRUCT ps;
HDC hdc;
RECT rect;
static int loccnt = 0;

loccnt++;
cnt++;
sprintf(newbuf, "PPP %d %d %d %X %X\n",
loccnt, cnt, (int)msg, (int)wparam, (int)lparam);
InvalidateRect(hwnd, NULL, TRUE);
#if 0
hdc = BeginPaint(hwnd, &ps);
GetClientRect(hwnd, &rect);
/* TextOut(hdc, 0, 0, newbuf, strlen(newbuf)); */
TextOut(hdc, 0, 0, buf, strlen(buf));
EndPaint(hwnd, &ps);
#endif
break;
}
/* lparam is WINDOWPOS and may have useful information */
ret = 0;
calldefault = 0;
break;

case WM_SIZE:
/* low 16 bits of lparam are width - in pixels it seems */
/* high 16 bits are height */
/* unclear why this message is being received in the first
place when the documentation says if I handle WINDOWPOSCHANGED
then these messages are not generated. Maybe what they mean
is that the WM_SIZE will just be a once-off message */
ret = 0;
calldefault = 0;
break;

case WM_MOVE:
/* low 16 bits of lparam are x-pos (start). high 16 bits are
y-pos - same consideration as WM_SIZE */
ret = 0;
calldefault = 0;
break;

case WM_GETMINMAXINFO:
/* MINMAXINFO in lparam may be useful or need to be set */
ret = 0;
calldefault = 0;
break;

case WM_NCCALCSIZE:
/* if 0, this may have useful information in RECT */
if (wparam == 0)
{
ret = 0;
/* if we don't call the default, we don't get a window! */
calldefault = 1;
}
else
{
cnt += 50000; /* detect if we're getting true */
}
break;

case WM_NCCREATE:
/* lparam is CREATESTRUCT which may have useful information */
ret = 1;
calldefault = 0;
break;

case WM_CREATE:
/* lparam is CREATESTRUCT which may have useful information */
ret = 0;
calldefault = 0;
break;

case WM_KEYDOWN:
case WM_CHAR:
{
char buf[80] = "DUMMY";
PAINTSTRUCT ps;
HDC hdc;
RECT rect;

cnt++;
sprintf(newbuf, "ZZZ %d %X %X\n", (int)msg, (int)wparam, (int)lparam);
InvalidateRect(hwnd, NULL, TRUE);
/* hdc = BeginPaint(hwnd, &ps);
GetClientRect(hwnd, &rect);
TextOut(hdc, 0, 0, buf, strlen(buf));
EndPaint(hwnd, &ps); */
break;
}
/* we're still getting some of these, but we no longer care */
default:
break;
}
if (calldefault)
{
ret = DefWindowProc(hwnd, msg, wparam, lparam);
}
return (ret);
}

Re: simple 80 * 25

<1b52e493-e14b-463d-ae2d-b2476a389edcn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=9922&group=comp.os.ms-windows.programmer.win32#9922

  copy link   Newsgroups: comp.os.ms-windows.programmer.win32
X-Received: by 2002:ac8:4e54:0:b0:403:fd62:ceb0 with SMTP id e20-20020ac84e54000000b00403fd62ceb0mr1588qtw.12.1689954281485;
Fri, 21 Jul 2023 08:44:41 -0700 (PDT)
X-Received: by 2002:a05:6808:150f:b0:3a1:f368:6b1 with SMTP id
u15-20020a056808150f00b003a1f36806b1mr5985801oiw.3.1689954281084; Fri, 21 Jul
2023 08:44:41 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.os.ms-windows.programmer.win32
Date: Fri, 21 Jul 2023 08:44:40 -0700 (PDT)
In-Reply-To: <f925abec-8daa-4324-9299-51af76af69d2n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=216.247.83.34; posting-account=CeHKkQoAAAAowY1GfiJYG55VVc0s1zaG
NNTP-Posting-Host: 216.247.83.34
References: <cdd721b8-3271-4d50-ad0e-2116895c9929n@googlegroups.com>
<1jmpc502cdvr4.v28jzmpitjka$.dlg@40tude.net> <022ea208-2831-4311-a360-c9b0f8e653d3n@googlegroups.com>
<khur43Fm1coU1@mid.individual.net> <e317f4c3-c902-433e-ab45-24dc243bc0d4n@googlegroups.com>
<e3e9f908-4dcb-4b2b-ab6e-5238e0892796n@googlegroups.com> <f925abec-8daa-4324-9299-51af76af69d2n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <1b52e493-e14b-463d-ae2d-b2476a389edcn@googlegroups.com>
Subject: Re: simple 80 * 25
From: mutazi...@gmail.com (Paul Edwards)
Injection-Date: Fri, 21 Jul 2023 15:44:41 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2084
 by: Paul Edwards - Fri, 21 Jul 2023 15:44 UTC

On Friday, July 21, 2023 at 11:26:33 PM UTC+8, Paul Edwards wrote:

> That should be the vast bulk of what I need (at least as
> far as Windows graphics code, anyway).

I checked on win32s under Windows for Workgroups 3.11.

Although my program (compiled with Open Watcom 1.6)
worked, the window was transparent.

Under Windows 10 I instead get a clean window with a
clean white background.

It may be related to the fact that Watcom says it is creating
a console mode application, when it is actually graphics.
Not sure what the wcl386 option is to set that.

BFN. Paul.

Re: simple 80 * 25

<42fb7507-7e53-4d1a-9b0a-19d67c36f3e5n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=9923&group=comp.os.ms-windows.programmer.win32#9923

  copy link   Newsgroups: comp.os.ms-windows.programmer.win32
X-Received: by 2002:a37:b905:0:b0:762:19b6:2900 with SMTP id j5-20020a37b905000000b0076219b62900mr4922qkf.5.1689975717041;
Fri, 21 Jul 2023 14:41:57 -0700 (PDT)
X-Received: by 2002:a05:6808:1309:b0:3a3:e02c:bd27 with SMTP id
y9-20020a056808130900b003a3e02cbd27mr7309382oiv.8.1689975716830; Fri, 21 Jul
2023 14:41:56 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.os.ms-windows.programmer.win32
Date: Fri, 21 Jul 2023 14:41:56 -0700 (PDT)
In-Reply-To: <1b52e493-e14b-463d-ae2d-b2476a389edcn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=136.158.103.253; posting-account=CeHKkQoAAAAowY1GfiJYG55VVc0s1zaG
NNTP-Posting-Host: 136.158.103.253
References: <cdd721b8-3271-4d50-ad0e-2116895c9929n@googlegroups.com>
<1jmpc502cdvr4.v28jzmpitjka$.dlg@40tude.net> <022ea208-2831-4311-a360-c9b0f8e653d3n@googlegroups.com>
<khur43Fm1coU1@mid.individual.net> <e317f4c3-c902-433e-ab45-24dc243bc0d4n@googlegroups.com>
<e3e9f908-4dcb-4b2b-ab6e-5238e0892796n@googlegroups.com> <f925abec-8daa-4324-9299-51af76af69d2n@googlegroups.com>
<1b52e493-e14b-463d-ae2d-b2476a389edcn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <42fb7507-7e53-4d1a-9b0a-19d67c36f3e5n@googlegroups.com>
Subject: Re: simple 80 * 25
From: mutazi...@gmail.com (Paul Edwards)
Injection-Date: Fri, 21 Jul 2023 21:41:57 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Paul Edwards - Fri, 21 Jul 2023 21:41 UTC

On Friday, July 21, 2023 at 11:44:42 PM UTC+8, Paul Edwards wrote:

> I checked on win32s under Windows for Workgroups 3.11.
>
> Although my program (compiled with Open Watcom 1.6)
> worked, the window was transparent.

The problem was that I still had my "debug" code left when
I was trying to figure out which message I needed to do
something with.

I commented out the obvious one, and the default window
proc did the trick, so the background is fixed now.

Thanks. Paul.

/*********************************************************************/
/* */
/* This Program Written by Paul Edwards. */
/* Released to the Public Domain */
/* */
/*********************************************************************/
/*********************************************************************/
/* */
/* simpwin - the simplest windows program (roughly speaking) */
/* */
/*********************************************************************/

#include <stdio.h>

#include <windows.h>

LONG FAR PASCAL simpwin(HWND hwnd, WORD msg, WORD wparam, LONG lparam);

int WINAPI WinMain(IN HINSTANCE inst,
IN HINSTANCE previnst,
IN LPSTR cmd,
IN int cmdshow)
{ WNDCLASS wndClass = { 0, (WNDPROC)simpwin, 0, 0, 0, NULL, NULL,
(HBRUSH)(COLOR_WINDOW+1), "simpwin", "simpwin" };
HWND hwnd;
MSG msg;
(void)previnst;
(void)cmd;
wndClass.hInstance = inst;
RegisterClass(&wndClass);
hwnd = CreateWindow("simpwin", "Simple Windows",
WS_SYSMENU,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, inst, NULL );
ShowWindow(hwnd, cmdshow);
UpdateWindow(hwnd);
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return (msg.wParam);
}

LONG FAR PASCAL simpwin(HWND hwnd, WORD msg, WORD wparam, LONG lparam)
{ int calldefault = 1;
LONG ret = 0;
static int cnt = 0;
static char newbuf[80];

switch (msg)
{
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc;
RECT rect;

hdc = BeginPaint(hwnd, &ps);
GetClientRect(hwnd, &rect);
TextOut(hdc, 0, 0, newbuf, strlen(newbuf));
EndPaint(hwnd, &ps);
break;
}
case WM_DESTROY:
PostQuitMessage(0);
calldefault = 0;
break;

case WM_NCPAINT:
case WM_GETICON:
case WM_WINDOWPOSCHANGING:
case WM_ACTIVATEAPP:
case WM_NCACTIVATE:
case WM_ACTIVATE:
case WM_IME_NOTIFY:
case WM_SHOWWINDOW:
break;

case WM_IME_SETCONTEXT:
lparam &= ~ISC_SHOWUICOMPOSITIONWINDOW;
break;

case WM_SETFOCUS:
ret = 0;
calldefault = 0;
break;

#if 0
case WM_ERASEBKGND:
/* not sure how to actually erase the background - print spaces? */
ret = 1;
calldefault = 0;
break;
#endif

case WM_WINDOWPOSCHANGED:
{
char buf[80];
PAINTSTRUCT ps;
HDC hdc;
RECT rect;
static int loccnt = 0;

loccnt++;
cnt++;
sprintf(newbuf, "PPP %d %d %d %X %X\n",
loccnt, cnt, (int)msg, (int)wparam, (int)lparam);
InvalidateRect(hwnd, NULL, TRUE);
#if 0
hdc = BeginPaint(hwnd, &ps);
GetClientRect(hwnd, &rect);
/* TextOut(hdc, 0, 0, newbuf, strlen(newbuf)); */
TextOut(hdc, 0, 0, buf, strlen(buf));
EndPaint(hwnd, &ps);
#endif
break;
}
/* lparam is WINDOWPOS and may have useful information */
ret = 0;
calldefault = 0;
break;

case WM_SIZE:
/* low 16 bits of lparam are width - in pixels it seems */
/* high 16 bits are height */
/* unclear why this message is being received in the first
place when the documentation says if I handle WINDOWPOSCHANGED
then these messages are not generated. Maybe what they mean
is that the WM_SIZE will just be a once-off message */
ret = 0;
calldefault = 0;
break;

case WM_MOVE:
/* low 16 bits of lparam are x-pos (start). high 16 bits are
y-pos - same consideration as WM_SIZE */
ret = 0;
calldefault = 0;
break;

case WM_GETMINMAXINFO:
/* MINMAXINFO in lparam may be useful or need to be set */
ret = 0;
calldefault = 0;
break;

case WM_NCCALCSIZE:
/* if 0, this may have useful information in RECT */
if (wparam == 0)
{
ret = 0;
/* if we don't call the default, we don't get a window! */
calldefault = 1;
}
else
{
cnt += 50000; /* detect if we're getting true */
}
break;

case WM_NCCREATE:
/* lparam is CREATESTRUCT which may have useful information */
ret = 1;
calldefault = 0;
break;

case WM_CREATE:
/* lparam is CREATESTRUCT which may have useful information */
ret = 0;
calldefault = 0;
break;

case WM_KEYDOWN:
case WM_CHAR:
{
char buf[80] = "DUMMY";
PAINTSTRUCT ps;
HDC hdc;
RECT rect;

cnt++;
sprintf(newbuf, "ZZZ %d %X %X\n", (int)msg, (int)wparam, (int)lparam);
InvalidateRect(hwnd, NULL, TRUE);
/* hdc = BeginPaint(hwnd, &ps);
GetClientRect(hwnd, &rect);
TextOut(hdc, 0, 0, buf, strlen(buf));
EndPaint(hwnd, &ps); */
break;
}
/* we're still getting some of these, but we no longer care */
default:
break;
}
if (calldefault)
{
ret = DefWindowProc(hwnd, msg, wparam, lparam);
}
return (ret);
}

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor