comp.lang.ada
 help / color / mirror / Atom feed
From: jlo@east.thomsoft.com (John Lo)
Subject: Re: Windows Programming With ActiveAda for Win32s
Date: Fri, 24 Mar 1995 19:41:58 GMT
Date: 1995-03-24T19:41:58+00:00	[thread overview]
Message-ID: <D5yMpz.6qJ@thomsoft.com> (raw)

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



             reply	other threads:[~1995-03-24 19:41 UTC|newest]

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

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