473,406 Members | 2,220 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Replacement for StrPtr ?

Tim
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?
Nov 20 '05 #1
11 16776
Tim wrote:
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?


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
Nov 20 '05 #2
Tim,

Take a look at Marshal.PtrToStringAuto , Marshal.PtrToStringAnsi,
and Marshal.PtrToStringUni.
http://msdn.microsoft.com/library/de...mberstopic.asp

Ken
---------------------
"Tim" <ti*****@hotmail.com> wrote in message
news:eo*************@TK2MSFTNGP09.phx.gbl...
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?

Nov 20 '05 #3
Cor
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.
Please post the complete VB6 declaration of 'EbExecuteLine'. Why do you

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


Nov 20 '05 #4
Cor
Hi Tim,
I was writing this while you got your answers.
Happenly a lot faster and better than yesterday.
Cor
Nov 20 '05 #5
Hello,

"Cor" <no*@non.com> schrieb:
You can doubt if this is a subject for this newsgroup.
I think it is...
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 Tim posts the code he wants to convert.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #6
Hello,

"Tim" <ti*****@hotmail.com> schrieb:
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


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

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

http://groups.google.de/groups?selm=...TNGP12.phx.gbl

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #7
I have the same issue to resolve. Here is relevant code that requires modification:

lngResult = CoCreateGuid(udtGUID) ' Create a 'raw' GUID
If lngResult = GUID_OK Then
strFormattedGUID = 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?keyword="vbup1040"'
StringFromGUID2(udtGUID, StrPtr(strFormattedGUID), GUID_LENGTH + 1)
Else ' Either return nothing or find some way to handle the error
strFormattedGUID = Right(Space(GUID_LENGTH) & VB6.Format(Now, "yyyymmddhhnn") & VB6.Format(GetTickCount(), "000000000000"), GUID_LENGTH)
End If
CreateGUIDKey = Left(Trim(strFormattedGUID) & Space(GUID_LENGTH), GUID_LENGTH)

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

Posted via DevelopmentNow.com Groups
http://www.developmentnow.com
Mar 16 '07 #8
"Brenton Norman" <br************@medcom.com.auschrieb:
lngResult = CoCreateGuid(udtGUID) ' Create a 'raw' GUID
If lngResult = GUID_OK Then
strFormattedGUID = 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?keyword="vbup1040"'
StringFromGUID2(udtGUID, StrPtr(strFormattedGUID), GUID_LENGTH
+ 1)
How does the declaration of 'StringFromGUID2' look like?

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

Mar 16 '07 #9
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/>
Mar 16 '07 #10
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
http://www.developmentnow.com
Mar 19 '07 #11
I think this does the job:

Dim udtGUID As System.Guid
Dim strFormattedGUID As String

udtGUID = System.Guid.NewGuid()
...
strFormattedGUID = udtGUID.ToString

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

Posted via DevelopmentNow.com Groups
http://www.developmentnow.com
Mar 20 '07 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Paul Miller | last post by:
We've run into minidom's inabilty to handle large (20+MB) XML files, and need a replacement that can handle it. Unfortunately, we're pretty dependent on a DOM, so a pulldom or SAX replacement is...
53
by: Kerberos | last post by:
I followed Dan Cederholm's image replacement tutorial, to replace a header tag by a logo. The h1 is clickable if no CSS is applied but it I replace it by the logo, the area isn't clickable anymore...
3
by: Vibha Tripathi | last post by:
Hi Folks, I put a Regular Expression question on this list a couple days ago. I would like to rephrase my question as below: In the Python re.sub(regex, replacement, subject)...
2
by: brian | last post by:
Hi, before coming to .NET, I utilized regular expressions mostly in JScript / JavaScript and also in my favorite text editor: TextPad (www.textpad.com) I don't know about JScript/JavaScript, but...
20
by: Paul D. Boyle | last post by:
Hi all, There was a recent thread in this group which talked about the shortcomings of fgets(). I decided to try my hand at writing a replacement for fgets() using fgetc() and realloc() to read...
16
by: dev | last post by:
Hello, How can the following code be converted to VB.Net? I am mostly interested in how to handle the StrPtr calls in the function. Private Declare Function PathRelativePathToW Lib...
1
by: lawrence k | last post by:
Want to replace the limit clause in a query, but can't get it right. What's wrong with this: $pattern = "(.*)limit (.*)"; $replacement = '$1'; $replacement .= "LIMIT $limit"; $replacement .=...
3
by: =?Utf-8?B?RHVrZSAoQU4yNDcp?= | last post by:
I've added a web deployment project and want to use the config section replacement but I'm obviously not understanding something. I have set up an alternate appSettings file,...
2
by: Jake Glines | last post by:
I am trying to convert a method from VB6 to VB.NET and having some issues with StrPtr and VarPtr not being supported in VB.NET anymore. Here is the method having a problem. From what I know, I am...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.