TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: All
from: Gerard Gerritsen
date: 1996-02-14 13:10:10
subject: Help !

Hello All!

I have got a big problem, when loading modeless dialog boxes (WinLoadDlg)
the dialog dissapears when pressing a button in the dialog....
The same thing for Frame's ( except for WinCreateStdWindow )

Here is some (pascal) code, but I think I'm forgetting something, although
this is a stripped down direct port a C program that works fine.


=== Begin hexcalc.pas ===
program HexCalc;

uses os2pmapi,os2base,os2def;
{$DYNAMIC SYSTEM}
{$L VPRTL.LIB}

{$PMTYPE PM}
const ClientClass='A';

Function ClientWndProc (Window:HWND;MSG:ulong;Mp1,Mp2:Mparam):Mresult;CDECL;EXPORT;

begin
Case Msg of
        WM_ERASEBACKGROUND: begin
                                ClientWndProc:=MRFromShort(1);
                                exit;
                            end;
        WM_COMMAND: begin
                    ClientWndProc:=MRFromShort(0);
                    { have tried different values, but it keeps dissapearing }
                    exit;
                    end;
             end;
ClientWndProc:=WinDefWindowProc(window,msg,mp1,mp2);
end;

var
Anchor:hab;
Message:HMQ;
FrameWindow:Hwnd;
QueueMsg:QMSG;

begin
Anchor:=WinInitialize(0);
Message:=WinCreateMsgQueue(anchor,100);
WinRegisterClass(anchor, ClientClass, ClientWndProc,0,0);
FrameWindow:=WinLoadDlg(HWND_DESKTOP,HWND_DESKTOP,nil,0,123,nil);
WinSetFocus(HWND_DESKTOP,WinWindowFromID(FrameWindow,1));

while WinGetMsg(anchor,QueueMsg,0,0,0) do WinDisPatchMsg(anchor,QueueMsg);
WinDestroyWindow(FrameWindow);
WinDestroyMsgQueue(Message);
WinTerminate(anchor);
exit;
end.
=== End hexcalc.pas ===

=== Begin hexcalc.rc ===
/*----------------------------
   HEXCALC.RC resource script
  ----------------------------*/

#include "os2.h"
#include "hexcalc.h"

#define CLIENTCLASS "A"
#define FID_CLIENT 1
#define ID_ICON 1
#define ID_HEXCALC 123

WINDOWTEMPLATE ID_HEXCALC
   {
   FRAME "", 0, 100, 40, 132, 122, WS_VISIBLE,
         FCF_TITLEBAR | FCF_SYSMENU | FCF_MINBUTTON | FCF_BORDER | FCF_TASKLIST
      {
      WINDOW "", FID_CLIENT, 0, 0, 132, 122, "A", WS_VISIBLE
         {
         PUSHBUTTON "A",         18,   8,  84, 20, 14, BS_NOPOINTERFOCUS
         }
      }
   }
=== End hexcalc.rc ===

==> Gerard/2   - member of team os/2 -  1000521{at}ibk.fnt.hvu.nl

--- Fmail/2 1.02 Registered
* Origin: Yet another forgotten area! (2:283/203.18)
SEEN-BY: 50/99 78/0 270/101 620/243 711/401 409 410 413 430 808 809 934 955
SEEN-BY: 712/407 515 517 628 713/888 800/1 7877/2809
@PATH: 283/203 2 512 280/801 270/101 712/515 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.