Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

Search Results for "rect" in [All]

wininet

.
Summary
Sends commands directly to an FTP server.
.
Summary
Creates a new directory on the FTP server
.

static extern bool FtpCreateDirectory(IntPtr hConnect, string lpszDirectory);

.

  Private Shared Function FtpCreateDirectory(ByVal hConnect As IntPtr, ByVal lpszDirectory As String) As Boolean

.
Documentation
[FtpCreateDirectory] on MSDN
.

Direct Link: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wininet/wininet/FtpDeleteFile.asp

.
Summary
.

Direct Link: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wininet/wininet/FtpFindFirstFile.asp

.
Summary
Retrieves the current directory for the specified FTP session.
.

static extern bool FtpGetCurrentDirectory(IntPtr hConnect,

.

   StringBuilder directory, ref int bufferLength);

.

Declare Function FtpGetCurrentDirectory Lib "wininet.dll" _

.

   (ByVal hConnect As IntPtr, ByVal directory As StringBuilder, ByRef bufferLength As Integer) _

.

    If FtpGetCurrentDirectory(Me.hINetConn, s, nLen) Then

.
Documentation
[FtpGetCurrentDirectory] on MSDN
.

Direct Link: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wininet/wininet/FtpGetCurrentDirectory.asp

.

    private const long INTERNET_OPEN_TYPE_DIRECT = 1;

.

Direct Link: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wininet/wininet/FtpGetFile.asp

.
Summary
Remove an directory at the FTP site
.

public static extern bool FtpRemoveDirectory(IntPtr ulSession, string lpszDirectory);

.

Declare Function FtpRemoveDirectory Lib "wininet.dll" (TODO) As TODO

.
Documentation
[FtpRemoveDirectory] on MSDN
.

Direct Link: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wininet/wininet/ftpputfile.asp

.
Summary
Changes to a different working directory on the FTP server.
.

static extern bool FtpSetCurrentDirectory(IntPtr hFtpConnection, string lpszDirectory);

.

Declare Function FtpSetCurrentDirectory Lib "wininet.dll" Alias "FtpSetCurrentDirectoryA" (ByVal hConnect As IntPtr, ByVal lpszDirectory As String) As Boolean

.

Dim changed As Boolean = FtpSetCurrentDirectory(hINetConn, changePath)

.
Documentation
[FtpSetCurrentDirectory] on MSDN
.

Direct Link: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wininet/wininet/InternetFindNextFile.asp

.

Direct Link: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wininet/wininet/internetgetconnectedstate.asp

.

Direct Link: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wininet/wininet/InternetGetLastResponseInfo.asp

.

const int INTERNET_OPEN_TYPE_DIRECT = 1; // direct to net

.

Const INTERNET_OPEN_TYPE_DIRECT = 1 ' // direct to net

.

    IntPtr hInternet = InternetOpen("browser", INTERNET_OPEN_TYPE_DIRECT, null, null, 0);

kernel32

.

    public string lpAssemblyDirectory;

.

    private const uint ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID = 0x004;

.
  • Not sure how this interacts with console redirection, didn't try it... i suppose it will work fine but if it doesnt let me know
.
  • Not sure how this interacts with console redirection, didn't try it... i suppose it will work fine but if it doesnt let me know
17: Beep
.

This function does nothing when imported into a VB6 application. It does however work properly when called directly from a C++ application compiled with MSVC6.

.

// 11/21/2012 Correcting signature for GetConsoleScreenBufferInfoEx and cleaned up CONSOLE_SCREEN_BUFFER_INFO_EX.ColorTable

.

        ref SMALL_RECT lpReadRegion

.

       [In] ref SMALL_RECT lpScrollRectangle,

.

        IntPtr lpClipRectangle,

.

        [In] ref SMALL_RECT lpConsoleWindow

.

        ref SMALL_RECT lpWriteRegion

.

    public struct SMALL_RECT

.

        public SMALL_RECT srWindow;

.

        public SMALL_RECT srWindow;

.

        SMALL_RECT Selection;

