Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to initiate System shutdown
Wininet last error description
Dynamic strings implemented through VFP Custom class
Establishing connection using the SQLDriverConnect
Using Beep and Sleep functions to make the old tin buzz sing (WinNT only?)
Enumerating files opened on the network
Using FoxTray ActiveX control: System Tray Icon and menu attached to VFP form
Using the GetTempFileName
How to find the application associated with a file name
Monitoring changes in a directory
Retrieving information about the main VFP window
Time in milliseconds represented as string (e.g. 1 hour 24 min 36 sec)
Using Common Controls: the Header Control
Converting a hexadecimal string to an integer
Converting twips to pixels and vice versa
Reading list of folders and files on FTP server
Custom FTP Class for Visual FoxPro application
Creating a device context for the specified printer
Enumerating the subkeys for a given registry key
Drawing Windows predefined bitmaps using the LoadBitmap functions
Reading keys in the specified section of the Win.ini file
Another way to go online (it is not about choosing an ISP)
How to convert a bitmap file to monochrome format (1 bpp)
Obtaining information about all user accounts on a server (WinNT only)
How to prevent users from accessing the Windows Desktop and from switching to other applications

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
Versions:
click to open
Before you begin:
Sometimes you may need a computer with a single application running on it, and with all other applications and resources hidden from users. An example, Indigo Book Store customers can only search books when using public computers in the store.

The following items should be concealed:
  • Windows Taskbar and Start Menu
  • Task Manager
  • CTRL+ALT+DEL
  • ALT+TAB
  • CTRL+ESC
  • both Windows keys
  • right click on the Windows Desktop
  • all icons on the desktop
  • ...

    An article Lock Windows Desktop written by Antσnio Feijγo describes several techniques of restricting users from accessing the desktop and running other applications.

    The one that switches to a new desktop seems to be efficient, easy to understand and can be accomplished in just FoxPro code with no external libraries other than WinAPI.

    Use the following code to test the AppLauncher class:
    LOCAL obj, ex As Exception
    TRY
            obj = CREATEOBJECT("AppLauncher")
            WITH obj
                    .StartProcessInNewDesktop(;
                    "C:\Program Files\Internet Explorer\iexplore.exe",;
                     "www.universalthread.com")

                    IF .errorno <> 0
                            ? .errorno, .message
                    ENDIF
            ENDWITH

    CATCH TO ex
            ? ex.ErrorNo, ex.Message
    ENDTRY

    An Internet Explorer window will appear inside a new desktop. ALT+TAB, CTRL+ESC and CTRL+ALT+DEL keys are disabled. The Windows Taskbar and Start Menu are not visible. Close IE window to get back to the default Windows Desktop.

    Requires Win XP/NT/2K, VFP8.

    See also:
  • How to block the ALT+TAB and ALT+ESC
  • How to block the PrintScreen key
  • Using a Semaphore object to prevent VFP application from running more than one instance
  • How to start the screen saver and how to find whether the screen saver is active
  • How to disable the Windows Clipboard (requires VFP9)
  • Capturing keyboard activity of another application using the Raw Input API

  •  
      Members area. Log in to view this example.
     
      User name:
      Password:
     
     
      Forgot your password?
     
      Sign up for
    the Membership
     
     


    User rating: 0/10 (0 votes)
    Rate this code sample:
    • ~
    6034 bytes  
    Created: 2005-09-04 14:48:13  
    Modified: 2011-01-06 16:28:56  
    Visits in 7 days: 137  
    Listed functions:
    CloseDesktop
    CloseHandle
    CreateDesktop
    CreateProcess
    GetCurrentThreadId
    GetLastError
    GetThreadDesktop
    GlobalAlloc
    GlobalFree
    GlobalSize
    OpenInputDesktop
    SetThreadDesktop
    SwitchDesktop
    TerminateProcess
    WaitForSingleObject
    Printer friendly API declarations
    My comment:
    To implement this technique, create a launcher -- a small VFP application that starts the main executable by calling the CreateProcess API function.

    Name of the new desktop is assigned to lpDesktop member of the STARTUPINFO structure that used with the CreateProcess call. As the result, the main application runs inside a separate desktop, which is absolutely empty.

    The WaitForSingleObject function returns, when the main application is closed by user. Also this function returns when the time-out interval elapses, unless dwMilliseconds is INFINITE.

    * * *
    A window station is a securable object that is associated with a process, and contains a clipboard, an atom table, and one or more desktop objects.

    The interactive window station, WinSta0, is the only window station that can display a user interface or receive user input. It is assigned to the logon session of the interactive user, and contains the keyboard, mouse, and display device. All other window stations are noninteractive, which means they cannot display a user interface or receive user input.

    A desktop is a securable object contained within a window station. A desktop has a logical display surface and contains user interface objects such as windows, menus, and hooks.

    * * *
    C++ code shows how to enumerate window stations and window desktops. The enumerations are based on callback functions and for that reason can not be programmed directly in VFP code.

    EnumWindowStationProc
    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-2014 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.68), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
    Last Topics Visited (54.204.215.209)
    2 sec.Function: 'RtlGetCompressionWorkSpaceSize'
    3 sec.Function: 'CryptGetHashParam'
    Function group: 'Cryptography Reference'
    4 sec.
    Function group: 'National Language Support'
    5 sec.Function: 'FindClose'
    Function group: 'File Management'
    6 sec.Function: 'JetCloseDatabase'
    7 sec.Example: 'Displaying printer-properties Property Sheet for the specified printer'
    11 sec.Function: 'CryptDeriveKey'
    12 sec.Example: 'Dragging files from Explorer window and dropping them on FoxPro control (requires VFP9)'
    15 sec.Function: 'JetRetrieveColumn'
    19 sec.Function: 'mixerGetDevCaps'
    Function group: 'Windows Multimedia'
    Google
    Advertise here!