NationalInstruments.TestStand.Utility
This class contains various methods that can be useful when you use the TestStand API or the TestStand UI Controls API from a .NET language
9/29/2011 1:54:18 PM
Returns the standard image used as the background TestStand splash screens.
The splash screen image.
Returns the standard animated image used as the background TestStand splash screens.
The animated splash screen image.
This method ensures than any COM objects pending for garbage collection are released before it returns.
Creates a path with the , and
specified by combining the three.
The directory part of the path
The file name part of the path
The extension part of the path. The extension can be passed with or without the dot.
The combined path \.
Returns the index of the underscore in the numeric suffix at the end of
. The numeric suffix is defined as an underscore followed by
one or more digits.
The file name to get a numeric index from.
The index of the underscore in the numeric suffix.
Creates a new file name from the base with a numeric suffix
with an integer part
GetFileNameWithCountSuffix("abc", 3) --> "abc_3"
The base part of the file name to generate
The integer part of the suffix of th file name to generate
A string with the file name generated from the base and count specified
Returns the path of a unique file name in with the base
specified and . The method will
return the result of calling with
and if no file with that name
already exists in or it will create a new unique file name
with a numeric suffix.
The directory where the unique file name will be created
The base part of the file name which will be generated
The extension to add to the file name
A path guaranteed to be unique in the directory specified.
Returns the path of a unique file name in with the base
specified and . The method will
return the result of calling with
and if no file with that name
already exists in or it will create a new unique file name
with a numeric suffix.
The directory where the unique file name will be created
The base part of the file name which will be generated
The extension to add to the file name
A path guaranteed to be unique in the directory specified.
This is a helper function that command line applications that accept an engine
environment argument on the command line can use to parse out the environment argument. The
environment must be passed with the syntax:
/env {PATH}
or, for example,
/env d:\MyEnv.tsenv
The argument can appear anywhere on the command line.
If found, the path is returned and the environment argument is removed from the array. If no
environment argument is present, is returned and args is left unchanged.
If multiple environments are specified, only the first is removed from the list and returned. It is up
to the command line parsing logic of the application to ignore or error if additional /env arguments
are present.
The command line arguments. If an environment is found, it will be removed from the
array.
Pass true to allow this function to generate an exception if the arguments
are invalid. Pass false if you are handling command line exceptions elsewhere. If you use the
TestStand Application Manager in your application, pass false.
if no environment is found, the method returns this value.
The environment path if one was passed, null otherwise.
Create a command line argument to specify the TestStand environment to an application that uses
the /env "{PATH}" syntax.
The path to the environment.
An empty string if path is null or empty. Otherwise, returns
/env + "{PATH}"
enclosed in quotes and preceded by a space. This is to fascilitate construction of a command
line.
The path to TestStand related keys in the registry relative to HKEY_LOCAL_MACHINE.
The path to TestStand related keys in the registry including HKEY_LOCAL_MACHINE.
This class contains various methods that can be useful when you use the TestStand API or the TestStand UI Controls API from a .NET language
This method converts a ShortcutKeys and ShortcutModifiers into a .NET Shortcut key value. If no equivalent .NET Shortcut value exists, the method returns Shortcut.None.
Typically, you call a higher level method, such as TSUtil.InsertCommandsInMenu, to create .NET menu items that execute TestStand commands. In that case, the higher level method calls this method for you to determine the correct menu shortcut values.
a ShortcutKeys value
a ShortcutModifiers value
the .NET Shortcut value that corresponds to the key and modifier value you specify
Typically, you call InsertCommandsInMenu instead of this method. However, if you have a TestStand.Interop.UI.Command object for which you want to create a menu item, you can call this method directly.
Pass the TestStand.Interop.UI.Command object that represent the action the menu item takes when the user selects it.
Pass the menu into which to insert the menu item.
The MenuItem before which the method inserts the new menu item. To insert at the end of the menu, pass Nothing (VB) or null (C#)
Pass false to prevent menu items from having shortcut keys.
Use this overload of InsertCommandsInMenu when you do not need to know the actual number of menu items the method inserts.
Refer to the other overload of this method for more information.
A list in which each element is a TestStand.Interop.UI.CommandKinds value. For each element in the list, the method inserts the corresponding menu item(s) into the menu.
The menu into which the method inserts the menu items
The MenuItem before which the method inserts the new menu items. To insert at the end of the menu, pass Nothing (VB) or null (C#)
Pass the TestStand.Interop.UI.SequenceFileViewMgr or TestStand.Interop.UI.ExecutionViewMgr control, if any, to which the new menu item(s) apply. If the commands do not apply to a view manager control, pass the TestStand.Interop.UI.ApplicationMgr control that you placed on one of your application forms.
Pass false to prevent menu items from having shortcut keys.
.NET does not support certain keys as menu shortcuts. Call this method to remove shortcuts that .NET does not support
from a Commands collection before calling Commands.InsertIntoWin32Menu
Pass the TestStand.Interop.UI.Commands object that represent the actions that populate a context menu.
As an alternative to manually writing menu handler code for common TestStand commands, you can use this method to create new menu items that execute the commands you specify without requiring any additional code.
To create the menu items, you specify a list of TestStand.Interop.UI.CommandKinds elements. Each element specifies a menu item or group of menu items to insert. To each menu item this method inserts, it attaches a TestStand.Interop.UI.Command object that represents the action the menu item takes. The method installs an event handler for the menu item that automatically invokes the associated command object when the user selects the menu item.
Typically, you call this method in response to the MenuStart event to populate the menu with the commands that apply to the current state of the application. Before you call this method, you can call RemoveMenuCommands to remove any menu items you previously inserted.
A list in which each element is a TestStand.Interop.UI.CommandKinds value. For each element in the list, the method inserts the corresponding menu item(s) into the menu.
The menu into which the method inserts the menu items
The MenuItem before which the method inserts the new menu items. To insert at the end of the menu, pass Nothing (VB) or null (C#)
Pass the TestStand.Interop.UI.SequenceFileViewMgr or TestStand.Interop.UI.ExecutionViewMgr control, if any, to which the new menu item(s) apply. If the commands do not apply to a view manager control, pass the TestStand.Interop.UI.ApplicationMgr control that you placed on one of your application forms.
This out parameter returns the number of menu items the method inserts. The number of menu items does not necessarily equal the number of TestStand.Interop.UI.CommandKinds elements you specify because, depending on the CommandType and the state of the application, a single CommandType element might create several menu items or none at all. The parameter counts only items the method adds to the menu you pass. The parameter does not count items the method inserts into submenus the method creates.
Pass false to prevent menu items from having shortcut keys.
Typically, you call InsertCommandsInMenu instead of this method. However, if you have a TestStand.Interop.UI.CommandCollection object for which you want to create menu items, you can call this method directly.
A TestStand.Interop.UI.CommandCollection that contains the Commands to place in the menu.
The menu into which to insert the menu item.
The MenuItem before which the method inserts the new menu item. To insert at the end of the menu, pass Nothing (VB) or null (C#)
Pass false to prevent menu items from having shortcut keys.
Call this method to remove menus and menu items that you insert with TSUtil methods such as InsertCommandsInMenu. Optionally, you can also remove menu and menu items that you insert by other means.
Typically, you call this method when handling a MenuStart event in order to clear the menu so that you can then call InsertCommandsInMenu to populate the menu with items that are appropriate for the current state of the application.
The method removes any menus or menu items that TSUtil methods create under this menu, including the menu itself. To remove items from all menus, pass the Menu that is the menubar.
Pass true to also remove menus that you did not insert by calling a TSUtil method.
Pass true to also remove menu items that you did not insert by calling a TSUtil method.
This method prevents edits made by the Menus class from affecting the visual state of the form's menu.
Call this method prior to making changes to a form's menu with the Menu class.
After edits are made, call EndUpdate to present the modified menu.
Pass the form which contains the menu being modified.
This method restores a form's modified menu and resumes updates.
Call this method after making changes to a form's menu using the Menus class.
Ensure that each call to EndUpdate is preceded by a call to BeginUpdate
(Note: These calls can not be nested).
This method removes any duplicate menu shortcut keys or redundant menu separator bars.
If you make multiple calls to InsertCommandsInMenu or if call InsertCommandsInMenu to add to an existing menu, it can be difficult to prevent duplicate shortcut keys and separator bars because the inserted menus item may vary based on the state of the application. Rather than trying to prevent duplicate shortcuts and separators, it is simpler to remove them with this method after you update the menu bar.
Typically you call this method on the entire menu bar after you update a menu in response to a MenuStart event.
Pass the menu to recursively search for duplicate shortcut keys and separator bars. Typically you pass the menu object that represents the menubar for a form.
Exposes selected Win32 SDK Functions. Typically, you only uses these functions in .NET code when necessary to implement a work-around for a .NET limitation or bug.
Data structure for send message
Sets the message of this structure and stores it in global memory in order to be able to send
it to another process. If you are calling this method you will need to call the DisposeMessage()
method to clean up the used memory.
Converts the message pointer into a string
The string in the messages data
Cleans the global memory used in the message
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
We use IntPtr for lpOverLapped here beacuse it is easier to pass null that way.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Note: Pass IntPtr.Zero for the first parameter.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help for SetFileAttributes()
and GetFileAttributes() functions.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help for "File Security and
Access Rights," "Generic Access Rights," "File Access Rights
Constants," as well as the WinNT.h header file.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help for the CreateFile()
function, "Creating and Opening Files" as well as the WinNT.h
header file.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help for the CreateFile()
function.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help for MoveFileEx()
function.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Create a new instance of with
correctly set for the size of the type.
A new instance of
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Refer to Microsoft Win32 SDK Help.
Returns the width of the rectangle
Returns the height of the rectangle
Refer to Microsoft Win32 SDK Help.
Win32Wrap contains methods that wrap some of the P/Invoke defined
calls in the Win32 class. The idea is to shield consumers from
detail of calling Win32 methods directly. Win32Wrap methods
handle things like buffer sizing, translating Win32 error codes
to appropriate exceptions, etc.
Call the SendMessage function with the message type
to set or unset the UAC shield in the control
A to the control which should display the UAC shield.
Whether to show or hide the UAC shield.
Call the FindWindow Win API function. This method will return a pointer with a handle to the window if it was found or
a null pointer if not found.
The window title to match, if empty string or not specified then match all. The window name must be localized by the
caller of this method.
A pointer to a window handle which matches the values passed in or a null pointer if no window matches.
If the FindWindow method returns an error
Sends the specified message string with the specified code (or WM_USER if not defined) to the window handle specified.
In order to get a window handle call FindWindow
The window handle received from FindWindow
The message code to send
The message string to send
A pointer with information, depends on the message sent
If the SendMessage method returns an error
If window handle is null
Creates or opens a named or unnamed mutex object.
The name of the mutex object. The name is limited to MAX_PATH characters. Name comparison is case sensitive.
If this value is true and the caller created the mutex, the calling thread obtains initial ownership of the mutex object.
Otherwise, the calling thread does not obtain ownership of the mutex.
A handle to a mutex object.
Creates a mutex with the name specified and returns a handle to it.
The name of the mutex object. The name is case sensitive.
If the value is true the calling thread obtains initial ownership of the mutex object.
Returns true if the mutex already existed, false otherwise
A handle to a mutex object.
Waits for the specified mutex and returns true if the mutex was signaled.
The mutex reference to wait on, call CallCreateMutex to get it.
The time out in milliseconds to wait, if not specified wait forever.
True if the mutex was signaled, false if a timeout occurred or if the thread which owned
this mutex released it.
If the function fails
Releases ownership of the specified mutex object.
A handle to a mutex object.
True if the mutex was successfully closed.
CloseHandle() is a wrapper for
. It differs in two
ways. First, it takes care of checking the return value of
Win32.CloseHandle() and throws an appropriate exception.
This means that CloseHandle() will generally either return
true or throw and exception. The one exception to this rule
is if is passed as
the argument. In this case, the wrapper function returns
false immediately without ever invoking the Win32 method.
GetLongPathNameW() is a wrapper for
that takes care of buffer sizing and converting Win32 error
codes to exceptions.
GetLongPathNameW_Long() is a wrapper for
that takes care of all of the escaping for paths longer than
MAX_PATH, as well as buffer sizing, and converting Win32 error
codes to exceptions.
FindFirstFileW_Wrapper is a wrapper around the Win32
FindFirstFileW() / FindNextFileW() / FindClose() functions.
It manages the find handle returned by FindFirstFileW(),
providing final clean-up via the IDisposable interface.
Also, most error scenarios are mapped to appropriate .Net
exceptions. (ERROR_FILE_NOT_FOUND for FindFirstFileW()
and ERROR_NO_MORE_FILES for FindNextFileW() are treated as
status causing false to be returned. These cases do not
lead to exceptions.)
To use FindFirstFileW_Wrapper, instantiate an empty instance
using the no-arg constructor. Initialize the wrapper by
calling FindFirstFileW() on it, just as you would normally
call FindFirstFileW(). Iterate through the found files by
calling FindNextFileW() on the wrapper, just as you would
normally call FindNextFileW().
When you are done, you should call Dispose() to clean up.
FindClose() has also been provided should you want to keep
the wrapper around for later use without holding on to the
current find handle.
The wrapper can be reused as needed by calling FindFirstFileW().
This will release the current find handle before reinitializing
the wrapper.
Tests if a directory is "." (the current directory)
or ".." (the parent directory). This is handy because
FindFirstFileW() includes "." and ".." in its returned files
when you ask for all files in a directory using the "*"
pattern.
The file name to test. This is the
simple file name, not the full path.
true if fileName is "." or "..", false
otherwise.
Finalizer for FindFirstFileW_Wrapper.
Dispose helper method for disposable pattern
described at
http://msdn.microsoft.com/en-us/library/system.idisposable.dispose.aspx.
true if Dispose(bool) is called from
IDisposable.Dispose(), false if Dispose(bool) is called from
the finalizer.
Close the current find handle, if any, associated
with this wrapper.
Normally you will not need to invoke FindClose(). You can
call FindFirstFileW() to reinitialize the wrapper with a
new set of files or Dispose() when you are done.
FindClose() will throw an exception if it fails for any
reason other than the current handle being
INVALID_HANDLE_VALUE.
true if the current handle was successfully closed,
or false if the current handle is invalid.
Closes the existing find handle, if any, and
searches a directory for a file or subdirectory with a
name that matches a specific name (or partial name if
wildcards are used).
For paths longer than MAX_PATH, see FindFirstFileW_Long().
FindFirstFileW() will throw an appropriate exception if
there is a problem closing the existing find handle (if
present) or the underlying Win32 FindFirstFileW() call
fails for any reason other than ERROR_FILE_NOT_FOUND.
The directory or path, and the file
name, which can include wildcard characters, for example,
an asterisk (*) or a question mark (?).
This parameter should not end in a trailing backslash (\).
If the string ends with a wildcard, period (.), or directory
name, the user must have access permissions to the root and
all subdirectories on the path.
To extend the path name limit beyond MAX_PATH to 32,767 wide
characters, prepend "\\?\" to the path, or use
FindFirstFileW_Long().
A WIN32_FIND_DATAW structure that
receives information about a found file or directory.
If the function succeeds, the return value is
true and the findFileData parameter contains information
about the next file or directory found. If no files are
found, findFileData is left unchanged and false is returned.
Continues a file search from a previous call to the
FindFirstFileW() or FindFirstFileW_Long() methods.
A WIN32_FIND_DATAW structure
that receives information about the found file or
subdirectory.
FindNextFileW() throws an exception if it encounters an
error other than reaching the end of the list.
If the function succeeds, the return value is
true and the findFileData parameter contains information
about the next file or directory found. If there are no
more files, findFileData is left unchanged and false is
returned.
This function mimics the behavior of
FindFirstFileW(), but works for paths longer than MAX_PATH.
Note that paths longer than MAX_PATH cannot be relative and
cannot contain wild cards, so we cannot truly duplicate the
behavior of FindFirstFileW() for arbitrary paths.
Note: This method will escape any path you give it with "\\?\"
(or "\\?\UNC\" if appropriate). You should not prepend the
"\\?\" to the path yourself.
The directory or path, and the file
name. The path must be absolute. It cannot use forward
slashes to represent path separators, a period to represent
the current directory, or double dots to represent the parent
directory.
A WIN32_FIND_DATAW structure that
receives information about a found file or directory.
true if at least one file was found, false if no
files were found
Set to true once Dispose() has been executed
once.
The current find handle we are iterating
over.
CreateFileW() is a wrapper for
that takes care of converting Win32 error codes to exceptions.
CreateDirectoryW() is a wrapper for
that takes care of converting Win32 error codes to exceptions.
CreateFileW_Long() is a wrapper for
that takes care of converting Win32 error codes to exceptions.
It also escapes the fileName argument with the appropriate
long path prefix (\\?\ or \\?\UNC\).
CreateDirectoryW_Long() is a wrapper for
that takes care of converting Win32 error codes to exceptions.
It also escapes the fileName argument with the appropriate
long path prefix (\\?\ or \\?\UNC\).
GetFileSizeEx() is a wrapper for
that takes care of converting Win32 error codes to exceptions.
The 64-bit file size.
WriteFile() is a wrapper for
that takes care of converting Win32 error codes to exceptions.
It also converts the output numberOfBytesWritten parameter to a
return value and passes null for lpOverLapped for convenience.
A handle to the file or I/O device (e.g.
file, file stream, physical disk, etc.)
A buffer containing the data to be written
to the file or device.
The number of bytes to be written to the file or device.
GetFileSize() is a wrapper for
that takes care of converting Win32 error codes to exceptions.
It also handles the conversion of the 32-bit low and high sizes
to a single 64-bit ulong return value.
The 64-bit file size.
MoveFileExW() is a wrapper for
that takes care of converting Win32 error codes to exceptions.
MoveFileExW_Long() is a wrapper for
that takes care of converting Win32 error codes to exceptions.
It also escapes the existingFileName and newFileName arguments
with the appropriate long path prefix (\\?\ or
\\?\UNC\).
CopyFileW() is a wrapper for
that takes care of converting Win32 error codes to exceptions.
CopyFileW_Long() is a wrapper for
that takes care of converting Win32 error codes to exceptions.
It also escapes the existingFileName and newFileName arguments
with the appropriate long path prefix (\\?\ or
\\?\UNC\).
DeleteFileW() is a wrapper for
that takes care of converting Win32 error codes to exceptions.
RemoveDirectoryW() is a wrapper for
that takes care of converting Win32 error codes to exceptions.
DeleteFileW_Long() is a wrapper for
that takes care of converting Win32 error codes to exceptions.
It also escapes the fileName argument with the appropriate
long path prefix (\\?\ or \\?\UNC\).
RemoveDirectoryW_Long() is a wrapper for
that takes care of converting Win32 error codes to exceptions.
It also escapes the fileName argument with the appropriate
long path prefix (\\?\ or \\?\UNC\).
GetFileAttributesW() is a wrapper for
that takes care of converting Win32 error codes to exceptions.
GetFileAttributesW_Long() is a wrapper for
that takes care of converting Win32 error codes to exceptions. It also escapes the path
argument with the appropriate long path prefix (\\?\ or \\?\UNC\).
SetFileAttributesW() is a wrapper for
that takes care of converting Win32 error codes to exceptions.
SetFileAttributesW_Long() is a wrapper for
that takes care of converting Win32 error codes to exceptions. It also escapes the path
argument with the appropriate long path prefix (\\?\ or \\?\UNC\).
This method calls
on the return
value of .
Use the ITestStandLocalizable to allow a custom user control to be localizable.
When called, this method will localize the control that it is called in using the
and .
The engine used to localize
The category used to localize
Use a localizer to localize the Text property of .net menu items or controls.
Creates a new Localizer object. Localizers created with this constructor do not localize all TestStand UI Controls when LocalizeForm is called.
The Localizer uses the TestStand engine you pass to obtain the localized text for menu items and controls.
Creates a new Localizer object.
The Localizer uses the TestStand ApplicationMgr you pass to obtain the localized text for menu items and controls.
Creates a new Localizer object.
The Localizer uses the TestStand ApplicationMgr you pass to obtain the localized text for menu items and controls.
Creates a new Localizer object.
The Localizer uses the TestStand engine you pass to obtain the localized text for menu items and controls.
The Localizer uses the ApplicationMgr you pass to localize text for the TestStand User Interface controls. You can pass null to this parameter if you do not wish to localize UI controls.
Returns the Engine with which the Localize was constructed.
Returns the ApplicationMgr with which the Localizer was constructed. Obsolete, use GetApplicationMgr instead.
Returns the ApplicationMgr with which the Localizer was constructed.
Localize the collection of controls in with the string in
The controls collection to localize
The category to localize with
This method localizes the text on a form to the current language the TestStand language setting selects.
For each control on a form, this method uses the value of the Control.Text property as a tag to obtain a localized string from the TestStand string resource category you specify. If a localized string with that tag exists, the method replaces the value of the Control.Text property with the localized string. If the tag does not exist, the method does not alter the control text.
The method also localizes controls that reside within other controls or tab pages.
Pass the form to localize.
Pass the category name of the TestStand string resource section that contains the localized strings for the form.
Pass true to localize the menu item text for the items in the menu bar of the form.
This method localizes the menu item text to the current language the TestStand language setting selects.
For each item in a menu, this method uses the value of the MenuItem.Text property as a tag to obtain a localized string from the TestStand string resource category you specify. If a localized string with that tag exists, the method replaces the value of the MenuItem.Text property with the localized string. If the tag does not exist, the method does not alter the menu item text.
The method also localizes menu items that reside within sub-menus.
Pass the menu to localize.
Pass the category name of the TestStand string resource section that contains the localized strings for the menu.
Localizes the text in all menu items for a context menu strip to the current language the
TestStand language setting selects. For each menu item this method uses the value of the menu
item Text property as a tag to obtain a localized string from the string from the TestStand
string resource category you specify. If a localized string with that tag exists, the method
replaces the value of the Control.Text property with the localized string; if the tag does
not exist, the method does not alter the control text.
Pass the context menu strip to localize
Pass the category name of the TestStand string resource section that contains the localized
strings for the form.
Localizes the text in a notify icon for a context menu strip to the current language the
TestStand language setting selects. For each menu item in the context menu strip this
method uses the value of the menu item Text property as a tag to obtain a localized string
from the string from the TestStand string resource category you specify. If a localized
string with that tag exists, the method replaces the value of the Control.Text property
with the localized string; if the tag does not exist, the method does not alter the control
text.
Pass the notify icon to localize
Pass the category name of the TestStand string resource section that contains the localized
strings for the form.
You can use this class for tiling forms or other objects when the Form.LayoutMdi method is not adequate or applicable
Use a Tiler object to layout windows or other objects in a square or nearly square grid
Specificies the number of tiles to partition into a square or nearly square grid
The number of tiles to layout in a grid
Returns the tile coordinates of a specified tile in the grid of tiles
the index of a tile, from 0 to (number-of-tiles - 1)
returns the x position of the tile, from 0 to (max-number-of-tiles-in-a-row - 1)
returns the y position of the tile, from 0 to (max-number-of-tiles-in-a-column - 1)
Lays out a collection of forms in a grid within the specified bounds
a collection of forms
the rectangle within which to layout the forms
You can use this class for saving and loading control bounds or sizes to/from a TestStand application's configuration file.
Saves the height and width for each of the specified controls into a TestStand application's configuration file.
Pass the ApplicationMgr control for the application
Pass any number of controls
Saves the height and width for each of the specified controls into a TestStand application's configuration file. This overload let you specify the name of the configuration file property that stores the information.
Pass the ApplicationMgr control for the application
Pass the name of the configuration file subproperty that stores the information
Pass any number of controls
Saves the bounds for each of the specified controls into a TestStand application's configuration file.
Pass the ApplicationMgr control for the application
Pass any number of controls
Saves the bounds for each of the specified controls into a TestStand application's configuration file. This overload let you specify the name of the configuration file property that stores the information.
Pass the ApplicationMgr control for the application
Pass the name of the configuration file subproperty that stores the information
Pass any number of controls
Loads the height and width for each of the specified controls into a TestStand application's configuration file. You must call LoadSizes and SaveSizes with the same set of controls in the same order.
Pass the ApplicationMgr control for the application
Pass any number of controls
Loads the height and width for each of the specified controls into a TestStand application's configuration file. You must call LoadSizes and SaveSizes with the same set of controls in the same order. This overload let you specify the name of the configuration file property that stores the information.
Pass the ApplicationMgr control for the application
Pass the name of the configuration file subproperty that stores the information
Pass any number of controls
Loads the bounds for each of the specified controls into a TestStand application's configuration file. You must call LoadBounds and SaveBounds with the same set of controls in the same order.
Pass the ApplicationMgr control for the application
Pass any number of controls
Loads the bounds for each of the specified controls into a TestStand application's configuration file. You must call LoadBounds and SaveBounds with the same set of controls in the same order. This overload let you specify the name of the configuration file property that stores the information.
Pass the ApplicationMgr control for the application
Pass the name of the configuration file subproperty that stores the information
Pass any number of controls
You can use this class to simplify the implementation of splitter bars when using the border properties of TestStand UI Controls.
Call this method from the BorderDragged event for a TestStand control that has a drag border enabled in order to resize the control that owns the drag border and
the control that shares the area split by the border. This method has been tested only with one or fewer borders per control. It may require modification for use with more than one border per control.
///
Pass the control that receives the BorderDragged event.
Pass the control that shares the area split by the drag border of the master control.
Pass the value of newX received in the BorderDragged event handler.
Pass the value of newY received in the BorderDragged event handler.
Pass the value of newWidth received in the BorderDragged event handler.
Pass the value of newHeight received in the BorderDragged event handler.
Pass the value of bordersChanged received in the BorderDragged event handler.
Call this method to divide an area between two or more panes. If the area is larger or smaller than the current sum of the pane sizes, the available
area is distributed among the open panes in proportion to their current relative sizes.
This method has been tested only with one or fewer borders per control. It may require modification for use with more than one border per control.
///
Pass true if the controls are separated by vertical drag borders that divide a horizontal space. Pass false if the controls are separated by horizontal drag borders that divide a vertical space.
Pass the start of area that the panes share. If the splitters are vertical, pass the X coordinate for the start of the area. If the splitters are horizontal, pass the Y coordinate for the start of the area.
Pass the end of area that the panes share. If the splitters are vertical, pass the X coordinate for the end of the area. If the splitters are horizontal, pass the Y coordinate for the end of the area.
Pass the controls that share the specified area. For vertical splitters, pass the controls in order from left to right. For horizontal splitters, pass the controls in order from top to bottom.
Use this class to help format error messages
Returns the errorString with the error code and code description appended to it if the code is a TestStand error code.
Pass the ApplicationMgr control for the application
Pass the error message
Pass the error code
This class exists to provide an exception suppressing wrapper around System.Windows.Forms.Application.Run
This method is identical to System.Windows.Forms.Application.Run() except that it suppresses a harmless exception that can occur during dll unloading if the application exited while
a menu is open. The error occurs only in a very specific interaction between Windows forms, Windows timer messages, and COM components. This is a simple workaround.
This method is identical to System.Windows.Forms.Application.Run() except that it suppresses a harmless exception that can occur during dll unloading if the application exited while
a menu is open. The error occurs only in a very specific interaction between Windows forms, Windows timer messages, and COM components. This is a simple workaround.
You can use this class to launch the application in a separate AppDomain. This class ensures
that the TestStand Engine is destructed after the application exits so that the Engine does
not report incorrect object leaks.
Delegate for the main entry point to the application.
Delegate for the main entry point to the application with command-line arguments
Delegate for the main entry point to the application with command-line arguments and a return code.
Delegate for displaying error messages from the LaunchProtected method
Receives the caption that should be displayed in the message
Receives the error message to display
Launches the application in a new AppDomain. This method can throw exceptions when using
an old 32-bit Engine. Use LaunchProtected instead.
Pass the main entry point to the application
Command-line arguments
Launches the application in a new AppDomain. This method can throw exceptions when using
an old 32-bit Engine. Use LaunchProtected instead.
Pass the main entry point to the application
Launches the application in a new AppDomain. If the engine cannot be created displays
an error message. Handles the specific case that the engine cannot be created in
process because a version of TestStand that is only 32-bit is active and this
application is 64-bit.
Pass the main entry point to the application
The name of the application to display in an error message in case of errors.
Pass the arguments expected by the method.
Pass the method to use if an error message needs to be displayed
Pass true to enable the application to parse TestStand specific arguments, such as the "/env" flag, from the command line. Pass false if your application handles all command line arguments manually
Launches the application in a new AppDomain. If the engine cannot be created displays
an error message. Handles the specific case that the engine cannot be created in
process because a version of TestStand that is only 32-bit is active and this
application is 64-bit.
Pass the main entry point to the application
The name of the application to display in an error message in case of errors.
Pass the method to use if an error message needs to be displayed
Launches the application in a new AppDomain. If the engine cannot be created displays
an error message. Handles the specific case that the engine cannot be created in process
because a version of TestStand that is only 32-bit is active and this application
is 64-bit. Will return the return code given by entryPoint. If the Application cannot
be run or unloaded appropriately, this method will return the code -1000.
Pass true to enable the application to parse TestStand specific arguments, such as the "/env" flag, from the command line. Pass false if your application handles all command line arguments manually
Initialize the environment using the provided path. This method must be called before creating an instance of the TestStand engine.
This is a utilitiy class to help work with path names greater than
MAX_PATH.
Provided for convenience.
Provided for convenience.
Provided for convenience.
Provided for convenience.
Very simple check to see if the path begins with a drive letter (e.g. "C:").
Because UsesDriveLetter() is an internal helper function, it does not normalize the path. You must
do that if you want to.
The path to evaluate.
true if path begins with a drive letter; false otherwise.
Checks if the path is absolute.
Because InAbsolute() is an internal helper function, it does not normalize the path. You must do that
if you want to.
The path to evaluate.
true if path is absolute; false otherwise.
Long paths cannot be relative. This exception is thrown when one of our path functions
encounters a relative path.
See also http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247.aspx
Construct a new PathNotAbsoluteException.
This is a helper function for methods such as
and
.
It checks for conditions that the C# documentation
specifies lead to argument exceptions. It also performs
normalization. I found when reverse engineering some of the C#
path methods that they were implicitly normalizing path
arguments in multiple ways:
1. They trim leading and trailing whitespace.
2. They replace all slashes with backslashes.
3. Runs of consecutive directory separators are coalesced.
This method performs said normalization.
In addition, this method will optionally evaluate "." and ".." chacters. Note that doing so requires
path be absolute. If collapseDots is true and path is relative, a PathNotAbsoluteException is thrown.
Checking and normalization are combined because some of the
checking needs to happen before and some after
normalization.
The path to normalize.
The name of the paramter (to use with exceptions.)
Evaluate the ".." and "." chacters in the specified path.
A normalized version of the path.
If the path is empty,
contains invalid path characters, or is not of legal
form.
This function mimics the behavior of
but works on paths longer than MAX_PATH.
NOTE: Every attempt was made to make this method match the
behavior of Path.GetDirectoryName() as closely as possible,
but the actual behavior of Path.GetDirectoryName() is more
complex than documented at MSDN. We had to reverse engineer
the actual behavior for many cases. Our implementation may
miss some corner cases, particularly of the normalization
process. This implementation was tested and works for most
reasonable cases.
This function mimics the behavior of
but works for
paths longer than MAX_PATH. Note that paths longer than
MAX_PATH cannot be relative, so we cannot truly duplicate the
behavior of Path.GetFullPath() for arbitrary paths.
Note: This method will escape any path you give it with "\\?\"
(or "\\?\UNC\" if appropriate). You should not prepend the
"\\?\" to the path yourself.
This function mimics the behavior of
but works on paths longer than MAX_PATH.
NOTE: Every attempt was made to make this method match the
behavior of Path.GetPathRoot() as closely as possible,
but the actual behavior of Path.GetPathRoot() is more
complex than documented at MSDN. We had to reverse engineer
the actual behavior for many cases. Our implementation may
miss some corner cases, particularly of the normalization
process. This implementation was tested and works for most
reasonable cases.
Convenience method which calls into
The path to get the file name for
The file name of the path passed as a parameter.
Convenience method which calls
The first path to combine.
The second path to combine.
The combined paths. If one of the specified paths is a zero-length string, this method
returns the other path. If contains an absolute path, this
method returns .
Convenience method which calls .
An array of parts of the path.
The combined paths.
Convenience method that calls
The path of the file.
The string returned by , minus the last period (.) and all
characters following it.
Convenience method that calls
The path of the file.
The extension of the specified path (including the period "."), or null, or
String.Empty. If is null, GetExtension returns null. If
does not have extension information, GetExtension returns
.
Convenience method that calls
An array containing the characters that are not allowed in file names.
Convenience method that calls
An array containing the characters that are not allowed in path names.
This is a utility class to help work with path names greater than MAX_PATH
The full path of the file
Whether the values have been initialized.
Refreshes the information in the long file info structure.
Gets the size, in bytes, of the current file.
The size of the current file in bytes.
The creation time of the file. Note that this value is initialized the first time it
is read and it will not be refreshed unless you manually call refresh.
The last time the file was accessed. Note that this value is initialized the first time
it is read and it will not be refreshed unless you manually call refresh.
The modification time of the file. Note that this value is initialized the first time
it is read and it will not be refreshed unless you manually call refresh.
Creates a new instance of LongFileInfo with the file specified by
The path of the file
Creates a new instance of LongFileInfo using the information contained in
to get the date information.
The path of the file
The data structure which contains the dates for the files
This is a utilitiy class to help work with path names
greater than MAX_PATH.
This function mimics the behavior of
but works on paths longer than MAX_PATH.
Note that paths longer than MAX_PATH cannot be relative,
so we cannot duplicate the behavior of
File.Exists() exactly. This Exists() method requires
an absolute path (even for short paths).
Note: This method will escape any path you give it with "\\?\"
(or "\\?\UNC\" if appropriate). You should not prepend the
"\\?\" to the path yourself.
This function mimics the behavior of
but works on paths longer than MAX_PATH. Note that paths longer
than MAX_PATH cannot be relative, so we cannot duplicate
the behavior of File.Move() exactly. This Move() method requires
an absolute path (even for short paths). Also, the exception
behavior is not identical to that specified in File.Move().
You may get different types of
than specified. You may
also get .
Note: This method will escape any path you give it with "\\?\"
(or "\\?\UNC\" if appropriate). You should not prepend the
"\\?\" to the paths yourself.
This function mimics the behavior of
but works on paths longer than MAX_PATH. Note that paths longer
than MAX_PATH cannot be relative, so we cannot duplicate
the behavior of File.Copy() exactly. This Copy() method requires
an absolute path (even for short paths). Also, the exception
behavior is not identical to that specified in File.Copy().
You may get different types of
than specified. You may
also get .
Note: This method will escape any path you give it with "\\?\"
(or "\\?\UNC\" if appropriate). You should not prepend the
"\\?\" to the paths yourself.
This function mimics the behavior of
but works on paths longer than MAX_PATH. Note that paths longer
than MAX_PATH cannot be relative, so we cannot duplicate
the behavior of File.Copy() exactly. This Copy() method requires
an absolute path (even for short paths). Also, the exception
behavior is not identical to that specified in File.Copy().
You may get different types of
than specified. You may
also get .
Note: This method will escape any path you give it with "\\?\"
(or "\\?\UNC\" if appropriate). You should not prepend the
"\\?\" to the paths yourself.
This function mimics the behavior of
but works on paths longer than MAX_PATH. Note that paths longer
than MAX_PATH cannot be relative, so we cannot duplicate
the behavior of File.Delete() exactly. This Delete() method
requires an absolute path (even for short paths). Also, the
exception behavior is not identical to that specified in
File.Delete(). You may get different types of
than specified. You may
also get .
Note: This method will escape any path you give it with "\\?\"
(or "\\?\UNC\" if appropriate). You should not prepend the
"\\?\" to the path yourself.
Gets the FileAttributes of the file on the .
The path to the file.
The FileAttributes of the file on the path.
Sets the specified of the file on the specified
.
The path to the file.
A bitwise combination of the enumeration values.
Creates a new file, writes the specified string to the file, and then closes the file.
If the target file already exists, it is overwritten.
The file to write to.
The string to write to the file.
This is a utilitiy class to help work with path names greater than
MAX_PATH.
This function mimics the behavior of
but works on paths longer than MAX_PATH.
Note that paths longer than MAX_PATH cannot be relative,
so we cannot duplicate the behavior of
Directory.Exists() exactly. This Exists() method requires
an absolute path (even for short paths).
Note: This method will escape any path you give it with "\\?\"
(or "\\?\UNC\" if appropriate). You should not prepend the
"\\?\" to the paths yourself.
This function mimics the behavior of
but works on paths longer than MAX_PATH.
Note that paths longer than MAX_PATH cannot be relative,
so we cannot duplicate the behavior of
Directory.Delete() exactly. This Delete() method requires
an absolute path (even for short paths).
Note: This method will escape any path you give it with "\\?\"
(or "\\?\UNC\" if appropriate). You should not prepend the
"\\?\" to the paths yourself.
This function mimics the behavior of
but works on paths longer than MAX_PATH.
Note that paths longer than MAX_PATH cannot be relative,
so we cannot duplicate the behavior of
Directory.CreateDirectory() exactly. This method requires
an absolute path (even for short paths).
Note: This method will escape any path you give it with "\\?\"
(or "\\?\UNC\" if appropriate). You should not prepend the
"\\?\" to the paths yourself.
The directory path to create.
This function mimics the behavior of
but works on paths longer than MAX_PATH.
Note that paths longer than MAX_PATH cannot be relative,
so we cannot duplicate the behavior of
Directory.GetFiles() exactly. This method requires
an absolute path (even for short paths).
Note: This method will escape any path you give it with "\\?\"
(or "\\?\UNC\" if appropriate). You should not prepend the
"\\?\" to the paths yourself.
The full path name of the directory to get
files from.
This function mimics the behavior of
but works on paths longer than MAX_PATH.
Note that paths longer than MAX_PATH cannot be relative,
so we cannot duplicate the behavior of
Directory.GetDirectories() exactly. This method requires
an absolute path (even for short paths).
Note: This method will escape any path you give it with "\\?\"
(or "\\?\UNC\" if appropriate). You should not prepend the
"\\?\" to the paths yourself.
The full path name of the directory to get
directories from.