Thursday, November 29, 2007

Build 172

SET BELL has been added to Guineu. SET BELL ON|OFF is supported as is SET BELL TO [filename]. Both work on the desktop and on mobile devices with sound support. Currently, the only limitation is that the WAV file must be an external file. Embedded files are not yet supported.

Build 171

The manual has been updated to reflect that GuineuIDE is now the preferred method to use Guineu. You can still use Guineu.EXE to directly run an FXP, if you wish. I think, though, that compiling a project with SCXes, VCXes and PRGs into a single EXE is closer to what most developers actually want to do. GuineuIDE only runs in Visual FoxPro 9.0 which is now checked when you start GuineuIDE. The Build menu itself remains enabled even if there's no project open.

Most changes in this build are internal stuff. For instance, I enhanced the way that variables are internally managed, fixed several issues that Code Analysis in VS.NET 2008 flagged, and the like.

Friday, November 16, 2007

Build 168

Fixed #47: Implemented the PageCount property for pageframes. Assigning a value now automatically creates the desired number of pages. Forms with pageframes can now be compiled with GuineuIDE.

Thursday, November 15, 2007

Build 167

ERASE and COPY FILE are two new commands in Guineu.

ERASE supports the RECYCLE clause to move files into the recycle bin. I haven't it tested on platforms other than Windows desktops yet. Guineu supports ERASE ?, as well as the undocumented ERASE "". Both let the user interactively choose a file.

COPY FILE copies files. SET SAFETY is not yet supported. If the destination file exists it is overwritten. There might be some scenarios that do not yet work the same as in VFP. COPY FILE in Guineu does not work on embedded files.

Build 166

I implemented various font properties: FontName, FontSize, FontBold, FontItalic, FontUnderline and FontStrikeThru. The properties are available in Form, Label, CommandButton, Checkbox, Combobox, Listbox, Page, Editbox and Textbox.

As a .NET application, Guineu uses GDI+ to display text. Therefore the precise dimensions of text might slightly differ from what you see in Microsoft Visual FoxPro™.

Tuesday, November 13, 2007

Build 165

This build contains all samples I've shown in the past weeks at Southwest Fox 2007 and the German DevCon 2007 in Frankfurt. Here's a brief overview on what has changed:

Guineu.sql.dll is a new runtime for Microsoft SQL Server 2005. It can be used to create stored procedures and functions for SQL Server with Guineu. The runtime supports only a subset of the other Guineu runtimes. In particular, it doesn't support any user interface controls such as forms, and the like. The classes work mostly, but you won't see anything. Because this still requires some manual work on the sources, the SQL runtime is not as far as the other two runtimes, yet. I'll work on making the required changes to generate the SQL runtime from the latest version automatically.

The new SQL runtime is used by the SQL 2005 Stored Procedure target that creates an assembly for SQL server and a SQL script to load the assembly into the database. If SQL Management Studio 2005 is installed on your computer, it's automatically launched when you build the project to let you deploy the new version of your library. Currently support for SQL has some limitations. Stored Procedures and Functions cannot receive any parameters and return only numeric or string values. Let me know if you need anything different.

To install stored procedures on SQL 2005 servers you need to perform some configuration. Please note that Guineu requires opening up SQL server 2005 quite a bit in order to run assemblies. You DBA might not like this, so make sure you check before writing too much code. Also, do not install Guineu on any production server. These steps are required to enable Guineu on a SQL server using Northwind as the sample database:

  1. Activate the CLR:

    sp_configure 'show advanced options', 1;
    GO
    RECONFIGURE;
    GO
    sp_configure 'clr enabled', 1;
    GO
    RECONFIGURE;
    GO

  2. Change the compatibility level:

    use master
    go
    exec sp_dbcmptlevel 'northwind', 90
    go

  3. Enable full trust:

    ALTER DATABASE northwind SET TRUSTWORTHY ON

StoredProcedures is a sample project that demonstrates how you can use the context database engine to retrieve data from the database. Even though this code looks like it's going through ODBC it's actually accessing SQL server locally.