.

        const uint CONSOLE_SELECTION_NOT_EMPTY = 0x0002; //Selection rectangle is not empty

.
Summary
.

internal static extern bool CreateDirectory(String path, SECURITY_ATTRIBUTES lpSecurityAttributes);

.

    var security = new System.Security.AccessControl.DirectorySecurity();

.

    return CreateDirectory(path, lpSecurityAttributes);

.

System.IO.Directory.CreateDirectory

.
Documentation
[CreateDirectory] on MSDN
.
Summary
.

static extern bool CreateDirectoryEx(string lpTemplateDirectory, string lpNewDirectory, IntPtr? lpSecurityAttributes = null);

.
Documentation
[CreateDirectoryEx] on MSDN
.

# example usage for read access to a directory

.

        FILE_LIST_DIRECTORY = 0x0001,       // directory

.

        FILE_ADD_FILE = 0x0002,         // directory

.

        FILE_ADD_SUBDIRECTORY = 0x0004,     // directory

.

        FILE_READ_EA = 0x0008,          // file & directory

.

        FILE_WRITE_EA = 0x0010,         // file & directory

.

        FILE_TRAVERSE = 0x0020,         // directory

.

        FILE_DELETE_CHILD = 0x0040,     // directory

.

   Directory        = 0x00000010,

.

     FILE_ATTRIBUTE_DIRECTORY = &H10

.

//Using directives needed:

.

        Bidirectional = (int)(PIPE_ACCESS_INBOUND+PIPE_ACCESS_OUTBOUND)

.

        case ServerMode.Bidirectional:

.

        NamedPipeStream stream = NamedPipeStream.Create("testpipe", NamedPipeStream.ServerMode.Bidirectional);

.

   string lpCurrentDirectory,

.

    lpCurrentDirectory As String, _

.

    lpCurrentDirectory as string,

.

uint dwCreationFlags, IntPtr lpEnvironment, string lpCurrentDirectory,

.

0x1 The link target is a directory.

.

The unmanaged prototype contains a return directive because the CreateSymbolicLink API function returns BOOLEAN, a one-byte data type. The default marshaling for bool is four bytes (to allow seamless integration with BOOL return values). If you were to use the default marshaling for BOOLEAN values, it's likely that you will get erroneous results. The return directive forces PInvoke to marshal just one byte of the return value. Source: http://www.informit.com/guides/content.aspx?g=dotnet&seqNum=762&ns=16196

.

Also, The parent directory of lpSymlinkFileName must already exist. This is similar to other API's for creating files, which require the parent to exist.

.

Try System.Threading.Thread.Start. It doesn't give you all the control of directly calling CreateThread, (such as specifing the flags), but it will get you a vanilla thread to spin up.

.

    METHOD_IN_DIRECT = 1,

.

    METHOD_OUT_DIRECT = 2,

.

    InDirect    = 1,

.

    OutDirect    = 2,

.

    NetworkRedirector    = 0x00000028,

.

gave incorrect results due to signs.

.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/obtaining_directory_change_notifications.asp (dead link)

.
OBS
The correct VB signature is:
.

        if ((findData.dwFileAttributes & FileAttributes.Directory) != FileAttributes.Directory)

.

        if ((findData.dwFileAttributes & FileAttributes.Directory) != FileAttributes.Directory)

.

    //"CONIN$" will allow you to grab the input buffer regardless if it is being redirected.

.

    //0x00000001 - FILE_SHARE_READ - seems to be required to get the buffer correctly.

.

    //3 - OPEN_EXISTING - recommended by MSDN to get the buffer correctly

.

ThrowExceptionForHR is for HRESULT values returned directly from NT functions, is it not?

.

ThrowExceptionForHR is for HRESULT values returned directly from NT functions, is it not?

.

                #Attempts to get the binary type of all files in the current directory

.

                #Attempts to get the binary type of all exe files in the windows directory,

.

                #in the windows system32 directory by bypassing filesystem redirection using "sysnative",

.

                        #Put enum object directly into pipeline

.

