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 "StringBuilder" in [All]

wininet

.

   StringBuilder directory, ref int bufferLength);

.

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

.

    Dim s As New System.Text.StringBuilder

.

static extern bool InternetGetCookieEx(string pchURL, string pchCookieName, StringBuilder pchCookieData, ref System.UInt32 pcchCookieData, int dwFlags, IntPtr lpReserved);

.

    ByVal pchCookieData As System.Text.StringBuilder, ByRef pcchCookieData As Integer, ByVal flags As Integer, ByVal reserved As Integer) As _

.

    static extern bool InternetGetCookieEx(string pchURL, string pchCookieName, StringBuilder pchCookieData, ref System.UInt32 pcchCookieData, int dwFlags, IntPtr lpReserved);

.

        StringBuilder cookieData = new StringBuilder(Convert.ToInt32(datasize));

.

        // Allocate stringbuilder large enough to hold the cookie    

.

        cookieData = new StringBuilder(Convert.ToInt32(datasize));

.

static extern bool InternetGetCookieEx(string pchURL, string pchCookieName, StringBuilder pchCookieData, ref System.UInt32 pcchCookieData, int dwFlags, IntPtr lpReserved);

.

    ByVal pchCookieData As System.Text.StringBuilder, ByRef pcchCookieData As Integer, ByVal flags As Integer, ByVal reserved As Integer) As _

.

   out int errorCode, StringBuilder buffer, ref int bufferLength);

.

    Shared Function PrivacySetZonePreference( ByVal dwZone As Integer, ByVal dwType As Integer, ByVal dwTemplate As Integer, <MarshalAs(UnmanagedType.LPWStr)> ByVal lpszPreference As StringBuilder) As Integer

.

    Dim sBuffer As StringBuilder

.

    sBuffer = New StringBuilder(" ", dwBufferLength)

.

        sBuffer = New StringBuilder(dwBufferLength)

.

    Shared Function PrivacySetZonePreference( ByVal dwZone As Integer, ByVal dwType As Integer, ByVal dwTemplate As Integer, <MarshalAs(UnmanagedType.LPWStr)> ByVal lpszPreference As StringBuilder) As Integer

.

    Dim sPreference As StringBuilder

.

        sPreference = New StringBuilder

advapi32

.
Dissent
Don't use an IntPtr like above, just use a System.Text.StringBuilder. You shouldn't need to worry about calling LocalFree in this case either, but I have not confirmed this 100%.
.

        StringBuilder strSid = new StringBuilder();

.

                           <[In](), Out(), [Optional]()> ByVal lpCommandLine As StringBuilder, _

.

Use StringBuilder for lpCommandLine parameter for unicode version of this function.

.

    StringBuilder pszProvName,

.

    StringBuilder pszProvName,

.

    StringBuilder pszProvName,

.

    StringBuilder pszName;

.

        pszName = new StringBuilder(cbName);

.

         System.Text.StringBuilder pszProvName,

.

         System.Text.StringBuilder pszTypeName,

.

     $pszTypeName = New-Object Text.StringBuilder

.

     $pszProvName = New-Object Text.Stringbuilder

.

    System.Text.StringBuilder pszTypeName,

.

    StringBuilder pszProvName,

.

StringBuilder providerName = new StringBuilder(255);

.

   [MarshalAs(UnmanagedType.LPStr)] StringBuilder pbData,

.

    StringBuilder _buffer = new StringBuilder();

.

    StringBuilder _account = new StringBuilder(_bufferSize);

.

    StringBuilder _domain = new StringBuilder(_bufferSize);

.

   Dim sb As New StringBuilder

.

   Dim sb As New StringBuilder

.

static extern bool GetUserName(System.Text.StringBuilder sb, ref Int32 length);

.

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

.

        static extern bool GetUserName(StringBuilder lpBuffer, ref int nSize);    

.

            StringBuilder Buffer = new StringBuilder(64);

