cht_may2007.gif

May 14, 2007

Registering A .NET DLL (Assembly) For Use

Here is a brief set of instructions on how to register a ".NET Assembly" such as HNDNETSMTP.DLL, to be ready to use with your Clarion applications. We've tested this here on a couple of non-development machines with good success.

While this is a "manual" process, much like using REGSVR32 to register an OCX, the obvious way to do this kind of regisration is via installer. We'll do that for you eventually, but for the time being, we need you to be aware of what the steps are - including installing .NET Framework 2 - so that when you decide to use one of our .NET DLLs in your application, you know exactly what it takes to get it running on your customer's systems.

STEP 1: Determine if .NET FRAMEWORK 2 is installed on your system.

You can determine this simply by shelling to DOS into your computer's root directory and typing:

DIR REGASM.EXE /S

The following DOS window illustrates the results of that. Note that this test machine has variants of .NET 1 installed. The one that were after here is the .NET 2 directory listing on our machine as follows:

c:\windows\microsoft.net\framework/v2.0.50727


regasm001.gif

If you do find Framework 2 installed on your hardware, then you're almost done, please skip to STEP 3.

STEP 2: Download the .NET FRAMEWORK 2 Redistributable Install

You only need the .NET install that contains redistributables. Here is a direct link to the file you need:
DOWNLOAD AND INSTALL .NET FRAMEWORK 2 REDISTRIBUTABLES

Install this and do a reboot as suggested by the framework installer.

STEP 3: With the .NET FRAMEWORK 2 installed, return to the DOS prompt and repeat STEP 1.

You should see a listing for REGASM.EXE as in the image provided in STEP 1. Once you find the location of REGASM.EXE, switch into that directory, and still from the DOS prompt type - all in one line - as follows:

regasm /tlb:c:/clarion6/bin/hndnetsmtp.tlb c:/clarion6/bin/hndnetsmtp.dll /codebase c:/clarion6/bin/

The exact path you'll use is, obviously, up to you depending on where your Clarion 6 is installed. If you decide to put the DLL we've provided - HNDNETSMTP.DLL - somewhere else on your machine, you can do that too. Just adjust the REGASM paths to point to the exact location of the DLL.

When you finally type the regasm command as above, you'll get a response similar to this one:


regasm002.gif

That's it you're done. At this stage you can compile the HNDSMTPNETDEMO.APP we've provided, run it, complete the SMTP config dialog, fill in a target email address and click "Send".

As mentioned earlier, we'll make this easier for you down the line. We're trying to keep the steps out in the open so you'll be familiar with them and it will not seem so much like "magic" as a few simple steps that you understand.

To assist with your customer installations we're going to provide some extra dialog steps in our HNDSETUP.APP install generator to detect the target .NET Framework (and help install it if not found) and then to register any required assemblies on the target hardware. If you plan on using "SetupBuilder" to build your customer installs, and I know many of you do, you'll need to talk to Friedrich Linder to see if he plans on including ".NET Assembly Registration" as a capability in SetupBuilder. In fact we'd be surprised if it's not already in there.

Feel free to post questions and experiences with the above technique on the CHT Forum.

Cheers...

Gus Creces
The Clarion Handy Tools Page
www.cwhandy.com
gcreces@gmail.com
May 14, 2007


May 12, 2007

.NET Interop In CHT Build 11B1.01

You probably remember the forum postings I did some months ago regarding .NET INTEROP. If not, or if you'd like to review that discussion, the links to that are here and here also and finally, here.

.NET interop is a technique, whereby we build .NET DLLs that utilize a wide variety of capabilities built into the .NET FRAMEWORK. These DLLs are capable of exposing their functionalities via standard COM (Component Object Model). CHT can access these COM capabilites via specially built CHT interface classes such as the one included with build 11B1.01, called HNDNETSMTPCLASS which you can find in /clarion6/libsrc/ library files HndNetSMTP.INC/CLW/TLB.

