comp.lang.ada
 help / color / mirror / Atom feed
From: mg@asp.camb.inmet.com (Mitch Gart)
Subject: Re: Windows Programming With ActiveAda for Win32s
Date: Fri, 24 Mar 1995 12:39:46 GMT
Date: 1995-03-24T12:39:46+00:00	[thread overview]
Message-ID: <D5y36A.JKz@inmet.camb.inmet.com> (raw)
In-Reply-To: 3kn64g$209@ansel.intersource.com

Charlie Lenahan (charliel@ansel.intersource.com) wrote:
: We are trying to Use ActiveAda for Windows 5.1.3 to Create a Dialog Box. 
: Regular Windows Programming you must use a call to MakeProcINstance before you
: call CreateDialog(). How do you Get around this by using the address of the 
: callback function for that dialog box.

: Inst:Handle:=GetModuleHandle(C_NULL);

: DlgHnd:Hwnd;

: Dlgproc:lpvoid:=package.dlg_proc'address;

: prt : hwnd;

: begin

: prt := CreateWindowEx();

: dlghnd := CreateDialog(inst, CString("dialog_name"), prt, Convert(DlgProc));

: ...

: end;

: .rc file ...
: DIALOG dialog_name ...

: This is the general concept we have been attempting.  The dlghnd is not created
: and a call to GetLastError returns 87 - Invalid Parameter.  What are we doing wrong???


MakeProcInstance is an odd beast.  It's needed for 16 bit Windows C
programming and still exists, but is a no-op, for 32 bit Windows C
programming.  What it does in 16 bit Windows C programs is create a
"thunk", a small piece of dynamically created code, and then it 
returns the address of the thunk.  When your program calls the thunk,
the thunk code sets the DS (data segment) register to the right value
and then branches to the function for which MakeProcInstance was originally
called.  This all ties into the C "large model" where 16-bit programs
can have more than one 64K byte data segment.  It all goes away with
32 bit Windows.

In Ada MakeProcInstance may not be necessary, even on 16 bit Windows, because 

- Alsys requires that only top-level subprograms be used for 
  callbacks.  This means library subprograms or subprograms declared
  at the outer level of a library package.

- I *think* I recall that Alsys has just one 64K global data segment,
  not multiple segments like large model C.  

I'm not sure about the second point, you should ask Alsys.

	Mitch Gart



  parent reply	other threads:[~1995-03-24 12:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-03-21 18:32 Windows Programming With ActiveAda for Win32s Charlie Lenahan
1995-03-22 14:59 ` jjj@sage.inel.gov
1995-03-24 12:39 ` Mitch Gart [this message]
  -- strict thread matches above, loose matches on Subject: below --
1995-03-24 19:41 John Lo
1995-03-24 19:51 John Lo
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox