Using Win32 functions in Visual FoxPro Image Gallery
Handle and Object
Code examples:
Running MSDOS Shell as a child process with redirected input and output (smarter RUN command)
..msdn    Add comment     W32 Constants      Translate this page
The DuplicateHandle function duplicates an object handle.
Code examples:
Running MSDOS Shell as a child process with redirected input and output (smarter RUN command)
BOOL DuplicateHandle(
  HANDLE hSourceProcessHandle,
  HANDLE hSourceHandle,
  HANDLE hTargetProcessHandle,
  LPHANDLE lpTargetHandle,
  DWORD dwDesiredAccess,
  BOOL bInheritHandle,
  DWORD dwOptions

FoxPro declaration:
DECLARE INTEGER DuplicateHandle IN kernel32;
    INTEGER   hSourceProcessHandle,;
    INTEGER   hSourceHandle,;
    INTEGER   hTargetProcessHandle,;
    INTEGER @ lpTargetHandle,;
    INTEGER   dwDesiredAccess,;
    INTEGER   bInheritHandle,;
    INTEGER   dwOptions

[in] Handle to the process with the handle to duplicate.

[in] Handle to duplicate. This is an open object handle that is valid in the context of the source process.

[in] Handle to the process that is to receive the duplicated handle.

[out] Pointer to a variable that receives the duplicate handle. This handle value is valid in the context of the target process.

[in] Access requested for the new handle.

[in] Indicates whether the handle is inheritable.

[in] Optional actions.
Return value:
If the function succeeds, the return value is nonzero.
My comment:
The duplicate handle refers to the same object as the original handle. Therefore, any changes to the object are reflected through both handles. For example, the current file mark for a file handle is always the same for both handles.
Word Index links for the DuplicateHandle :
Translate this page:
  Spanish    Portuguese    German    French    Italian offers instant, free translations of text or web pages.
Created: 2004-12-18 09:27:34
Modified: 2004-12-18 09:30:40
Visited in last 7 days: 30
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 (
19 sec.Function: 'ExitWindowsEx'
38 sec.Function: 'ReleaseCapture'
55 sec.Function: 'SetConsoleTitle'
1.22 min.Function: 'GetTextAlign'
1.5 min.Function: 'mixerGetControlDetails'
1.78 min.Function: 'ShellAbout'
2.1 min.Function: 'ConfigurePort'
2.42 min.
Function group: 'Shell Functions'
2.75 min.Login
3.07 min.Function: 'CryptDecrypt'
Advertise here!