Welcome to MSDN Blogs Sign in | Join | Help

August 2005 - Posts

How to use DEVMODE

I received a question about how to use DEVMODE . Below is some sample code that retrieves the screen’s current width/height screen resolution and rotates it for a few seconds if supported by your machine (mostly on Tablet PCs) The user’s question continues:
Posted by Calvin_Hsia | 7 Comments

Computer music on the radio

If you listen to an AM radio that’s placed near a computer, you can hear interference. I can put my radio next to my tablet and hear all the calculations being done as my ink handwriting is being converted to text. The AM frequency range is from 530 to
Posted by Calvin_Hsia | 2 Comments
Filed under: ,

The .Object member

If you have an ActiveX control and you want intellisense to show just the control’s members, you can use the virtual “object” member. A control is hosted in a container, which has ambient properties For example, type this in the command window: x= CREATEOBJECT
Posted by Calvin_Hsia | 0 Comments
Filed under:

What printers are available to your program?

The APRINTERS function allows you to enumerate all the printers to which your application can print. ?"Printer info" ShowPrinters( 0 ) ?"More printer info" ShowPrinters( 1 ) PROCEDURE ShowPrinters(nMode) n= APRINTERS (aa,nMode) FOR i= 1 TO n ?i FOR j
Posted by Calvin_Hsia | 1 Comments
Filed under:

How do I backup files that are still in use without shutting down the application?

In my prior post ( Puzzle: Why does backing up a data file require web application shut down? ) the customer wanted to keep the application running while doing a backup of the data files The reason the code seemed to work in the VFP IDE is because the
Posted by Calvin_Hsia | 0 Comments

Puzzle: Why does backing up a data file require web application shut down?

A customer reported a problem: Customer has a VB/ASP .NET web app that uses VFP data via the provider. When they do a nightly backup of the VFP data (via a simple .CMD with XCOPY), the web app starts tossing errors as it processes SQL commands. Most prominent
Posted by Calvin_Hsia | 2 Comments

Inheritance levels

The program below generates code to demonstrate 1000 levels of inheritance of VFP objects. The code looks like this: DEFINE CLASS c1 as c2 ENDDEFINE DEFINE CLASS c2 as c3 ENDDEFINE DEFINE CLASS c3 as c4 ENDDEFINE That means class “c1” is a subclass of
Posted by Calvin_Hsia | 1 Comments
Filed under:

Foxpro Language into a table

Sometimes it’s useful to get the VFP language into a table, including commands, functions, properties, events, and methods. CREATE CURSOR lang (word c( 30 ), stuff c( 20 )) FOR nType= 1 to 4 n= ALANGUAGE (aa,nType) FOR i = 1 to n INSERT INTO lang VALUES
Posted by Calvin_Hsia | 2 Comments
Filed under:

The mechanics of Sudoku

The rules of Sudoku are so simple (see Sudoku puzzles screen capture ) that it seems easy to write the mechanics of the puzzle in Fox. It took 20 minutes to write this. Move the mouse over a desired square and type a digit key. ‘0’ means erase what’s
Posted by Calvin_Hsia | 6 Comments
Filed under:

Sudoku puzzles screen capture

I love doing crossword puzzles: I’m a huge fan of Merle Reagle (I have all his books www.sundaycrosswords.com ) and I love the NY Times Sunday puzzles, both of which come in the Seattle Times. We also love listening to the NPR Sunday Puzzle by Puzzlemaster
Posted by Calvin_Hsia | 14 Comments

Move your "My Documents" folder

The “My Documents” special folder feature of Windows helps users to separate their programs from their data. The default location for “My Documents” is a few levels down in the Explorer hierarchy C:\Documents and Settings\calvinh\My Documents Explorer
Posted by Calvin_Hsia | 1 Comments
Filed under:

Have you used remote assistance ?

I wanted to demonstrate something on my machine to somebody in another location. Using remote assistance is easy. It allows another person to view and/or control your computer from another location. Try it with yourself (the term hermaphrodite comes to
Posted by Calvin_Hsia | 7 Comments
Filed under:

Use Windows 2003 Server and remote desktops for debugging

When debugging a process, you are often examining the context of a process at a breakpoint. When done, you resume the suspended process. However, just the act of resuming causes various events to fire that may not have fired when not debugging. These
Posted by Calvin_Hsia | 3 Comments
Filed under: ,

Why a large picture works, but a small one fails?

In my last post Enable crop and zooming in on your digital photograph display form there is code that seemed to work just fine for me, but failed for others. I subsequently fixd the code in that post to call ValidateRect , which works around the problem.

Enable crop and zooming in on your digital photograph display form

I wanted to add the ability to zoom into a portion of a photograph on my photo viewer. Below is some code that processes the MouseUp, MouseDown and MouseMove events to add a yellow dotted-dash selection rectangle using a Shape control that the mouse can

Print method parameters are undocumented

The Print method of the Form or _screen shows only one parameter (the text to print) is accepted. Furthermore, the property sheet, documentation and intellisense show only the one parameter. However, more parameters are accepted as demonstrated by this
Posted by Calvin_Hsia | 2 Comments
Filed under:

Interesting form paint behavior

A customer sent us a repro scenario of a problem. There was a fairly complicated form with a PageFrame tab control with several pages, each with grids and other controls on it. Sometimes, the form did not paint completely, even though the grid did. It
Posted by Calvin_Hsia | 13 Comments

Puzzle: Creating an INDEX requires EXCLUSIVE use of the table, doesn't it?

A coworker asked a question about some code. It creates a table with 2 fields, reopens the table SHARED, creates an index tag using the INDEX command , closes all, then tries to do the same thing, but this time it fails. Why? CLEAR ALL CLEAR SET EXCLUSIVE
Posted by Calvin_Hsia | 3 Comments
Filed under:

Remove double spaces from pasted code samples in blog

If you highlight a recent code sample from my blog and paste it into VFP, you might see the code double spaced. This can be annoying, especially if there are line continuation characters: x= "This is a " +; "continued line" I’ve found that to avoid this,
Posted by Calvin_Hsia | 9 Comments
Filed under:

Generating VBScript to read a blog

Sometimes I need to test something using VBScript . A user sends a code snippet and asks why it behaves a certain way. Examining the behavior in VB can help. Below is a VFP code sample which demonstrates VBScript code which uses several objects to read
Posted by Calvin_Hsia | 7 Comments
Filed under: , ,

Watch the Autocomplete values change as you enter data

Here is some code to demonstrate the AutoComplete property Its behavior is very similar to Outlook 2003 or the Internet Explorer Address URL entry control. It prompts the user with possible entries in a drop down like Intellisense. The code creates a
Posted by Calvin_Hsia | 5 Comments
Filed under:

Internet Explorer wordwrap doesn't break at commas

I was modifying my web based thumbnail image viewer. Under each thumb I wanted the description of the photo. I wanted the photos to have captions below, and the unit to be rendered horizontally so they will fill the IE width. However, Internet Explorer
Posted by Calvin_Hsia | 5 Comments
Filed under: ,

Reacting to Windows Session events.

Sometimes it’s useful to run some code in response to an event like somebody locking or unlocking your desktop via Ctrl-Alt-Del or WindowsKey+L or the screen saver activating You can use the new VFP9 BindEvent to capture WM_WTSSESSION_CHANGE to accomplish
Posted by Calvin_Hsia | 3 Comments
 
Page view tracker