MS Visual-Studio GUI programming

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
hgm
Posts: 27789
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

MS Visual-Studio GUI programming

Post by hgm »

Recently I obtained the source code of a stand-alone Shogi-variants program (Steve Evans' ShogiVar), written in Visual Basic 3.0. The problem is that the Windows binary of this program (from 1998) no longer works on modern 64-bit Windows versions.

I would like to fix this, even though this might not be easy. Visual Basic evolved into MS Visual Studio, and I have no experience using the latter before. I downloaded a free version of MSVS, but it does not recognize the project (it expects prj files, while the 'master file' of the source I have is a .mak file). It also does not recognize the form definitions (.frm files), which apparenly changed format between VB 3.0 (binary) and VB 6.0 (text), so that when I try to import them in a new project, MSVS complains they are not valid .frm files. So this seems a dead end.

The 'business logic' of ShogiVar, residing in a .bas binary file, was included with the source files as a listing. I converted that listing to C (by hand-editing, as the Basic-to-C converters I could find (BCX and BaCon) crashed on it). So I have that in C syntax now, meaning it compiles virtually without errors. But the way it interacts with the GUI system is not functional; it seems to interact with a C++ system object defined in the .frm files, calling its member routines for hiding / showing objects, moving them around, or drawing lines and circles, which I replaced by a dummy struct upto now.

This method of interfacing looks as if it could still be the same in current MSVC versions. So rather than writing a completely new GUI in Windows API, I wondered if the following would not be far easier: create a new MSVS project, define forms for it as the VB 3.0 code had (where each form contains two timers, bitmap images for all the pieces, board squares for rendering them and a menu bar), by recreating it from scratch, (importing the .bmp files into it, which I have as separate files). And then import the hand-translated C code (after a few adaptations to use the MSVC interface again).

Could anyone with experience in MSVC GUI programming tell me if this sounds feasible (and sufficiently easy)? I was hoping someone with MSVS would be interested enough in this to cooperate with me in reviving this classic program.

Image

Image
mar
Posts: 2554
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: MS Visual-Studio GUI programming

Post by mar »

I'm not an expert but I can say the following:
- The only GUI framework in MSVS (C++) I know of is MFC, which I consider the worst framework ever made (I had the pleasure to work with it for some time)
- MFC is not supported in express editions.
I know nothing of VB but obviously the problem is that the application is very old 16-bit mode executable so the only zero-effort solution is to use a virtual machine.
Another thing worth looking at may be C#, but I have literally zero experience with that.
So I fear you may end up rewriting the GUI using WinAPI or use another existing GUI framework (Qt, ...).
But maybe I missed some simple solution and someone could correct me...
User avatar
SMIRF
Posts: 91
Joined: Wed Mar 26, 2014 4:29 pm
Location: Buettelborn/Hessen/Germany

Re: MS Visual-Studio GUI programming

Post by SMIRF »

There has been a VB5 to RealBasic converter. RealBasic today will be called Xojo. It is able to compile sources for Windows, Mac or Linux.

Whether those tools still will be working today is not sure. Maybe there will be some knowing experts in the Xojo forum.

http://www.macworld.com/article/1016599/realbasic.html
https://forum.xojo.com/
Joost Buijs
Posts: 1563
Joined: Thu Jul 16, 2009 10:47 am
Location: Almere, The Netherlands

Re: MS Visual-Studio GUI programming

Post by Joost Buijs »

It may be possible to use the 'Windows Forms' framework from .NET which has a lot of things in common with VB forms.
.NET is highly C# oriented but in pre VS2012 versions you can create a project supporting C++ and WinForms very easily.

'Microsoft Foundation Classes' (MFC) is another option, when looking at the pictures the program seams to have a very simple GUI, it should not be too difficult to create something like that under MFC.
Henk
Posts: 7216
Joined: Mon May 27, 2013 10:31 am

Re: MS Visual-Studio GUI programming

Post by Henk »

Probably best is to choose Visual C# WPF application.
User avatar
velmarin
Posts: 1600
Joined: Mon Feb 21, 2011 9:48 am

Re: MS Visual-Studio GUI programming

Post by velmarin »

Crafty GUI is Visual Basic 6.
In readme:

Code: Select all

How I did this:
First point is that I didn't use such a method as the Winboard or any similar software would use to intercommunicate with a chess engine. That is using Windows API to communicate with a console application (the STDIN and STDOUT pipe system).
 
Instead - I modified the Crafty source code to make it into a Windows Dynamic Link Library file “craftychess.dll” and communicate with a "Visual Basic 6" compiled “crafty.exe” file (that is the interface) by using function pointers.

http://nchess.eu/crafty/
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

Re: MS Visual-Studio GUI programming

Post by sje »

Consider re-writing the GUI using GTK+

http://en.wikipedia.org/wiki/GTK%2B
http://en.wikipedia.org/wiki/List_of_la ... for_GTK%2B

Then the GUI at least will be portable across Windows, Mac OS/X, and X Windows.
User avatar
stegemma
Posts: 859
Joined: Mon Aug 10, 2009 10:05 pm
Location: Italy
Full name: Stefano Gemma

Re: MS Visual-Studio GUI programming

Post by stegemma »

I still use Visual Basic 6.0, i think that i can try to import the old project and then save the forms in text mode, instead of binary. VB 6 compiled exe runs fine in any windows platform (almost mine does).

If you want, you can send me the project and i give you back converted and compiled... if it's possible.
User avatar
hgm
Posts: 27789
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: MS Visual-Studio GUI programming

Post by hgm »

Yes, please! I think that would greatly help me along if you could save the project in a more modern format.

You can download the source code from http://hgm.nubati.net/ShogiVar.zip . The project master file is shogi15.mak .
User avatar
stegemma
Posts: 859
Joined: Mon Aug 10, 2009 10:05 pm
Location: Italy
Full name: Stefano Gemma

Re: MS Visual-Studio GUI programming

Post by stegemma »

hgm wrote:Yes, please! I think that would greatly help me along if you could save the project in a more modern format.

You can download the source code from http://hgm.nubati.net/ShogiVar.zip . The project master file is shogi15.mak .
I'm downloading it right now... i'll try it today and let you know very soon.