Deployment of mobile applications requires one more new DLL: OpenNETCF.dll. You must copy this DLL along with your mobile application and Guineu.compact.dll.

ActiveX Control is a new target in GuineuIDE. It compiles all visual classes stored in VCXes into ActiveX controls and creates a sample HTML page that loads this ActiveX control in Internet Explorer (or your preferred browser if it supports ActiveX controls). You can use these controls in other applications, as well. Right now, ActiveX support has some limitations, though:

  • You can only load one ActiveX control per process. If you have multiple controls currently you must use multiple projects and create multiple DLLs.
  • No methods are made available publically. You can add controls, but you can't access them from the outside.
  • There is a problem in hosting Guineu ActiveX controls inside Visual FoxPro forms.

ActiveX is a sample project that demonstrates a simple ActiveX control with a DBF file. Please note that all tables must be on the local machine that executes the ActiveX control.

Managed Library is similar to the ActiveX Control build target. However, it doesn't generate any COM InterOp code which makes the component only available to managed applications. You can use this library to add controls to a WinForm application, for instance. In the current release, Guineu Managed Libraries do not have designer support. That means, you need to create the control in code and add it to the Controls collection of the form. You can use the ActiveX sample project to create managed libraries, as well.

CompactDatabase is a new sample that demonstrates how you can access Microsoft SQL Server 2005 Compact Edition. This version of SQL server can be deployed by just copying some DLL files and the database file. You don't have to install any server or attach any database. The compact database file can be up to 4 GB in size. The engine runs on mobile devices and Windows desktops.


 

Saturday, November 3, 2007

Build 163

Console Application is a new build target in GuineuIDE. It's similar to Guineu.EXE. When you run a console application, Windows automatically opens a console window (DOS prompt). All output of ? and ?? is directed to this window. You can call the application from Explorer, the CMD prompt or a batch file. Output can be redirected to a file using the ">" operator or piped to a different application:

MyGuineuApp.EXE | MORE

A Guineu console application can create forms which are created as regular windows just like with the Managed Application (EXE) target. Guineu doesn't (yet) have a text based GUI like Microsoft FoxPro® DOS/Unix. When you execute a console application, the console waits for the application to terminate.

Build 162

Fixed #38: SEEK caused an error when the table is completely empty.

Friday, November 2, 2007

Using the Device Emulator

A PDA is a great device if you want to run a Guineu application on the Windows Mobile platform. However, development isn't that easy since you have to permanently copy files to the PDA every time you made a change to the FXP file.

Microsoft's Device Emulator makes this task much easier. There are two ways to get the Microsoft Device Emulator on your computer:

The easy way. Install Microsoft Visual Studio 2005 Standard or any of the higher levels. They come with the Device Emulator. You can use the Microsoft Download page to obtain updates and new images.

The hard way. If you don't have Visual Studio, you can still install the Device Emulator. However, it's not as straight forward and you have less option. In particular, images for Windows Mobile 6.0 seem to be coupled to Visual Studio so that you cannot install them. The same is true for several other images that Microsoft offers for download.

Step 1. If you don't happen to have the Virtual Machine Network Driver for Microsoft Device Emulator installed on your machine, you need to install Microsoft Virtual PC 2007:

http://go.microsoft.com/fwlink/?linkid=46859

You can install Virtual PC 2007 inside a VMWare Workstation instance, but most likely you cannot install Virtual PC inside Virtual PC.

Step 2. Download Microsoft Device Emulator 2.0

http://www.microsoft.com/downloads/details.aspx?FamilyID=dd567053-f231-4a64-a648-fea5e7061303

Step 3. Install the Device Emulator by executing vs_emulator.exe and following the setup instructions.

Step 4. Download the Microsoft Windows Mobile 5.0 image for Device Emulator. You need to download EFP.MSI (57.0 MB) from the following web site

http://www.microsoft.com/downloads/details.aspx?FamilyId=C62D54A5-183A-4A1E-A7E2-CC500ED1F19A

Step 5. Execute the EFP.MSI setup. When you are done, you can run the emulated devices from Start > All Programs > Microsoft Windows Mobile 5.0 MSFP Emulator Images. The first time you have to pick one of the Coldboot files.

Step 6. Use File > Configure… to change the configuration of your simulated PDA. Foremost you want to specify your development directory as a Shared Folder. This maps the folder as a Storage Card on your PDA.

Step 7. Install the latest version of the .NET Compact Framework 2.0 on the new PDA as outline in the documentation. The version you install on the PDA must be the same that you installed on your desktop. You can use the shared folder to transfer files from the Desktop PC to the PDA.

Step 8. Use GuineuIDE to compile your project into a Windows Mobile application. Then open the Storage Card in File Explorer on the PDA. Locate your project directory and click on the application. You can tell the application from the little icon in front of it as file extensions are hidden on the PDA.

When you close the emulator you are given the choice of saving the state. This produces a DESS file in the Device Emulator directory (by default C:\Program Files\Microsoft Windows Mobile 5.0 MSFP Emulator Images). You can copy the DESS file into your project folder and name it like the project. If the project is Sample.PJX, name the DESS file Sample.DESS.

When GuineuIDE finds a DESS file with the same name as the PJX file, it automatically opens Device Emulator with this Stored State file. Assuming that you configured the Shared Folder to be your project directory, this allows you to quickly debug your application on the PDA. DBF files can be opened in VFP and on the PDA at the same time. Only when you build a new Windows Mobile EXE, you need to terminate the EXE on the PDA. You don't have to shut down the Device Emulator, though.

Build 161

Fixed #36, 37: GuineuIDE wouldn't compile a project when either the project path had blanks in it or the main program was an SCX form. Both problems have been corrected.

The build target Windows Mobile Application is now working correctly. In order to compile application, you must have installed the .NET Compact Framework 2.0 on your development machine as outlined in the documentation. You can download the .NET Compact Framework 2.0 from

http://www.microsoft.com/downloads/details.aspx?familyid=AEA55F2F-07B5-4A8C-8A44-B4E1B196D5C0

To verify that the SDK is correctly installed, enter the following path in Windows Explorer. This is the default location of the SDK:

%programfiles%\Microsoft.NET\SDK\CompactFramework\v2.0\WindowsCE

Build 160, GuineuIDE

GuineuIDE is a development tool for running inside Visual FoxPro. To run it, execute the following line in your Visual FoxPro IDE:

DO WhereverYouPutGuineu\GuineuIDE.EXE

The reason I made this an EXE rather than an APP is just so that I can store the version number and later add a different icon. If you launch GuineuIDE in Explorer, you only see the Visual FoxPro Runtime window flickering briefly. The next version will show a dialog to explain how to run GuineuIDE.

Thursday, November 1, 2007

Build 159

Implemented the RUN command. When you pass "/N" as the first parameter, Guineu returns immediately, otherwise it waits for the command to complete. Unlike in Visual FoxPro you don't see a console window.

Build 158


GuineuIDE integrates Guineu with the Visual FoxPro IDE. After executing GuineuIDE.EXE, you will find a new menu item in your Visual FoxPro development environment:




The Build menu item is active when a project is available. Every item in the build menu is a different target that Guineu can create out of your project. Currently only the first two options are enabled. The remaining options will become available within the next week. When a project is compiled, all SCXes and VCXes are converted into PRG files. This conversion support is still a bit rudimentary, so don't use it on your most complex applications.


GuineuIDE uses CSC.EXE (C Sharp Compiler) that is part of the Microsoft .NET Framework to compile the entire project into a single EXE or DLL. All files marked as included in the project are embedded into the generated application (only FXPs are embedded not PRGs). Just like Visual FoxPro, Guineu looks for embedded files before it uses external files. The advantage for you, as a Guineu developer, is that you don't have to ship any external FXP or image files, anymore.


Window Mobile Application – This target creates an application for use with the Microsoft Compact framework. Currently, the path to the Compact Framework SDK is hard coded. I work on that.


Managed Application (EXE) – This target creates an EXE application that can run on any machine with a .NET 2.0 compatible runtime. This includes Windows as well as Linux machines with Mono. The application is a WinForm application which means that you don't get any DOS window as you do with Guineu.EXE.