From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f95357b07ebf392d X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1995-03-24 04:39:46 PST Newsgroups: comp.lang.ada Path: nntp.gmd.de!stern.fokus.gmd.de!ceres.fokus.gmd.de!zib-berlin.de!news.mathworks.com!udel!gatech!news-feed-1.peachnet.edu!paperboy.wellfleet.com!noc.near.net!inmet!asp!mg From: mg@asp.camb.inmet.com (Mitch Gart) Subject: Re: Windows Programming With ActiveAda for Win32s Message-ID: Sender: news@inmet.camb.inmet.com Organization: Intermetrics, Inc. X-Newsreader: TIN [version 1.1 PL8] References: <3kn64g$209@ansel.intersource.com> Date: Fri, 24 Mar 1995 12:39:46 GMT Date: 1995-03-24T12:39:46+00:00 List-Id: 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