Replacement for StrPtr ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tim

    #1

    Replacement for StrPtr ?

    I've searched my help files, and all I can find is that the StrPtr() function is
    not supported.

    Is there a suitable replacement in VB.Net?


  • Tom Shelton

    #2
    Re: Replacement for StrPtr ?

    Tim wrote:
    [color=blue]
    > I've searched my help files, and all I can find is that the StrPtr()
    > function is not supported.
    >
    > Is there a suitable replacement in VB.Net?[/color]

    What do you need it for? If you let us know, we can point you to the
    correct method to do what it is you need to do....

    Tom Shelton

    Comment

    • Ken Tucker

      #3
      Re: Replacement for StrPtr ?

      Tim,

      Take a look at Marshal.PtrToSt ringAuto , Marshal.PtrToSt ringAnsi,
      and Marshal.PtrToSt ringUni.
      http://msdn.microsoft.com/library/de...mberstopic.asp

      Ken
      ---------------------
      "Tim" <timakal@hotmai l.com> wrote in message
      news:eo5atHBgDH A.956@TK2MSFTNG P09.phx.gbl...[color=blue]
      > I've searched my help files, and all I can find is that the StrPtr()[/color]
      function is[color=blue]
      > not supported.
      >
      > Is there a suitable replacement in VB.Net?
      >
      >[/color]


      Comment

      • Cor

        #4
        Re: Replacement for StrPtr ?

        Hi Tim,

        You can doubt if this is a subject for this newsgroup. On the other hand I'
        ve seen an answer from Herfried to Ashok where Herfried did write.
        [color=blue]
        >Please post the complete VB6 declaration of 'EbExecuteLine' . Why do you[/color]
        use this function?!
        So maybe he can help you when you send that.

        Did you know there is a special newsgroup for dotnet vb upgrade questions?
        (I thought Herfried was active in that newsgroup too).
        Maybe you can get a quicker answer there.

        Mostly Herfried looks for the messages about 11:00 or 12:00 GMT, but it is
        Sunday in Europe so I don't know if that will be today.

        I hope you get your answer.

        Cor






        Comment

        • Cor

          #5
          Re: Replacement for StrPtr ?

          Hi Tim,
          I was writing this while you got your answers.
          Happenly a lot faster and better than yesterday.
          Cor


          Comment

          • Herfried K. Wagner [MVP]

            #6
            Re: Replacement for StrPtr ?

            Hello,

            "Cor" <non@non.com> schrieb:[color=blue]
            > You can doubt if this is a subject for this newsgroup.[/color]

            I think it is...
            [color=blue]
            > Mostly Herfried looks for the messages about 11:00 or 12:00
            > GMT, but it is Sunday in Europe so I don't know if that will be
            > today.[/color]

            ;-)

            I hope Tim posts the code he wants to convert.

            --
            Herfried K. Wagner
            MVP ยท VB Classic, VB.NET



            Comment

            • Herfried K. Wagner [MVP]

              #7
              Re: Replacement for StrPtr ?

              Hello,

              "Tim" <timakal@hotmai l.com> schrieb:[color=blue]
              > Well it's just a small program I've written in VB6 for my work.
              > I know I could take my time and create a REAL one, but
              > I've been using an InputBox() to get a response from someone,
              > and I was using the StrPtr() method to detect if the user
              > was pressing Cancel rather than pressing Enter[/color]

              That's not supported by the VB.NET 'InputBox' any more.

              You may want to implement an input box on your own:



              --
              Herfried K. Wagner
              MVP ยท VB Classic, VB.NET



              Comment

              • Brenton Norman

                #8
                RE: Replacement for StrPtr ?

                I have the same issue to resolve. Here is relevant code that requires modification:

                lngResult = CoCreateGuid(ud tGUID) ' Create a 'raw' GUID
                If lngResult = GUID_OK Then
                strFormattedGUI D = New String(Chr(0), GUID_LENGTH + 1)
                ' Convert the 'raw' GUID to a formatted string
                'UPGRADE_ISSUE: StrPtr function is not supported. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?ke yword="vbup1040 "'
                StringFromGUID2 (udtGUID, StrPtr(strForma ttedGUID), GUID_LENGTH + 1)
                Else ' Either return nothing or find some way to handle the error
                strFormattedGUI D = Right(Space(GUI D_LENGTH) & VB6.Format(Now, "yyyymmddhh nn") & VB6.Format(GetT ickCount(), "000000000000") , GUID_LENGTH)
                End If
                CreateGUIDKey = Left(Trim(strFo rmattedGUID) & Space(GUID_LENG TH), GUID_LENGTH)

                Brenton


                From http://www.developmentnow.com/g/38_2...or-StrPtr-.htm

                Posted via DevelopmentNow. com Groups
                DevelopmentNow is an award-winning creative software development agency integrating mobile, web, hardware, mixed reality, and emerging technology.

                Comment

                • Herfried K. Wagner [MVP]

                  #9
                  Re: Replacement for StrPtr ?

                  "Brenton Norman" <brenton.norman @medcom.com.aus chrieb:
                  lngResult = CoCreateGuid(ud tGUID) ' Create a 'raw' GUID
                  If lngResult = GUID_OK Then
                  strFormattedGUI D = New String(Chr(0), GUID_LENGTH + 1)
                  ' Convert the 'raw' GUID to a formatted string
                  'UPGRADE_ISSUE: StrPtr function is not supported. Click for
                  more:
                  'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?ke yword="vbup1040 "'
                  StringFromGUID2 (udtGUID, StrPtr(strForma ttedGUID), GUID_LENGTH
                  + 1)
                  How does the declaration of 'StringFromGUID 2' look like?

                  --
                  M S Herfried K. Wagner
                  M V P <URL:http://dotnet.mvps.org/>
                  V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

                  Comment

                  • Herfried K. Wagner [MVP]

                    #10
                    Re: Replacement for StrPtr ?

                    Addendum:

                    In addition, take a look at the 'System.Guid' class.

                    --
                    M S Herfried K. Wagner
                    M V P <URL:http://dotnet.mvps.org/>
                    V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

                    Comment

                    • Brenton Norman

                      #11
                      RE: Replacement for StrPtr ?

                      Hear's the StringFromGUID2 declration:

                      Private Declare Function StringFromGUID2 Lib "OLE32.DLL" (ByRef pGuid As GUID, ByVal PointerToString As Integer, ByVal MaxLength As Integer) As Integer

                      Brenton

                      From http://www.developmentnow.com/groups...hreadid=226413

                      Posted via DevelopmentNow. com Groups
                      DevelopmentNow is an award-winning creative software development agency integrating mobile, web, hardware, mixed reality, and emerging technology.

                      Comment

                      • Brenton Norman

                        #12
                        RE: Replacement for StrPtr ?

                        I think this does the job:

                        Dim udtGUID As System.Guid
                        Dim strFormattedGUI D As String

                        udtGUID = System.Guid.New Guid()
                        ...
                        strFormattedGUI D = udtGUID.ToStrin g

                        Brenton


                        From http://www.developmentnow.com/groups...hreadid=226413

                        Posted via DevelopmentNow. com Groups
                        DevelopmentNow is an award-winning creative software development agency integrating mobile, web, hardware, mixed reality, and emerging technology.

                        Comment

                        Working...