.

        Public Function GetUserName(<MarshalAs(UnamagedType.LPTSTR)>System.Text.StringBuilder sb, _

.

            Dim Buffer = new StringBuilder(64)

.

public static extern bool GetUserName(System.Text.StringBuilder sb, ref Int32 length);

.

$str = New-Object System.Text.StringBuilder -ArgumentList $size

.

        StringBuilder ReferencedDomainName,

.

        StringBuilder referencedDomainName = new StringBuilder();

.

    StringBuilder ReferencedDomainName,

.

Private Shared Function LookupAccountName(lpSystemName As String, lpAccountName As String, <MarshalAs(UnmanagedType.LPArray)> Sid As Byte(), ByRef cbSid As UInteger, ReferencedDomainName As StringBuilder, ByRef cchReferencedDomainName As UInteger, peUse As SID_NAME_USE) As Boolean

.

            StringBuilder ReferencedDomainName,

.

            StringBuilder referencedDomainName = new StringBuilder();

.

    Dim refDomainName As New StringBuilder

.

    System.Text.StringBuilder lpName,

.

    System.Text.StringBuilder ReferencedDomainName,

.

      StringBuilder lpName,

.

      StringBuilder ReferencedDomainName,

.

      StringBuilder name = new StringBuilder();

.

      StringBuilder referencedDomainName = new StringBuilder();

.

    System.Text.StringBuilder displayName,  // out

.

This is one of those "call twice" functions, so this error is just daily life. When it returns with this error, the byte count (cbDisplayName) will be set to what you need. Call EnsureCapacity on your StringBuilder and go round again.

.

   System.Text.StringBuilder lpName,

.

System.Text.StringBuilder sb = new System.Text.StringBuilder();

.

    //StringBuilder and size for the domain name

.

    StringBuilder aDomainName = new StringBuilder();

.

    aDomainName = new StringBuilder( aNameSize );

.

    public static extern IntPtr pcap_lookupdev( StringBuilder errbuf );

.

    public static extern IntPtr pcap_lookupdev( StringBuilder errbuf );

.

    StringBuilder lpName,

.

   ByVal lpName As StringBuilder, _

.

   Dim sb As New StringBuilder(MAX_REG_KEYNAME_SIZE + 1)

.

      StringBuilder lpValueName,

.

   ByVal lpValueName As StringBuilder, _

.

   Dim sb As New StringBuilder(MAX_REG_KEYNAME_SIZE + 1)

.

      StringBuilder keyBuffer = new StringBuilder((int)size);

.

      StringBuilder keyBuffer = new StringBuilder((int)size);

.

    System.Text.StringBuilder lpData,

.

    ByVal lpData As System.Text.StringBuilder, _

.

Dim KeyValue As System.Text.StringBuilder

.

    KeyValue = New System.Text.StringBuilder(KeyValueLength)

.

    System.Text.StringBuilder pvData = new System.Text.StringBuilder(1024);

.

      StringBuilder keyBuffer = new StringBuilder();

.

    System.Text.StringBuilder lpData,

.

    ByVal lpData As System.Text.StringBuilder, _

.

Dim KeyValue As System.Text.StringBuilder

.

    KeyValue = New System.Text.StringBuilder(KeyValueLength)

.

    System.Text.StringBuilder pvData = new System.Text.StringBuilder(1024);

.

      StringBuilder keyBuffer = new StringBuilder();

crypt32

.

static extern UInt32 CertGetNameString(IntPtr CertContext, UInt32 lType, UInt32 lFlags, IntPtr pTypeParameter, System.Text.StringBuilder str, UInt32 cch);

.

        StringBuilder Buffer = new StringBuilder(255);

.

    private static extern uint _certNameToStr(uint dwCertEncodingType, IntPtr pName, uint dwStrType, StringBuilder psz, uint csz);

.

        StringBuilder psz = null;

.

            psz = new StringBuilder((int)ret);

.

        StringBuilder ppszError);

.

    Public Shared Function CertStrToName(dwCertEncodingType As UInteger, pszX500 As String, dwStrType As UInteger, pvReserved As IntPtr, pbEncoded As Byte(), ByRef pcbEncoded As UInteger, ppszError As StringBuilder) As Boolean

.

    StringBuilder szDataDescr,

.

     ByVal szDataDescr As StringBuilder, _

dwmapi

.

        StringBuilder sb = new StringBuilder();

msvcrt

36: scanf
.

Use System.Text.StringBuilder instead of System.String.

.

            StringBuilder s = new StringBuilder();

.

    StringBuilder buffer,

.

    StringBuilder buffer,

.

