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-25 00:26:31 PST Newsgroups: comp.lang.ada Path: nntp.gmd.de!news.rwth-aachen.de!news.rhrz.uni-bonn.de!news.uni-stuttgart.de!rz.uni-karlsruhe.de!xlink.net!howland.reston.ans.net!news.sprintlink.net!crash!telesoft!east.alsys.com!news From: jlo@east.thomsoft.com (John Lo) Subject: Re: Windows Programming With ActiveAda for Win32s Message-ID: Sender: news@thomsoft.com Organization: Thomson Software Products (formerly Alsys) X-Newsreader: Date: Fri, 24 Mar 1995 19:41:58 GMT Date: 1995-03-24T19:41:58+00:00 List-Id: charliel@ansel.intersource.com (Charlie Lenahan) writes: >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??? > I assume your stated .rc file content has a typo. It should be: dialog_name DIALOG ... Anyway, I suspect you .rc file may #include a .h header file which defines dialog_name to some constant value, eg. "#define dialog_name 200". Thus the dialog template has the resource ID of 200 and not the C string "dialog_name". To specify resource template ID of 200 in your call to CreateDialog, you need something like: function MAKEINTRESOURCE is new UNCHECKED_CONVERSION (INTEGER, LPCTSTR); and then dlghnd := CreateDialog(inst, MAKEINTRESOURCE(200), prt, Convert(DlgProc)); Alternatively, if you remove "#define dialog_name 200" from you .h header file, the resource template ID will become "dialog_name" and your code should work as is. John Lo