The code below correctly obtains the compressed file size also if above 4GB. (Fixed VB and C# code, 2012 Eske Rahn)

.

        public SMALL_RECT srWindow;

.

        public SMALL_RECT srWindow;

.

        SMALL_RECT Selection;

.

        const uint CONSOLE_SELECTION_NOT_EMPTY = 0x0002; //Selection rectangle is not empty

.
Summary
.

static extern uint GetCurrentDirectory(uint nBufferLength,

.

* This sample uses: GetCurrentDirectoryW *

.

static extern uint GetCurrentDirectoryW(uint nBufferLength, StringBuilder lpBuffer);

.

uint folderNameLength = GetCurrentDirectory(MAX_DEEP_PATH, nameBuffer);

.

   Console.WriteLine("Failed to get initial working directory; error = '{0}'", lastError);

.

   Console.WriteLine("Failed to get initial working directory; allocated buffer is shorter than required: '{0}'<'{1}'", MAX_DEEP_PATH, folderNameLength);

.

Directory.GetCurrentDirectory

.
Documentation
[GetCurrentDirectory] on MSDN
.

   static extern bool GetDiskFreeSpaceEx(string lpDirectoryName,

.

   static extern bool GetDiskFreeSpaceEx(string lpDirectoryName,

.

/// <param name="folderName">Directory or unc folder name of the volume to

.

   static extern bool GetDiskFreeSpaceEx(string lpDirectoryName,

.

   static extern bool GetDiskFreeSpaceEx(string lpDirectoryName,

.

/// <param name="folderName">Directory or unc folder name of the volume to

.

  /// <param name="lpRootPathName">A pointer to a null-terminated string that specifies the root directory and returns information about the disk.A trailing backslash is required. If this parameter is NULL, the function uses the root of the current directory.</param>

.

    internal static Int64 GetDirectoryId(string dir)

.

        GetFileInformationByHandleEx(handle, FILE_INFO_BY_HANDLE_CLASS.FileIdBothDirectoryInfo, out fileStruct, (uint)Marshal.SizeOf(fileStruct));

.

    internal static Int64 GetDirectoryId(string dir)

.

        GetFileInformationByHandleEx(handle, FILE_INFO_BY_HANDLE_CLASS.FileIdBothDirectoryInfo, out fileStruct, (uint)Marshal.SizeOf(fileStruct));

.

Calling GetLastError directly via PInvoke is not guaranteed to work due to the CLR's internal interaction with the operating system. Instead, call Marshal.GetLastWin32Error.

.

The file must exist to get the correct path. This is because the full path comes from the file system information. If an invalid name is given and exception is not thrown rather the name is just a blank space.

.

    string[] paths = Directory.GetFiles( Path.GetDirectoryName(shortName), Path.GetFileName(shortName) );

.

Public Const CT_TYPE2 As Int32 = &H2    ' Retrieves bi-directional layout info

.

    BidirectionalLayout = CT_TYPE2

.

Public Const CT_TYPE2 As Int32 = &H2    ' Retrieves bi-directional layout info

.

    BidirectionalLayout = CT_TYPE2

.
Summary
.

static extern uint GetSystemDirectory([Out] StringBuilder lpBuffer,

.

<DllImport("kernel32.dll", SetLastError:=true, EntryPoint:="GetSystemDirectoryW", CharSet:=CharSet.Unicode)> _

.

Public Function GetSystemDirectory(<MarshalAs(UnmanagedType.LPTSTR)>lpBuffer As System.Text.StringBuilder, _

.

Public Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" _

.

    res = GetSystemDirectory(sbSystemDir,256);

.
Documentation
[GetSystemDirectory] on MSDN
.

static extern UInt32 GetSystemWindowsDirectory(StringBuilder sb, UInt32 size);

.

Declare Function GetSystemWindowsDirectoryW Lib "kernel32.dll" (TODO) As TODO

.

public static String GetSystemWindowsDirectory()

.

     GetSystemWindowsDirectory(sb, i);

.
Documentation
[GetSystemWindowsDirectoryW] on MSDN
.
Summary
Retrieves the path of the system directory used by WOW64. This directory is not present on 32-bit Windows.
.

public static extern int GetSystemWow64Directory([In, Out] char[] lpBuffer, [MarshalAs(UnmanagedType.U4)] uint size);

.

public static extern int GetSystemWow64Directory([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder lpBuffer, [MarshalAs(UnmanagedType.U4)] uint size);

.

Private Declare Function GetSystemWow64Directory Lib "Kernel32.dll" Alias _

.

      "GetSystemWow64DirectoryA" (ByVal lpBuffer As String, ByVal uSize As Long) As Integer

.

    public static extern int GetSystemWow64Directory([In, Out] char[] lpBuffer, [MarshalAs(UnmanagedType.U4)] uint size);

.

    int result = GetSystemWow64Directory(path, (uint)path.Length);

.

    private static extern int GetSystemWow64Directory([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder lpBuffer, [MarshalAs(UnmanagedType.U4)] uint size);

.

    if (GetSystemWow64Directory(buffer, (uint)buffer.Capacity) != 0)

.

    Private Declare Function GetSystemWow64Directory Lib "Kernel32.dll" Alias _

.

      "GetSystemWow64DirectoryA" (ByVal lpBuffer As String, ByVal uSize As Integer) As Integer

.

    Dim Result As Integer = GetSystemWow64Directory(DirPath, DirPath.Length)

.
Documentation
.

      Directory.CreateDirectory(tempFolderName);

.
Summary
Retrieves the path of the directory designated for temporary files.
.

    Dim dirInfo As DirectoryInfo

.

    If Not Directory.Exists(fFoldername) Then

.

        dirInfo = Directory.CreateDirectory(fFoldername)

.

        Throw New Exception("Directory '" + fFoldername + "' can not be created")

.

Note, the managed API is subtly different than the Win32 API call. The Win32 API call returns an unsigned int while the managed API returned a signed int. Also note that the MSDN documentation for System.Environment.TickCount() is not correct. This managed API rolls over to int.MinValue and not to 0 after 24.9 days.

.

UPDATE, The MSDN documentation has been updated to correctly state the int.MinValue 24.9 day rollover. The new documentation also provides an example of how to correctly return a positive value from the method. http://msdn2.microsoft.com/en-us/library/system.environment.tickcount.aspx

.

  /// <para>To select the correct day in the month, set the wYear member to zero, the wHour and wMinute members to the transition time, the wDayOfWeek member to the appropriate weekday, and the wDay member to indicate the occurence of the day of the week within the month (first through fifth).</para>

.

  /// <para>To select the correct day in the month, set the wYear member to zero, the wHour and wMinute members to the transition time, the wDayOfWeek member to the appropriate weekday, and the wDay member to indicate the occurence of the day of the week within the month (first through fifth).</para>

.

    /// The specified volume is a direct access (DAX) volume. This flag was introduced in Windows 10, version 1607.

.

   ''' for the specified directory. Works with UNC. Can throw an exception.

.
Summary
.

static extern uint GetWindowsDirectory(StringBuilder lpBuffer,

.

<DllImport("kernel32.dll", SetLastError:=true, EntryPoint:="GetWindowsDirectoryW", CharSet:=CharSet.Unicode)> _

.

Public Function GetWindowsDirectory(<MarshalAs(UnmanagedType.LPTSTR)>lpBuffer As System.Text.StringBuilder, _

.

Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" _

.

   Dim Res As Integer = GetWindowsDirectory(WinDir, WinDir.Length)

.

     GetWindowsDirectory(sb,i)

.

   int len = (int)GetWindowsDirectory(sb, MaxPathLength);

.

   _windowsDirectory = sb.ToString(0, len);

.

     GetWindowsDirectory(sb,ref  i);

.
Documentation
[GetWindowsDirectory] on MSDN
.

  Dim rect As Rectangle = New Rectangle(0, 0, Width, Height)

.

  bitmapData = bitmap.LockBits(rect, ImageLockMode.WriteOnly, PixelFormat.Format1bppIndexed)

Cut off search results after 60. Please refine your search.


 
Access PInvoke.net directly from VS: