Using Win32 functions in Visual FoxPro Image Gallery
Window Station and Desktop
Code examples:
How to prevent users from accessing the Windows Desktop and from switching to other applications
..msdn    Add comment     W32 Constants      Translate this page
Creates a new desktop, associates it with the current window station of the calling process, and assigns it to the calling thread.
Code examples:
How to prevent users from accessing the Windows Desktop and from switching to other applications
HDESK CreateDesktop(
    LPCTSTR lpszDesktop,
    LPCTSTR lpszDevice,
    LPDEVMODE pDevmode,
    DWORD dwFlags,
    ACCESS_MASK dwDesiredAccess,

FoxPro declaration:
DECLARE INTEGER CreateDesktop IN user32;
    STRING  lpszDesktop,;
    INTEGER lpszDevice,;
    INTEGER pDevmode,;
    LONG    dwFlags,;
    INTEGER dwDesiredAccess,;
    INTEGER lpsa

[in] Pointer to a null-terminated string specifying the name of the desktop to be created. Desktop names are case-insensitive and may not contain backslash characters (\).

Reserved; must be NULL.

Reserved; must be NULL.

[in] This parameter can be 0 or 1.

[in] Access to the desktop.

[in] Pointer to a SECURITY_ATTRIBUTES structure; can be NULL.
Return value:
If the function succeeds, the return value is a handle to the newly created desktop.
* use random name for new desktop
cNewdesktop = "desktop_" + SUBSTR(SYS(2015), 3)

hNewDesktop = CreateDesktop(cNewdesktop,;
    0,0,0, GENERIC_ALL, 0)

= SetThreadDesktop(m.hNewDesktop)
= SwitchDesktop(m.hNewDesktop)
My comment:
If the specified desktop already exists, the function succeeds and returns a handle to the existing desktop. When you are finished using the handle, call the CloseDesktop function to close it.

See also: CloseDesktop, SwitchDesktop
Word Index links for the CreateDesktop :
Translate this page:
  Spanish    Portuguese    German    French    Italian offers instant, free translations of text or web pages.
Created: 2005-09-04 16:13:15
Modified: 2008-01-05 11:34:35
Visited in last 7 days: 35
User Contributed Notes:
There are no notes on this subject.

Copyright 2001-2018 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.6.39), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (
18 sec.Function: 'SetWindowText'
35 sec.Function: 'SetWindowLong'
55 sec.Function: 'WriteConsole'
1.2 min.Function: 'FtpCreateDirectory'
1.52 min.Function: 'ReadProcessMemory'
1.8 min.
Function group: 'Cursor'
2.1 min.Function: 'HttpSendRequest'
2.35 min.Function: 'GetProcessVersion'
2.67 min.Function: 'WTSOpenServer'
2.95 min.Function: 'EnumDisplaySettings'
Advertise here!