winapi

Retrieve HTML from Clipboard

MSDN:

This is sample code. Add error handling and adjust to your requirements as necessary.

lcHtml = HtmlFromClipboard()
IF NOT ISNULL(lcHtml)
	lnStartHTML = VAL(STREXTRACT(lcHtml, "StartHTML:", ""))
	lnEndHTML = VAL(STREXTRACT(lcHtml, "EndHTML:", ""))
	* If StartFragment is present, retrieve HTML fragment
	IF ("StartFragment" $ lcHtml)

Retrieving Windows TaskBar Size and Location

A location and size of the Windows Taskbar can be retrieved with SHAppBarMessage Function.

How to change file attributes programmatically

There're many ways to change file attributes. It can be done through Windows Explorer, DOS ATTRIB comand, third party utilites, e.t.c. Also it can be done programmatically using Windows Scripting Host (WSH) or/and Windows API.

Who has files open on the network

The WhoHasFileOpen utility displays the list of users who have specific file(s) open on network. Works on Windows NT Platform (Windows NT 4.0, Windows 2000, etc). This code detects only the files opened using a net shared path. It does not return the files opened by a user on the local computer using a local path.

Position Shortcut menu over Toolbar

The code below shows how to position a shortcut menu over a toolbar buttons using GetCursorPos function and ScreenToClient function. The idea was provided by Andrey Davidoff on UT in the message #913121.

Enumerating Environment variables

One of the way to enumerate the Environment Variables is by accessing _environ global variable. The GetEnvironmentStrings function provides another way by returning a pointer to the environment block of the calling process. It can also be done using WMI Win32_Environment Class.

Check for active Internet connection

The InternetCheckConnection function can be used to check for an active connection to the internet. It requires an URL to a fast and reliable web site as the first parameter.

Flash Application window or/and Taskbar button

Sometimes it's necessary to attract a user attention to an application that is currently not active. Such application can utilize FlashWindowEx Function. The Windows API support class is used to handle Windows API structures.

Lowering memory usage by application

The working set of a process is the set of memory pages currently visible to the process in physical RAM memory. These pages are resident and available for an application to use without triggering a page fault. While increasing your working set size can reduce paging for your application, it can adversely affect the system performance.

VFP is know in using all the memory it can get. One of proactive steps in reducing memory usage is limiting VFP buffers size using SYS(3050) - Set Buffer Memory Size. It's a good idea to empty the working set when your application goes into a wait state. It can be done by calling EmptyWorkingSet Function or SetProcessWorkingSetSize Function and uses GetCurrentProcess Function.

Syndicate content