From: alouw@dos-lan.cs.up.ac.za (Andre Louw)
Subject: Visual Basic and C++
Date: Mon, 12 Oct 1992 11:13:27 GMT
Organization: Computer Science Department, University of Pretoria
Keywords: VB, C++, Windows GUI development

I'm posting the responses I got regarding the VB and C++ compatibility issue.

Firstly I want to thank all those who replied (also those who's reponses 
aren't included - I suspect that I did't get all the replies due to email 
problems...).

Refer to the end for my personal remarks regarding this issue...


From: dusan@sooner.b17a.ingr.com (Dusan Doliak)
Message-Id: <199209301435.AA00323@sooner.b17a.ingr.COM>
Subject: Re: Help needed with VisBasic and C++
To: alouw@dos-lan.cs.up.ac.za
Date: Wed, 30 Sep 92 9:35:48 CDT
X-Mailer: ELM [version 06.03.01.00 (2.3 PL11)]

*******************************************************************
* Dusan Doliak      * Intergraph Huntsville * mail                *
*                   * (205)730-1304         * sooner@dusan.b17a.  *
*                   * USA                   * ingr.com            *
*******************************************************************
Hi, 

>1) Is there any way which we can use Visual Basic (to create the user
>interface) and link it (in some way) with C++ code...?? I know that
>you can make .DLL calls from Visual Basic but it doesn't look
>possible to export classes via .DLL's and use it in VB - is this true?

Yes it is. Other way how to work with classes in VisualBasic is create
.VBX files, what need time. E.g.: Your structure is probably like:
person
{
  ID 
  name
  position
  sex
  ...
  ID of boss
}
and operations like display record,
		    browse records,
		    select where ...
you can crete .VBX with user control like child window, containing
everything. This way is possible, but complicated.

>2) How difficult is it to access DBM via VB and are there any reliable
>tools which one can use to do this...???
It's not so bad. If you have any program, which access DBM in Windows
you can use Sourcer (about 49$, or nearest BBS) to list functions in
DLL. Then calling functions is simple and well documented.

>3) Is this a sensible thing to do (in other words, can we expect
>trouble if we continue with VB)
I used DLL like Paradox Engine or CodeBase. Cheap and powerfull.
If you want to sell it you have to be compat. with lot formats.
Other way take the best one. Problem of VisualBasic is, that creating
window (form) is terribly slow. At very good machine it took me about
1.5 min to download all my forms from disk. And to create some controls
like multicolumn listbox is sometimes cheaper to buy .VBX.
>or should we just stick to using
>something like Microsoft Quick C for Windows or Microsoft C 7.1 with
>the Windows SDK??? (the latter being the more secure - but much more
>tedious and time consuming...!)
Don't do it. Easier is usage of Borland C++ or Pascal for Windows.
There is not implemented everything but what's there is easy to use.
Not so easy as VisualBasic, of course.
>Note: It's not a very big, complicated program but it's also not simple
>enough to do it completly in VB (I think) - we have to provide some
>basic bookkeeping facilities like 3 column accounts etc.

>4) If not VB - are there any suggestions for other tools which will
>enable us to access DBM and still allow us to develop in C++...??
Yes. I heard about Windows Maker professional and CASE/W. First one
is object oriented second not.

>:) Andre

Let me know your decision. If you need any help, let me know.
						Dusan

-- 
*******************************************************************

From: neliac@microsoft.com
Message-Id: <9209291959.AA15160@outmail.microsoft.com>
To: @ford.ee.up.ac.za:ALOUW@dos-lan.cs.up.ac.za
Date: Tue, 29 Sep 92 12:39:12 PDT

|The Problem...
|==============
|I'm working on a project called SSSAdmin (Staff Share Scheme
|Administrator) which must be done in Windows (3.1 preferably)! This
|program must be able to retrieve data from OS/2 Database Manager
|(DBM) - which means we must be able to start a windows client for DBM.

You can start a windows client using the shell (to run any other 
application) and then activate app it. You can send it keystrokes, or 
if you need more, you can exchange info via DDE if you have set up your 
app using the client/server model. I am not sure what you will 
interface with on the OS2 side, because VB can only talk to windows apps.

