Kok Kiet's Blog
About Programming, Visual FoxPro, .NET.
Thursday, June 29, 2006
Thursday, June 08, 2006
Application Loader, Self-Update
Upgrade is a very painful process for desktop application in multi-users environment. We got to update latest EXE, fxp, dbf and etc to ALL user machine by running upgrade program or xcopy them manually.
Some time ago, VFP developers shared programs like "Application Loader" and "Application Updater" which automate the upgrade process. These programs check for any updated files available at LAN/Web server. If any, these files would be copied to local machine, register them if necessary.
With this, users no longer launch our application. Instead, user only launch Application Loader. Application Loader would update files and launch the actual EXE.
Application Loader should be a less maintainance program because we seldom change the logic. However, seldom change meant still got chance we need to change it. We may need to enhance or add more features to it. For example, current version doesn't support COM DLL registration. We wan to build this feature within next few months.
OK, now we back to our old problem. How are we going to update our Application Loader?
I borrowed Les Pinter idea to solve this problem.
Below is the flowchart of my self-update Application Loader.
I am using ShellExec API to launch instance of "latest" Application Loader so that "older" Application loader able to get back control and exit immediatelly.
If you have any comments or suggestions, pls email me. Thank you
Make VFP cool!
There are couple of blogs show how to make VFP look cool! For example : -
- Recreating OneNoteTabs in VFP9
- What I have done with VFP, GDI+, and a ton of help from VFP Community (OR why VFP is COOL)
- ctl32_statusbar - A Status Bar Control Class For Visual FoxPro 9
Some of them are using pure VFP code, and some make use of WINAPIs call.
It just remind me what I did two years ago. Image below is one of the screenshot of my application that make use of listbar control which can be downloaded from UT download section. I make some changes on it and use some bitmaps so that it look XP theme. It is just simple changes.
Figure 1 Outlook bar
Figure 2 Mouse move over the option
Does it really cool? Well, it may not as cool as other tool mentioned above. However, at least, my customer impressed on it and asked : "Are you sure you are using VFP to do this?"
Saturday, June 03, 2006
Reason to use ViewDBC
In my prior post, I mentioned I hit error in multi instances environment. Failure that I hit in second instance will cause exception in first instance also. I am not sure how VFP handle connection using dbc. But I am sure VFP update something to DBC when open view (That is why our DBC date is always "up-to-date").
Use seperate copy of DBC for each instance would solve the issue. It has same reason of using ViewDBC in multi-user environment as recommded.
SQL Connection property reset!
Recently, my team is testing our application to make sure it works fine in multi instances and Terminal Server environment.
Once launch second instance of our application, we hit show stopper errors.
Firstly, we hit error "Invalid call issued while executing a SQLMORERESULTS( ) sequence." Thank you for UT member to give me hint. We set connection "BatchMode" in DBC to True and test the application. Hey, it still happen! After a lot of observations, trial and error we found that our connection property been reset by VFP.
We are using remote view and SQL Passthrough to manipulate SQL Server data. We retrieve current view connection handle and use it in SPT to share connection among both. Don't know how VFP reset connection property. It causes BatchMode reset to False.
OK, we add code to re-assign True to BatchMode after after retrieve remote view connection handle, before pass to SPT. Problem solved! We start to test our data entry form. Key in records, save them in both instance. Ooopss, we hit error "ODBC error : Invalid transaction State" What is this error all about??!?!?!
Yes, both of these error has cause. Connection transaction mode is reset to ZERO. By right, it should be 1 - AutoCommit or 2 - Manual.
We tried to reproduce the bug in test project, but failed! We would report this to FoxTeam once we can reproduce it.
Multi-Threading in VFP
Calvin Hsia posted sample code to run VFP in multi-threading mode.
[Calvin Hsia :]
- Sample program to create multiple threads
- Create multiple threads from within your application
- More Multithread capabilities: interthread synchronization, error checking
Hopefully, this class would be enhanced to enable VFP to have robust multi-threading feature later.
Simple steps, are they really simple?
Ted pointed out a link that show how to delete a desktop shortcut in seven simple steps.
It remind me one of the product installation procedure. In order to deploy the application to customer, it requires only firty easy steps. Well, the steps are really easy, frankly.