To introduce the concept to you and get you to the point of understanding what's required to run an app that includes .NET INTEROP DLLs, I've built a demonstration application called HNDSMTPNETDEMO.APP. The application sends SMTP email with a single attachment. It includes an SMTP setup dialog, an attachment button, and a send button. Complete the SMTP configuration, enter a recipient address, a subject and a message and click SEND. Bingo, you're using .NET capabilities in a Clarion application.

It may not be that simple, unless with XP you have the run-time elements of at least .NET Framework 2 installed on your test machine. If you're running VISTA, this is not required since VISTA ships with the latest .NET Framework already installed. This Framework provides the O/S environment in which .NET runs. You can read more about that here and you'll also find links to the run-times for .NET 2 and 3. If, when you compile and run the demo application, it complains about not being able to make a COM connection, you'll need to install a .NET Framework. I'd appreciate hearing from you with specifics if you can't get this to run. This is, after all, a trial application and a trial .NET DLL. If your interested, or just curious, give it a test and let's see what happens.

Here then, is the application interface. There's a reminder about needing Framework 2 or 3 and you can click on the link provided to take you directly to the same .NET site linked to above.


netsmtp001.gif

Cheers...

Gus Creces
The Clarion Handy Tools Page
www.cwhandy.com
gcreces@gmail.com
May 12, 2007


May 11, 2007

Build 11B1.01 Posted

We've just posted a minor build update numbered 11B1.01.

This completes the changes to INI-IO Redirection and includes a DLL based application to illustrate how to apply INI Redirection on a DLL application. The app provided comes in four pieces:
1) HNDSCRIPTERDLL001.APP
2) HNDSCRIPTERDLL002.APP
3) HNDSCRIPTERDLL003.APP
4) HNDSCRIPTERDLLEXE.APP

They must be compiled in the order illustrated 1 through 4. The fourth APP produces the EXE and it's the only one that has to implement the INFILE template prompt for INI I/O redirection. The EXE also owns the INITableIOProcedure.

To see how to use this on a single EXE app (and with SQL) look at HNDACCES.APP. If this app doesn't run correctly for you, your ODBC settings may be pointing to the wrong data base file. They should be pointing to clarion6/hndapps/mdb/northwind.mdb . In the past, this app let you choose your own northwind.mdb since we're just using the standard tables in that demo. This variation of the app requires that the correct .MDB be used. If you encounter a problem try deleting this Registry Key Entry after closing the app:

HKEY_CURRENT_USER/Software/ODBC/ODBC.INI/NorthWindMDB

Then run the app and it will restore this same key entry with the correct location of the NORTHWIND.MDB

We've also made some revisions to the new template EmbedViewEx with some suggestions made by Kelly Major. Please look at HNDCOLOR.APP in the procedure called ColorConfiguratorMain() for an example of how to apply the template.

There's a new demo app, a new class and new template in this build that needs some more lengthy explanation that I'll bring you up to date on Monday. It's the first example of Clarion .NET Interop that I told you I'd be introducing in 2007.

Cheers...

Gus Creces
The Clarion Handy Tools Page
www.cwhandy.com
gcreces@gmail.com
May 11, 2007


May 1, 2007

Off-Line-Template Help

A change has been made to how HNDBRWCL.EXE, the support forum client, displays help. In the past, when you clicked any "About This Template" tab (see image below), the "CHT Hybrid Web Client Application" shelled out to the web to display available information about that template. If you were working in an unconnected state, this could potentially have presented you with an error, depending on whether your machine was able to connect to the internet or not.


abouttemplate.gif

Now when you click "About This Template" if your computer is off-line from the internet, the application doesn't attempt a connection. It looks up the required help information locally in your /3rdparty/hnd/html/ directory in a file called CHTTEMPLATES.HTML. This file may not be as up-to-date as the one we continually re-post on the web, but at least you'll get an immediate response.

