How to use System.IntPtr

Posted on 2006-04-11
Last Modified: 2012-05-05
Hi, can anyone demostrate the use of system.intptr..thanks
Question by:jaxrpc
    LVL 9

    Expert Comment

    LVL 1

    Expert Comment

    Exactly that you desire to do?  
    LVL 85

    Accepted Solution

    This will change the caption on your form via the forms handle and the SetWindowText() API:

        Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" _
            (ByVal hWnd As IntPtr, ByVal lpString As String) As Integer

        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim hWnd As IntPtr = Me.Handle
            SetWindowText(hWnd, "Hello World!")
        End Sub
    LVL 14

    Expert Comment

    It's just what a long was in the old VB API times, but now clearer that its a pointer.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
    I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now