|
|At this stage I have developed a prototype in MS Visual Basic which I
|have found to be a very nice tool for developing the User Interface
|(UI) in and together with the Professional Developers Toolkit you are
|able to design nice 3D look and feel GUI's.
|
|At first the idea was that when the prototype was done we would start
|all over again with something like Borland C++ and OWL to to create
|the user interface for the final product. The problem is that time is
|starting to run out and it seems that we can save a lot of time if
|we would continue to use Visual Basic...
|
|
|A few questions...
|==================
|1) Is there any way which we can use Visual Basic (to create the user
|interface) and link it (in some way) with C++ code...?? I know that
|you can make .DLL calls from Visual Basic but it doesn't look
|possible to export classes via .DLL's and use it in VB - is this true?
|
It sounds like there is not any difference between linking C or C++ 
code. I.e. you compile both into a dll. The C++ exported functions need 
to be declared just like you would exported C functions (somehow). 
Regarding data, it sounds like you have to duplicate the data structure 
in VB (typedef it) so that VB knows how to interpret the data. It does 
not know about exported C++ classes directly.
Side note: We have found that duplicated data structures is a pain to 
maintain. But you have to make the trade-off, depending on the number 
of data types you have and the coding effort you can save.

|2) How difficult is it to access DBM via VB and are there any reliable
|tools which one can use to do this...???
The guy said VB can only talk to other windows apps. Did not know of a 
way to interact with OS2. It sounded like you could send keystrokes to 
a shell app, but in reality I think you'll need more than that.
This may be a little far fetched, but there are windows libraries for 
OS2, that will provide a support layer for windows apps to run on OS2. 
The dlls basically translate windows APIs to Presentation manager APIs. 
I'm not sure how much data exchange the WLO dlls implemented.

|3) Is this a sensible thing to do (in other words, can we expect
|trouble if we continue with VB) or should we just stick to using
|something like Microsoft Quick C for Windows or Microsoft C 7.1 with
|the Windows SDK??? (the latter being the more secure - but much more
|tedious and time consuming...!)
|Note: It's not a very big, complicated program but it's also not
|simple
|enough to do it completly in VB (I think) - we have to provide some
|basic bookkeeping facilities like 3 column accounts etc.

Did not ask PSS. I would think that as long as you can write 
specialized code in C++ and then interface that with the UI in VB, 
you're OK. If your user interface is simple, eg picking menu options 
and running dialogs, then you're OK using VB. But if you are trying to 
do complicated mouse/drawing interactions, multiple data windows or 
specialized functions like palette management then are probably better 
off switching to the SDK.

Hope this helps.
--Nelia

From: Russell Johnson <rjohnson@athena.cs.uga.edu>
Message-Id: <9209292205.AA12653@athena.cs.uga.edu>
To: alouw@dos-lan.cs.up.ac.za
Subject: Re: Help needed with VisBasic and C++
Newsgroups: comp.os.ms-windows.programmer.tools,comp.os.ms-windows.apps,comp.lang.c++
Organization: University of Georgia, Athens
Cc: 


I'm sorry i can't give you a very good answer to your question.  You might
find hope in the fact that a great deal of Windows programmers are doing
just what youv'e described: linking a VB front end and a C, C++, Pascal
engine.  There are very few problems associated with DDE or any other
format concerns.  I'd be much obliged if you could forward me any info
you get on this as i'm interested in this very efficient and intuitive
symbiosis b/w VB and C++.

 |--------------------------------------------|----------------------------| 
 |    I would've gotten away with it too,     |      Russell M. Johnson    |
 | If it hadn't been for those meddlin' kids. | rjohnson@athena.cs.uga.edu |
 |--------------------------------------------|----------------------------|   
 |   -Famous Last Words from a variety of would-be villains foiled once    | 
 |         again by the clever detective work of Scooby and friends.       |
 |-------------------------------------------------------------------------|


From: simmons@vis.citri.EDU.AU (Stephen Edward Simmons)
Message-Id: <9209300219.23283@krang.vis.citri.EDU.AU>
To: alouw@dos-lan.cs.up.ac.za
Subject: Re: Help needed with VisBasic and C++
Newsgroups: comp.os.ms-windows.programmer.tools,comp.os.ms-windows.apps,comp.lang.c++

Andre,

If you want to switch to C/C++ without losing all the work put into
designing the VB forms, the utility
	
	VBRC10.ZIP    in <MSDOS.VISBASIC> on oak.oakland.edu

can create RC scripts from the VB forms.

I haven't tried it, so I cannot vouch for its usefulness.

Stephen

From: mobrien@telesciences.com (Mark W O'Brien)
To: alouw@dos-lan.cs.up.ac.za
Subject: Re: Help needed with VisBasic and C++
Newsgroups: comp.os.ms-windows.programmer.tools,comp.os.ms-windows.apps,comp.lang.c++
Organization: TeleSciences CO Systems, Inc.

In article <alouw.23.717785642@dos-lan.cs.up.ac.za> you write:
>
>Hi, 
>
>I'm desperately seeking advice for a project I'm working on and I would 
>appreciate it if anyone can help out by answering some of the questions 
>below...
>
Andre,

	If you go the C++ route, take a look at VBRC.EXE which is a utility
	which extracts dialog templates from your Visual Basic forms. This
	has been useful in doing VB-C/C++ ports in that dialogs need not be
	re-drawn.

	It's available at ftp.cica.indiana.edu (129.79.20.84) by anonymous ftp.

	Look for VBRC10.ZIP in either /pub/pc/win3/uploads or 
                                      /pub/pc/win3/programr/vbasic

 			Mark O'Brien
			mobrien telesciences.com

-- 
 _______________________________________________________________________
								
  The opinions expressed are not necessarily those of TCO Systems, Inc.
 _______________________________________________________________________


Personal Remarks:
=================

The majority of responses were not contributions but people requesting more 
info which shows that there is indeed a great need for information of this 
kind - so if there is anybody out there with additional info - PLEASE do not 
hesitate to reply to this group...!

Regarding Visual Basic: 
-----------------------
I think this is one of the most elegant prototyping tools for windows which 
I have used so far. You can give your GUI a very sophisticate 3D look-and-
feel when using it with the Professional Developers Toolkit. It is very easy 
to use and has nice built-in functions (eg. time and date functions) and the 
language itself has come a long way from the GWBasic/Basica I knew years 
ago - it also provides you with a lot of OO features such as objects and 
their properties, methods, events etc. 

Microsoft also provides a Product Support Service (PSS) - (their number 
Tel: 206 - 454 2030). The other really nice thing about VB is that there 
really is alot of users out there which means good support by means of third 
party Add-Ons - I got a list of 15 pages with the names of componies and 
Custom Controls and .DLLs!!! There's also a lot of tools/custom controls to 
help you get access to almost any database...

Although you can link with C, Pascal, Modula etc. via DLL's it not really 
possible to link the VB GUI with pure C++ (anyway not the way I understand 
it). There are ways of linking C++ code which doesn't make use of multiple 
inheritance, operator overloading and those type of envolved OO features by 
methods described/suggested above (eg. keeping duplicate structures and 
exporting methods via C function calls...) - not the way to tackle a project 
with more than 10000 lines of C++ code...!

Conclusion:
-----------
Because of the time limit on this specific project and the fact that we live 
in South Africa (which mean we have to wait a little longer to get out hands 
on software) forced us to go the less elegant/more painfull way of using 
Borland C++ with OWL... I'm sure if we had more time for experimentation we 
would have found a way of hooking VB with C++ and OS/2 DBM... 

Stephan and Mark both suggested I use a tool called VBRC ver 1.0 to extract 
dialog templates from my VB forms. This works quite well except for the fact 
that I used the Professional Toolkit specifically for the 3D effect and VBRC 
doesn't provide facilities to use the .VBX (Visual Basic eXtention) files.
If anybody knows of a method to do this or know of a newer version of VBRC 
that can do this - PLEASE let me know...!

VZ Programmer:
--------------
I also mentioned something about VZ Programmer a while ago - this being a 
sort of Visual C++ but the only replies I got were from other people wanting 
the same - more info on the product... Please post any info you might have 
on VZ Programmer

:) Andre

alouw@up.cs.ac.za (Department of Computer Science @ University of Pretoria)
Fax: +27 12 436454
Tel: +27 12 4203654