Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to display picture stored in enhanced-format metafile (*.emf)
Listing INF files in a specified directory
Obtaining a handle to the desktop associated with the calling thread
Retrieving System Error message strings
Uploading file to the FTP server using InternetWriteFile
Using Beep and Sleep functions to make the old tin buzz sing (WinNT only?)
Accessing examples contained in this reference through Web Services
GDI+: Using Scale and Shear transformations
How to empty the Recycle Bin
How to intercept window messages sent to VFP form
Retrieving list of Global Atom names
Converting path to original case
Enumerating files opened on the network
Validating the heap of the calling process
Accessing examples contained in this reference from a VFP application
GDI+: cropping images
Number of clipboard formats available
Retrieving the state of your Internet connection
System Image List Viewer
Using FrameRgn for displaying system colors
Using GetSysColor
CryptoAPI: retrieving list of providers
Deleting a file stored on the FTP server
FindText -- the hopeless and useless Common Dialog
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: 73  
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 (23.22.252.150)
4 sec.Function: 'SQLDataSources'
3.01 hrs.Example: 'Displaying system dialog that selects a folder'
 
3.02 hrs.Function: 'GdipRemovePropertyItem'
Function group: 'GDI+ Image'
3.48 hrs.Function: 'GdipSetMatrixElements'
 Function: 'SQLGetPrivateProfileString'
Function group: 'ODBC API'
4.06 hrs.Example: 'How to display a dialog box with which the user can add a data source (DSN)'
 Function: 'GdipCreatePen1'
9.84 hrs.Example: 'Storing screen shot of a form to bitmap file'
 Function: 'VirtualFreeEx'
Google
Advertise here!