static extern int sprintf([In,Out]StringBuilder buffer, String fmt,

.

static extern int sprintf([In,Out]StringBuilder buffer, String fmt,

.

static extern int sprintf([In,Out]StringBuilder buffer, String fmt,

.

  Public Shared Function sprintf(ByVal TargetString As System.Text.StringBuilder,

.

StringBuilder buffer = new StringBuilder(255);

.
VB.NET
Investigate the use of System.Text.StringBuilder.AppendFormat before using sprintf.

odbccp32

.

public static extern SQL_RETURN_CODE    SQLInstallerError(int iError, ref SQL_INSTALLER_ERROR_CODE pfErrorCode, StringBuilder lpszErrorMsg, int cbErrorMsgMax, ref int pcbErrorMsg);

.

Public Shared Function SQLInstallerError(ByVal iError As Integer, ByRef pfErrorCode As Integer, ByVal lpszErrorMsg As StringBuilder, ByVal cbErrorMsgMax As Integer, ByRef pcbErrorMsg As Integer) As SQL_RETURN_CODE

.

StringBuilder         errorMesg        = new StringBuilder( 512 ) ;

.

Dim errorMsg As New StringBuilder(512)

ipaqutil

.

public static extern bool iPAQGetModelID([Out]StringBuilder lpszModelID);

.

                    StringBuilder buffer = new StringBuilder(40);

.

private static extern bool iPAQGetSerialNumber([Out] StringBuilder SerialNumber);

.

    StringBuilder sSerial = new StringBuilder(40);

uxtheme

.

public extern static Int32 GetCurrentThemeName(StringBuilder stringThemeName, int lengthThemeName, StringBuilder stringColorName, int lengthColorName, StringBuilder stringSizeName, int lengthSizeName);

.

Declare Unicode Function GetCurrentThemeName Lib "uxtheme" (ByVal stringThemeName As StringBuilder, ByVal lengthThemeName As Integer, ByVal stringColorName As StringBuilder, ByVal lengthColorName As Integer, ByVal stringSizeName As StringBuilder, ByVal lengthSizeName As Integer) As Int32

.

Originally the signature had the 3 StringBuilder parameters as out params, but that did not work. Once that was removed it worked.

.

When creating the StringBuilder variable, an initial size must be set otherwise an unmanaged exception is thrown

.

    StringBuilder stringThemeName = new StringBuilder(260);

.

    StringBuilder stringColorName = new StringBuilder(260);

.

    StringBuilder stringSizeName = new StringBuilder(260);

.

    StringBuilder sbFilename = new sbFilename(0x200);

.

public extern static Int32 GetThemeDocumentationProperty(String stringThemeName, String stringPropertyName, out StringBuilder stringValue, int lengthValue);

.

Public Shared Function GetThemeDocumentationProperty(stringThemeName As [String], stringPropertyName As [String], ByRef stringValue As StringBuilder, lengthValue As Integer) As Int32

.

public extern static Int32 GetThemeFilename(IntPtr hTheme, int iPartId, int iStateId, int iPropId, StringBuilder themeFileName, int themeFileNameLength);

.

public extern static Int32 GetThemeString(IntPtr hTheme, int iPartId, int iStateId, int iPropId, out StringBuilder themeString, int themeStringLength);

.

Public Shared Function GetThemeString(hTheme As IntPtr, iPartId As Integer, iStateId As Integer, iPropId As Integer, ByRef themeString As StringBuilder, themeStringLength As Integer) As Int32

.

public extern static Int32 GetThemeSysString(IntPtr hTheme, int iStringId, out StringBuilder stringSys, int stringSysLength);

.

Public Shared Function GetThemeSysString(hTheme As IntPtr, iStringId As Integer, ByRef stringSys As StringBuilder, stringSysLength As Integer) As Int32

winspool

.

public static extern bool GetDefaultPrinter(StringBuilder pszBuffer, ref int pcchBuffer);

.

(ByVal pszBuffer As System.Text.StringBuilder, ByRef pcchBuffer As Int32) As Boolean

.

    StringBuilder pszBuffer = new StringBuilder(pcchBuffer);

.

    static extern bool GetPrinterDriverDirectory(StringBuilder pName,

.

                              StringBuilder pEnv,

.

                              [Out] StringBuilder outPath,

.

        StringBuilder str = new StringBuilder(1024);

.

    static extern bool GetPrinterDriverDirectory(StringBuilder pName,

.

                              StringBuilder pEnv,

.

                              [Out] StringBuilder outPath,

.

        StringBuilder str = new StringBuilder(1024);

.

    static extern bool GetPrinterDriverDirectory(StringBuilder pName,

.

                              StringBuilder pEnv,

.

                              [Out] StringBuilder outPath,

.

        StringBuilder str = new StringBuilder();

.

static extern bool GetPrintProcessorDirectory(StringBuilder pName, StringBuilder pEnv, int Level, [Out] StringBuilder outPath, int bufferSize,

.

    static extern bool GetPrintProcessorDirectory(StringBuilder pName,

.

                          StringBuilder pEnv,

.

                          [Out] StringBuilder outPath,

.

    StringBuilder str = new StringBuilder();

coredll

.

        int dwMessageId, int dwLanguageId, System.Text.StringBuilder lpBuffer, int nSize, IntPtr[] Arguments);

.

        int dwMessageId, int dwLanguageId, System.Text.StringBuilder lpBuffer, int nSize, IntPtr[] Arguments);

.

        System.Text.StringBuilder sbMsg = new System.Text.StringBuilder(1024);

.

   public static extern int GetClassName(IntPtr hWnd, StringBuilder buf, int nMaxCount);

.

   (hWnd as IntPtr, buf As StringBuilder, nMaxCount As Integer) As Integer

.

   StringBuilder strClassName = new StringBuilder(256);

.

static extern int GetModuleFileNameEx(IntPtr hProcess, IntPtr hModule, StringBuilder lpFilename, int nSize);

.

Declare Function GetModuleFileNameEx Lib "coredll.dll" (ByVal hProcess As IntPtr, ByVal hModule As IntPtr, ByVal lpFileName As System.Text.StringBuilder, ByVal nSize As Int32) As Int32

.

static extern int GetModuleFileNameEx(IntPtr hProcess, IntPtr hModule, StringBuilder lpFilename, int nSize);

.

Declare Function GetModuleFileNameEx Lib "coredll.dll" (ByVal hProcess As IntPtr, ByVal hModule As IntPtr, ByVal lpFileName As System.Text.StringBuilder, ByVal nSize As Int32) As Int32

. .

   IntPtr hKey, [Out()]StringBuilder lpClass, ref uint lpcchClass,

.

OutAttribute is used with [StringBuilder] parameters because StringBuilder is a reference type. Using the out keyword will result in passing the reference by-reference, but in this case the reference must be passed by-value.

.

static extern int RegQueryValueEx( UIntPtr hkey, String lpValueName, IntPtr lpReserved, ref KeyType lpType, StringBuilder lpData, ref uint lpcbData );

.

We pass a StringBuilder for lpData to deal with null-terminated strings that normally come back from this operation.

.
LPSTR String or StringBuilder*
.
LPTSTR String or StringBuilder
.
LPWSTR String or StringBuilder
.

static extern int SHCreateShortcut(StringBuilder szShortcut, StringBuilder szTarget);

.

Private Declare Function SHCreateShortcut% Lib "coredll" (ByVal szShortcut As System.Text.StringBuilder, ByVal szTarget As System.Text.StringBuilder)!!!!User-Defined Types:

.

    static extern int SHGetSpecialFolderPath(IntPtr hwndOwner, StringBuilder lpszPath, int nFolder, int fCreate);

.

    static extern int SHCreateShortcut(StringBuilder szShortcut, StringBuilder szTarget);

.

    StringBuilder programs = new StringBuilder(255);

.

    StringBuilder shortcutLocation = new StringBuilder(Path.Combine(programs.ToString(), "Foo.lnk");

.

    StringBuilder shortcutTarget = new StringBuilder("\"" + @"\Program Files\Foo\Foo.exe" + "\"");

.

static extern bool SHGetShortcutTarget(StringBuilder szShortcut, StringBuilder szTarget, int cbMax);

.

StringBuilders are generally used in place of LPTSTR's in PInvoke signatures. szShortcut is a full path to a shortcut file (which usually has the extension .lnk), szTarget is a buffer to receive the target path, and cbMax is the length of the szTarget buffer. The function returns success/failure; it isn't documented whether it returns failure if cbMax is too small, or if the target-path is truncated or what.

.

static extern int SHGetSpecialFolderPath(IntPtr hwndOwner, StringBuilder lpszPath, int nFolder, int fCreate);

.

        StringBuilder resultPath = new StringBuilder(255);

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


 
Access PInvoke.net directly from VS: