comp.lang.ada
 help / color / mirror / Atom feed
* Windows Programming With ActiveAda for Win32s
@ 1995-03-21 18:32 Charlie Lenahan
  1995-03-22 14:59 ` jjj@sage.inel.gov
  1995-03-24 12:39 ` Mitch Gart
  0 siblings, 2 replies; 5+ messages in thread
From: Charlie Lenahan @ 1995-03-21 18:32 UTC (permalink / raw)


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???




^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: Windows Programming With ActiveAda for Win32s
@ 1995-03-24 19:41 John Lo
  0 siblings, 0 replies; 5+ messages in thread
From: John Lo @ 1995-03-24 19:41 UTC (permalink / 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



^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: Windows Programming With ActiveAda for Win32s
@ 1995-03-24 19:51 John Lo
  0 siblings, 0 replies; 5+ messages in thread
From: John Lo @ 1995-03-24 19:51 UTC (permalink / 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.
>

As for the issue of MakeProcINstance, this is what Win32 API Reference
(which is included on-line with ActivAda for Windows) says:

"The MakeProcInstance function is obsolete. Win32 functions can be called
directly. This function is provided in Win32 only for compatibility with 
earlier versions of Windows. Win32 applications should not use this 
function." 

John Lo



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1995-03-24 19:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
  -- strict thread matches above, loose matches on Subject: below --
1995-03-24 19:41 John Lo
1995-03-24 19:51 John Lo

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