Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Retrieving the IP-to-physical address mapping table
Using Custom FTP class (DEFINE CLASS ftp As Custom)
Obtaining addresses for the adapters on the local computer (Win XP/2003/Vista)
Using named pipes for interprocess communication
Creating a file, then moving it to another destination
Drawing a window caption using the DrawCaption routine
Enumerating MIDI output devices
Retrieving the names of all sections in an initialization file
Running a regular FoxPro form while main VFP window is minimized
Setting and retrieving the double-click time for the mouse
Winsock: how to retrieve a service information corresponding to a service name
Building a tree of subdirectories for a given path using FindFile functions
Enumerating forms supported by a specified printer
GDI+: converting text strings to images and saving in a graphics file
Using LoadLibrary
Basic Volume information
Closing Windows
Pocket PC: System Registry Viewer
Setting the Window Region for a form
Using Video Capture: enumerating installed capture drivers
Accessing LSA Policy object (Local Security Authority)
How to check whether the system is 32-bit or 64-bit
Pocket PC: creating new database in the Object Store and copying Contacts Database records into it
Saving HKEY_LOCAL_MACHINE\\Software\\ODBC Registry Entries to an XML file
Using an Event Object. Part A: running an application that creates an Event object

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
Before you begin:
Compile this code into a separate executable and test with an executable created from the Part B of this example.
This is the name of the Event Object, that links two parts.

Start Part A executable prior to the Part B.
 
PUBLIC frm, lcEventName
lcEventName = "TimeToGoHomeNotice"
 
frm = CreateObject ("Tform", lcEventName)
IF TYPE ("frm") = "O"
    frm.Visible = .T.
    READ EVENTS
ENDIF
 
DEFINE CLASS Tform As Form
    Width=300
    Height=150
    BackColor=Rgb(230,230,250)
    Caption="Firing events"
    AutoCenter=.T.
    hEvent=0
 
    ADD OBJECT cmd As CommandButton WITH;
        Height=25, Width=80, Caption="\,;
        Left=10, Top=10
 
PROCEDURE  Init (lcName)
    _SCREEN.WindowState = 2
    _SCREEN.Caption = "Push the button to set an event"
 
    DO decl
    IF Not THIS.createEvent(lcName)
        RETURN .F.
    ENDIF
 
PROCEDURE  Destroy
    QUIT
 
PROCEDURE  createEvent (lcName)
    THIS.hEvent = CreateEvent (0, 1, 0, lcName)
    IF THIS.hEvent = 0
        = MessageB ("Unable to create an Event object" + Chr(13) +;
            "with this name")
        RETURN .F.
    ENDIF
RETURN .T.
 
PROCEDURE  fire
    = SetEvent (THIS.hEvent)
 
PROCEDURE  cmd.Click
    ThisForm.fire
ENDDEFINE
 
PROCEDURE  decl
    DECLARE INTEGER CreateEvent IN kernel32;
        INTEGER lpEventAttributes, INTEGER bManualReset,;
        INTEGER bInitialState, STRING lpName
 
    DECLARE INTEGER SetEvent IN kernel32 INTEGER hEvent
 
 

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
1150 bytes  
Created: 2001-09-16 12:00:00  
Modified: 2001-09-28 16:45:43  
Visits in 7 days: 86  
Listed functions:
CreateEvent
SetEvent
Printer friendly API declarations
My comment:
This code creates an Event object.

Pushing the button on the form you set this Event object, signalling that an event has occured. Another application (Part B) uses Timer to watch the state of the Event object. When the Part B application discovers the event occured it runs some code attached.
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 (54.234.126.92)
2.81 hrs.Example: 'Pocket PC: custom RAPI class for operating with the Object Store Databases'
 Example: 'How to control Adobe Reader 9.0 (SDI mode) from VFP application'
 Example: 'Retrieving a handle to DLL and address of an exported function in it'
4.09 hrs.Example: 'How to copy the image of a form to the Clipboard using Bitmap API functions'
 Function: 'DocumentProperties'
8.22 hrs.Function: 'DrawEdge'
Function group: 'Painting and Drawing'
12.73 hrs.Function: 'CreateCompatibleDC'
12.74 hrs.Example: 'Using Change Notification Objects to monitor changes to the printer or print server'
15.36 hrs.Function: 'DeviceIoControl'
 Example: 'Transparent Menu Class (requires VFP9)'
Google
Advertise here!