Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Pocket PC: custom RAPI class for operating with the System Registry
Using FtpCommand
Using InternetGoOnline function
Attaching menu to a top-level form
Enumerating network interfaces on the local computer
GDI+: creating scaled copy of image file
GDI+: printing image file
How to display Windows On-Screen Keyboard
How to view system icons for the classes installed on the local machine
Pocket PC: base class
Pocket PC: custom RAPI class for operating with the Object Store Databases
Pocket PC: retrieving data from the Contacts Database
PocketPC: custom RAPI class for executing routines on remote Windows CE device
Power capabilities of the system: battery, UPS, sleep and hibernation modes, processor throttling
Retrieving configuration information for the specified workstation (Win2000/XP)
Retrieving various system metrics
Testing an ODBC connection for supporting specific functionality
GDI+: reading and writing metadata in JPEG and TIFF files
How to display a dialog box with which the user can add a data source (DSN)
How to release and renew a lease on an IP address previously obtained through Dynamic Host Configuration Protocol (DHCP)
MapiSendMail class for Visual FoxPro application
Quering waveform-audio output devices
Winsock: changing the byte ordering
Winsock: retrieving the standard host name and IP address for the local machine
Simulating DOEVENTS

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
More code examples    Listed functions    Add comment     W32 Constants      Translate this page Printer friendly version of this code sample
 
PUBLIC frm
frm = CreateObject ("Tform")
frm.Visible = .T.
 
DEFINE CLASS Tform As Form
    Width=500
    Height=200
    Caption="Simulating DOEVENTS"
    AutoCenter=.T.
 
    ADD OBJECT sh As Shape WITH;
        Left=20, Width=0,;
        Top=100, Height=70, BackColor=Rgb(192,192,250),;
        BorderStyle=0
 
    ADD OBJECT cmdStart As CommandButton WITH;
        Left=10, Top=10, Height=25, Width=80,;
        Caption="Start"
 
    ADD OBJECT cmdStop As CommandButton WITH;
        Left=THIS.cmdStart.Left+THIS.cmdStart.Width+2,;
        Top=THIS.cmdStart.Top, Height=25, Width=80,;
        Caption="Stop"
 
    LoopState = .F.
 
PROCEDURE  Init
    DECLARE INTEGER GetQueueStatus IN user32 INTEGER flags
    ThisForm.stopLoop
ENDPROC
 
PROCEDURE  startLoop
* this method emulates a time-consuming process
    THIS.LoopState = .T.
    LOCAL ii
    CREATE CURSOR cs (dt T)
    DO WHILE THIS.LoopState
        WITH ThisForm.sh
            .Width = .Width + 10
            IF .Width > ThisForm.Width - .Left*2
                .Width = 0
            ENDIF
        ENDWITH
 
        FOR ii=1 TO 10000
            INSERT INTO cs VALUES (datetime())
 
        * this line makes a difference
        * allowing VFP to take a breath and analyze the user input
        * though it slows the process down
            ThisForm._doEvents()
        * ----------------------------
        ENDFOR
    ENDDO
ENDPROC
 
PROCEDURE  stopLoop
    ThisForm.LoopState = .F.
ENDPROC
 
PROCEDURE  cmdStart.Click
    ThisForm.startLoop
ENDPROC
 
PROCEDURE  cmdStop.Click
* actually there is no need to call StopLoop from this event
ENDPROC
 
PROCEDURE  _doEvents
#DEFINE QS_MOUSEBUTTON  4
#DEFINE QS_MOUSEMOVE    2
#DEFINE QS_MOUSE        6  && QS_MOUSEMOVE Or QS_MOUSEBUTTON
 
    * catching mouse messages
    IF GetQueueStatus(QS_MOUSEBUTTON) <> 0
    * if mouse button pressed -- we are here inside
        LOCAL obj
 
        * obtaining a reference to the object 
        * that is under the current mouse position
        obj = SYS(1270)
 
        * if this particular button is clicked,
        * then we stop the process
        IF obj.Name = "CMDSTOP"
            ThisForm.stopLoop
        ENDIF
 
        * there is another way -- getting mouse cursor position
        * and testing it against the button rectangle
        * possibly it would work faster than SYS function
        * and no undocumented functionality would be involved -- try
    ENDIF
ENDDEFINE
 
 

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
2233 bytes  
Created: 2001-10-09 22:13:39  
Modified: 2002-02-07 09:53:30  
Visits in 7 days: 72  
Listed functions:
GetQueueStatus
Printer friendly API declarations
My comment:
This example shows how to track user input while executing time-consuming process. This technique is especially useful for VFP3, because this version has no DOEVENTS function implemented.
Word Index links for this example:
Translate this page:
  Spanish    Portuguese    German    French    Italian  
FreeTranslation.com offers instant, free translations of text or web pages.
User Contributed Notes:
There are no notes on this subject.


Copyright © 2001-2013 News2News, Inc. Before reproducing or distributing any data from this site please ask for an approval from its owner. Unless otherwise specified, this page is for your personal and non-commercial use. The information on this page is presented AS IS, meaning that you may use it at your own risk. Microsoft Visual FoxPro and Windows are trade marks of Microsoft Corp. All other trademarks are the property of their respective owners. 

Privacy policy
Credits: PHP (4.4.9), an HTML-embedded scripting language, MySQL (5.1.55-log), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (184.73.74.47)
3 sec.Function: 'GetPrintProcessorDirectory'
Function group: 'Printing and Print Spooler'
20.9 min.Function: 'SetThreadExecutionState'
Function group: 'Power Management'
20.95 min.Example: 'GDI+: creating scaled copy of image file'
5.21 hrs.Example: 'Reading parameters of streams in AVI file'
 Function: 'LoadIcon'
 Example: 'Pocket PC: base class'
5.44 hrs.Example: 'Pocket PC: custom RAPI class for operating with the System Registry'
 Example: 'Storing screen shot of a form to enhanced metafile (*.emf)'
 Function: 'SQLCreateDataSource'
Function group: 'ODBC API'
5.56 hrs.Function: 'CreateWindow'
Google
Advertise here!