comp.lang.ada
 help / color / mirror / Atom feed
* Bug in GNATCOM?
@ 2001-02-23  0:36 Anatoly Chernyshev
  2001-02-26 23:42 ` David Botton
  0 siblings, 1 reply; 2+ messages in thread
From: Anatoly Chernyshev @ 2001-02-23  0:36 UTC (permalink / raw)


**** Post for FREE via your newsreader at post.usenet.com ****

Hello,

I'd tried to play a little with adatovb sample from GNATCOM package.
First, I changed the VB class in this way:

VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "AdaToVBClass"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Attribute VB_Ext_KEY = "SavedWithClassBuilder" ,"Yes"
Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
Public Sub Display(Message As String, a As Single)
    MsgBox Message & Str$(Sin(0.25) + 915 * a)
End Sub
Public Function Display1() As Integer
    Display1 = MsgBox("What?", vbOKCancel)
End Function

Private Sub Class_Initialize()
MsgBox "You are welcome"
Form1.Show      '--Form1 is mere a "native" empty form
End Sub

Then, I built the Dll and rewrote client.adb:

with GNATCOM.Initialize;
with GNATCOM.Types;
with GNATCOM.BSTR;
with AdaToVB.UAdaToVBClass_Interface; use
AdaToVB.UAdaToVBClass_Interface;
with interfaces.c;
with ada.text_io; use ada.text_io;

procedure Client is
   Object : UAdaToVBClass_Type;
   Msg    : aliased GNATCOM.Types.BSTR := GNATCOM.BSTR.To_BSTR
("Hello");
   fg : interfaces.c.short;
fg1: aliased interfaces.c.c_float;
begin
   GNATCOM.Initialize.Initialize_COM;

   Create (Object, AdaToVB.CLSID_AdaToVBClass);
  for i in 1..2 loop
fg1:=interfaces.c.c_float(i*0.05);
   Display (Object, Msg'Unchecked_Access, fg1'unchecked_access);
end loop;
for i in 1..7 loop
fg:=display1(object);
put ("Reply: " & interfaces.c.short'image(fg));
new_line;
end loop;
   GNATCOM.BSTR.Free (Msg);
end Client;

Everything worked fine except during object initialization the form
didn't appear and I was getting error message:

raised GNATCOM.ERRORS.COM_ERROR : HRESULT (2148139414) :

When I used the same dll from VB program I had no errors though.
I don't know whether it is a GNATCOM bug or my misunderstanding of
something... Any help/ideas on how to correct this point would be
greatly appreciated.

Thanks in advance,
Anatoly


-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 *** Usenet.com - The #1 Usenet Newsgroup Service on The Planet! ***
                      http://www.usenet.com
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=



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

* Re: Bug in GNATCOM?
  2001-02-23  0:36 Bug in GNATCOM? Anatoly Chernyshev
@ 2001-02-26 23:42 ` David Botton
  0 siblings, 0 replies; 2+ messages in thread
From: David Botton @ 2001-02-26 23:42 UTC (permalink / raw)
  To: comp.lang.ada; +Cc: gesture

You should repost your question to the gnatcom list on AdaPower or if you
are working on a professional project contant sales@gnat.com for information
about professional support.

David Botton

----- Original Message -----
From: "Anatoly Chernyshev" <gesture@heaven.org>
Subject: Bug in GNATCOM?


>Any help/ideas on how to correct this point would be
> greatly appreciated.






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

end of thread, other threads:[~2001-02-26 23:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-23  0:36 Bug in GNATCOM? Anatoly Chernyshev
2001-02-26 23:42 ` David Botton

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