Zip N' FTP, Zip N' Email Applications

These demo applications have had a new capability added that helps you build zips from numerous directories. Now, you can double click on the "Source Files Folder" to bring up a "Select Files" dialog. With that dialog you can navigate your drive to point to files required to be in the zip. When you click "Select" on this dialog, the files selected are copied into your "Source Files Folder" where they are accumulated, in preparation for the Zip (F5) command.


zipnemail.gif

HNDHTTP Can Send Extra, Custom Header Information

When your app performs an HTTP request of any sort, it's sometimes useful to send along some extra information that the server can put to use. What exactly this information is, obviously is up to you. Though it must be limited to 25 characters per header item. And multiple items per HTTP header are certainly possible. You can add, remove and free the information going into any HTTP header using several new HNDHTTP commands as follows:

HNDHTTP.AddUserCustomHeader PROCEDURE (STRING xToken, STRING xValue)
HNDHTTP.RemoveUserCustomHeader PROCEDURE (STRING xToken)
   !Returns true if removed, false if not removed.
HNDHTTP.FreeUserCustomHeaders PROCEDURE ()

Example use: If you're going to do a fresh request, your sequence of coding might be as follows:

HTTP.FreeUserCustomHeaders()
   !Get rid of any entries from prior Requests.
HTTP.AdduserCustomHeader('Product-Version:', MyCode.GetProductVersion())
IF HTTP.ThinClientLogin() THEN
   !Your code here.
END

Now when the user logs in you can pick up the value of 'Product-Version:' on the server side with this request:
ProductVersion = Server.ExtractHttpBufferItem('Product-Version:')

Where you pick this particular bit of information (embed-point-wise) on the server side depends on what actual client request sequence you're riding along with. In this case we're sending the information with a login request, so we can pick up the information server-side, in any of these server functions:

AcceptLoginForm PROCEDURE(STRING xLastName,STRING xEmailAddress,STRING xSerialNumber,STRING xUserIP),BYTE,PROC,DERIVED
   ! Method added to host embed code
TakeLoginDetailsRequest PROCEDURE(),BYTE,PROC,DERIVED
   ! Method added to host embed code
ValidateLoginForm PROCEDURE(STRING xLast,STRING xEmail,STRING xSerial),BYTE,PROC,DERIVED
   ! Method added to host embed code

New Version Of WEBUPDATER

Today, we've posted a new version of WEBUPDATER. It identifies itself as follows:


webupdaternew.gif

This WEBUPDATER now identifies itself (its version and subversion) to our server by sending it's version number and the unique ID of the machine on which it is installed. The server can act on that if the version number is out of date and direct you to our download site to get a new one. Since WEBUPDATER is auto-updating, the user's WEBUPDATER version should always be up to date, but I know that in the last 6 months at least one WEBUPDATER version got released in which the self-update capability worked only intermittently. This will help me work the buggy ones out of the system by the fact that the older ones don't identify themselves.

We're also going to begin enforcing our maximum three installs per developer account rule. As of this new updater, we're recording the unique ID of the machine on which you're installing. As long as this is three or under, you won't hear a peep from us. If it goes above that, because say, your laptop died and you're transferring to another machine, we'll ask you to give us the unique ID of the machine being taken out of service (a utility will be provided to do that with), we'll remove that machine from the record and you're good to go again. Starting July 2007, if a fourth unique machine tries to do an update, our update server will re-direct to a web page that explains the situation and which asks you to contact us to either retire one of the machines or purchase an ancillary license.

That's all for now. More What's New Info to come in a separate posting. Any questions, feel free to ask.

Cheers...

Gus Creces
The Clarion Handy Tools Page
www.cwhandy.com
gcreces@gmail.com
May 1, 2007


Add me to your 

hnd_dozen.gif

chtcopyright.gif
What's New - May 2007
chtlogo001.gif
What's New - May 2007