Results 1 to 11 of 11

Thread: Transfering Data to Notepad (Revisted) [UnResolved Now]

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2004
    Posts
    34

    Unhappy Transfering Data to Notepad (Revisted) [UnResolved Now]

    This is a new topic to revist the old problem titled: "To notepad..."
    located HERE

    Sorry to bring up a really old topic, but is there a way to send the text to an embeded notepad window via a dialogue box? I mean, if the user entered text into text fields, and that data was then sent to the embeded notepad window. Then, you have another dialogue box, and then be able to send more information to the same embeded notepad window? Like, this is my code for the embeded notepad part:


    VB Code:
    1. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As Long, ByVal lpWindowName As Long) As Long
    2. Private Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long
    3. Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
    4. Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
    5. Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
    6. Private Declare Function LockWindowUpdate Lib "user32" (ByVal hwndLock As Long) As Long
    7. Private Declare Function GetDesktopWindow Lib "user32" () As Long
    8. Private Declare Function DestroyWindow Lib "user32" (ByVal hwnd As Long) As Long
    9. Private Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long
    10. Private Declare Function GetCurrentProcess Lib "kernel32" () As Long
    11. Private Declare Function Putfocus Lib "user32" Alias "SetFocus" (ByVal hwnd As Long) As Long
    12. Const GW_HWNDNEXT = 2
    13. Dim mWnd As Long
    14.  
    15. Function InstanceToWnd(ByVal target_pid As Long) As Long
    16.     Dim test_hwnd As Long, test_pid As Long, test_thread_id As Long
    17.     'Find the first window
    18.     test_hwnd = FindWindow(ByVal 0&, ByVal 0&)
    19.     Do While test_hwnd <> 0
    20.         'Check if the window isn't a child
    21.         If GetParent(test_hwnd) = 0 Then
    22.             'Get the window's thread
    23.             test_thread_id = GetWindowThreadProcessId(test_hwnd, test_pid)
    24.             If test_pid = target_pid Then
    25.                 InstanceToWnd = test_hwnd
    26.                 Exit Do
    27.             End If
    28.         End If
    29.         'retrieve the next window
    30.         test_hwnd = GetWindow(test_hwnd, GW_HWNDNEXT)
    31.     Loop
    32. End Function
    33.  
    34. Private Sub Form_Load()
    35.     Call MyShell
    36.     frmTip.Show
    37. End Sub
    38.  
    39. Private Sub MyShell()
    40.     'KPD-Team 1999
    41.     'URL: [url]http://www.allapi.net/[/url]
    42.     'E-Mail: [email][email protected][/email]
    43.     Dim Pid As Long
    44.     'Lock the window update
    45.     LockWindowUpdate GetDesktopWindow
    46.     'Execute notepad.Exe
    47.     Pid = Shell("c:\windows\notepad.exe", vbNormalFocus)
    48.     If Pid = 0 Then MsgBox "Error starting the app"
    49.     'retrieve the handle of the window
    50.     mWnd = InstanceToWnd(Pid)
    51.     'Set the notepad's parent
    52.     SetParent mWnd, Me.hwnd
    53.     'Put the focus on notepad
    54.     Putfocus mWnd
    55.     'Unlock windowupdate
    56.     LockWindowUpdate False
    57. End Sub

    Thank you!
    Last edited by The Dude45; Dec 30th, 2004 at 08:00 PM.

  2. #2

    Thread Starter
    Member
    Join Date
    Dec 2004
    Posts
    34

    Re: Transfering Data to Notepad (Revisted)

    Is this done with GetWindow or FindWindow? If so, does anyone know what the name of the embedded notepad window (deciphering the above code)?

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Transfering Data to Notepad (Revisted)

    Try this code in a new project.
    VB Code:
    1. Option Explicit
    2. 'Create a menu item File with a submenu item Insert (mnuFileInsert)
    3. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As Long, ByVal lpWindowName As Long) As Long
    4. Private Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long
    5. Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
    6. Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
    7. Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
    8. Private Declare Function LockWindowUpdate Lib "user32" (ByVal hwndLock As Long) As Long
    9. Private Declare Function GetDesktopWindow Lib "user32" () As Long
    10. Private Declare Function DestroyWindow Lib "user32" (ByVal hwnd As Long) As Long
    11. Private Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long
    12. Private Declare Function GetCurrentProcess Lib "kernel32" () As Long
    13. Private Declare Function Putfocus Lib "user32" Alias "SetFocus" (ByVal hwnd As Long) As Long
    14. Const GW_HWNDNEXT = 2
    15. Dim mWnd As Long
    16. Private Declare Function ShowWindow Lib "user32.dll" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
    17. Private Const SW_SHOWMAXIMIZED As Long = 3
    18. Private Declare Function FindWindowEx Lib "user32.dll" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
    19. Private Declare Function SendMessageAny Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, _
    20. ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    21. Private Const WM_SETTEXT As Long = &HC
    22.  
    23. Function InstanceToWnd(ByVal target_pid As Long) As Long
    24.     Dim test_hwnd As Long, test_pid As Long, test_thread_id As Long
    25.     'Find the first window
    26.     test_hwnd = FindWindow(ByVal 0&, ByVal 0&)
    27.     Do While test_hwnd <> 0
    28.         'Check if the window isn't a child
    29.         If GetParent(test_hwnd) = 0 Then
    30.             'Get the window's thread
    31.             test_thread_id = GetWindowThreadProcessId(test_hwnd, test_pid)
    32.             If test_pid = target_pid Then
    33.                 InstanceToWnd = test_hwnd
    34.                 Exit Do
    35.             End If
    36.         End If
    37.         'retrieve the next window
    38.         test_hwnd = GetWindow(test_hwnd, GW_HWNDNEXT)
    39.     Loop
    40. End Function
    41. Private Sub Form_Load()
    42.     'KPD-Team 1999
    43.     'URL: [url]http://www.allapi.net/[/url]
    44.     'E-Mail: [email][email protected][/email]
    45.     Dim Pid As Long
    46.     'Lock the window update
    47.     LockWindowUpdate GetDesktopWindow
    48.     'Execute notepad.Exe
    49.     Pid = Shell("c:\windows\notepad.exe", vbNormalFocus)
    50.     If Pid = 0 Then MsgBox "Error starting the app"
    51.     'retrieve the handle of the window
    52.     mWnd = InstanceToWnd(Pid)
    53.     'Set the notepad's parent
    54.     SetParent mWnd, Me.hwnd
    55.     'Put the focus on notepad
    56.     Putfocus mWnd
    57.     ShowWindow mWnd, SW_SHOWMAXIMIZED
    58.     'Unlock windowupdate
    59.     LockWindowUpdate False
    60. End Sub
    61. Private Sub Form_Unload(Cancel As Integer)
    62.     'Unload notepad
    63.     DestroyWindow mWnd
    64.     'End this program
    65.     'TerminateProcess GetCurrentProcess, 0
    66. End Sub
    67.  
    68. Private Sub mnuFileInsert_Click()
    69.     Dim lHwndC As Long
    70.     Dim sString As String
    71.     sString = InputBox("Enter text to send to Notepad", "Entere Text", vbNullString)
    72.     lHwndC = FindWindowEx(mWnd, 0&, "EDIT", vbNullString)
    73.     If lHwndC <> 0 Then
    74.         SendMessageAny lHwndC, WM_SETTEXT, 0&, ByVal sString
    75.     Else
    76.         MsgBox "Error - Notepad not found!"
    77.     End If
    78. End Sub
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  4. #4

    Thread Starter
    Member
    Join Date
    Dec 2004
    Posts
    34

    Re: Transfering Data to Notepad (Revisted)

    Hey that works pretty well! The only thing is, how do I get it to continue transferring text segment after text segment into the embedded window (in other words, so it doesn't replace the text before). Thanks so much though - I am finally getting somewhere!

  5. #5
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Transfering Data to Notepad (Revisted)

    No prob. I knew that was going to come up. I need to make a minor change
    to send using a different SendMessageAny parameter other than the
    WM_SETTEXT. That constant 'replaces' the textbox with the
    contents being sent.

    Be back in a few with it.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Transfering Data to Notepad (Revisted)

    Ok, got it. You need to use PostMessage to send messages to append to the textbox of notepad.
    The only issue it that you need to send them one character at a time. So we
    loop through the entered string. It will place the entered text where ever you
    have the cursor placed.

    VB Code:
    1. Option Explicit
    2. 'Create a menu item File with a submenu item Insert (mnuFileInsert)
    3. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As Long, ByVal lpWindowName As Long) As Long
    4. Private Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long
    5. Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
    6. Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
    7. Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
    8. Private Declare Function LockWindowUpdate Lib "user32" (ByVal hwndLock As Long) As Long
    9. Private Declare Function GetDesktopWindow Lib "user32" () As Long
    10. Private Declare Function DestroyWindow Lib "user32" (ByVal hwnd As Long) As Long
    11. Private Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long
    12. Private Declare Function GetCurrentProcess Lib "kernel32" () As Long
    13. Private Declare Function Putfocus Lib "user32" Alias "SetFocus" (ByVal hwnd As Long) As Long
    14. Const GW_HWNDNEXT = 2
    15. Dim mWnd As Long
    16. Private Declare Function ShowWindow Lib "user32.dll" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
    17. Private Const SW_SHOWMAXIMIZED As Long = 3
    18. Private Declare Function FindWindowEx Lib "user32.dll" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
    19. Private Declare Function SendMessageAny Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, _
    20. ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    21. Private Const WM_SETTEXT As Long = &HC
    22. Private Declare Function PostMessage Lib "user32.dll" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
    23. Private Const WM_CHAR As Long = &H102
    24.  
    25. Function InstanceToWnd(ByVal target_pid As Long) As Long
    26.     Dim test_hwnd As Long, test_pid As Long, test_thread_id As Long
    27.     'Find the first window
    28.     test_hwnd = FindWindow(ByVal 0&, ByVal 0&)
    29.     Do While test_hwnd <> 0
    30.         'Check if the window isn't a child
    31.         If GetParent(test_hwnd) = 0 Then
    32.             'Get the window's thread
    33.             test_thread_id = GetWindowThreadProcessId(test_hwnd, test_pid)
    34.             If test_pid = target_pid Then
    35.                 InstanceToWnd = test_hwnd
    36.                 Exit Do
    37.             End If
    38.         End If
    39.         'retrieve the next window
    40.         test_hwnd = GetWindow(test_hwnd, GW_HWNDNEXT)
    41.     Loop
    42. End Function
    43. Private Sub Form_Load()
    44.     'KPD-Team 1999
    45.     'URL: [url]http://www.allapi.net/[/url]
    46.     'E-Mail: [email][email protected][/email]
    47.     Dim Pid As Long
    48.     'Lock the window update
    49.     LockWindowUpdate GetDesktopWindow
    50.     'Execute notepad.Exe
    51.     Pid = Shell("c:\windows\notepad.exe", vbNormalFocus)
    52.     If Pid = 0 Then MsgBox "Error starting the app"
    53.     'retrieve the handle of the window
    54.     mWnd = InstanceToWnd(Pid)
    55.     'Set the notepad's parent
    56.     SetParent mWnd, Me.hwnd
    57.     'Put the focus on notepad
    58.     Putfocus mWnd
    59.     ShowWindow mWnd, SW_SHOWMAXIMIZED
    60.     'Unlock windowupdate
    61.     LockWindowUpdate False
    62. End Sub
    63. Private Sub Form_Unload(Cancel As Integer)
    64.     'Unload notepad
    65.     DestroyWindow mWnd
    66.     'End this program
    67.     'TerminateProcess GetCurrentProcess, 0
    68. End Sub
    69.  
    70. Private Sub mnuFileInsert_Click()
    71.     Dim lHwndC As Long
    72.     Dim sString As String
    73.     Dim i As Integer
    74.     sString = InputBox("Enter text to send to Notepad", "Enter Text", vbNullString)
    75.     lHwndC = FindWindowEx(mWnd, 0&, "EDIT", vbNullString)
    76.     'sString = Mid$(sString, 1, 1)
    77.     If lHwndC <> 0 Then
    78.         For i = 1 To Len(sString)
    79.             PostMessage lHwndC, WM_CHAR, ByVal Asc(Mid$(sString, i, 1)), 0&
    80.         Next
    81.     Else
    82.         MsgBox "Error - Notepad not found!"
    83.     End If
    84. End Sub
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  7. #7

    Thread Starter
    Member
    Join Date
    Dec 2004
    Posts
    34

    Re: Transfering Data to Notepad (Revisted)

    Wow that is so totally awesome! Thank you so much! There is one last thing ====> I am experimenting with the SendKeys command:

    VB Code:
    1. SendKeys "{ENTER}", 4

    Now, every time I insert this in certain places of the following code, it simply turns the app into an infinite loop of dialogue boxes. What I need it to do is have the "enter" key be pressed in "Notepad" immediately after the information from the dialogue box is sent. The problem is that I continually get a dialogue to post a message in notepad. Thanks again!

  8. #8
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Transfering Data to Notepad (Revisted)

    Thanks.

    As for SendKeys ewee! I have always avoided SendKeys at all costs because
    it so unreliable and the receiving window need to be active.

    Here is the way to PostMessage with an Enter key.

    VB Code:
    1. Option Explicit
    2. 'Create a menu item File with a submenu item Insert (mnuFileInsert)
    3. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As Long, ByVal lpWindowName As Long) As Long
    4. Private Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long
    5. Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
    6. Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
    7. Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
    8. Private Declare Function LockWindowUpdate Lib "user32" (ByVal hwndLock As Long) As Long
    9. Private Declare Function GetDesktopWindow Lib "user32" () As Long
    10. Private Declare Function DestroyWindow Lib "user32" (ByVal hwnd As Long) As Long
    11. Private Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long
    12. Private Declare Function GetCurrentProcess Lib "kernel32" () As Long
    13. Private Declare Function Putfocus Lib "user32" Alias "SetFocus" (ByVal hwnd As Long) As Long
    14. Const GW_HWNDNEXT = 2
    15. Dim mWnd As Long
    16. Private Declare Function ShowWindow Lib "user32.dll" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
    17. Private Const SW_SHOWMAXIMIZED As Long = 3
    18. Private Declare Function FindWindowEx Lib "user32.dll" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
    19. Private Declare Function SendMessageAny Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, _
    20. ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    21. Private Const WM_SETTEXT As Long = &HC
    22. Private Declare Function PostMessage Lib "user32.dll" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
    23. Private Const WM_CHAR As Long = &H102
    24. Private Const VK_RETURN = &HD
    25. Private Const WM_KEYDOWN As Long = &H100
    26. Private Const WM_KEYUP As Long = &H101
    27.  
    28. Function InstanceToWnd(ByVal target_pid As Long) As Long
    29.     Dim test_hwnd As Long, test_pid As Long, test_thread_id As Long
    30.     'Find the first window
    31.     test_hwnd = FindWindow(ByVal 0&, ByVal 0&)
    32.     Do While test_hwnd <> 0
    33.         'Check if the window isn't a child
    34.         If GetParent(test_hwnd) = 0 Then
    35.             'Get the window's thread
    36.             test_thread_id = GetWindowThreadProcessId(test_hwnd, test_pid)
    37.             If test_pid = target_pid Then
    38.                 InstanceToWnd = test_hwnd
    39.                 Exit Do
    40.             End If
    41.         End If
    42.         'retrieve the next window
    43.         test_hwnd = GetWindow(test_hwnd, GW_HWNDNEXT)
    44.     Loop
    45. End Function
    46. Private Sub Form_Load()
    47.     'KPD-Team 1999
    48.     'URL: [url]http://www.allapi.net/[/url]
    49.     'E-Mail: [email][email protected][/email]
    50.     Dim Pid As Long
    51.     'Lock the window update
    52.     LockWindowUpdate GetDesktopWindow
    53.     'Execute notepad.Exe
    54.     Pid = Shell("c:\windows\notepad.exe", vbNormalFocus)
    55.     If Pid = 0 Then MsgBox "Error starting the app"
    56.     'retrieve the handle of the window
    57.     mWnd = InstanceToWnd(Pid)
    58.     'Set the notepad's parent
    59.     SetParent mWnd, Me.hwnd
    60.     'Put the focus on notepad
    61.     Putfocus mWnd
    62.     ShowWindow mWnd, SW_SHOWMAXIMIZED
    63.     'Unlock windowupdate
    64.     LockWindowUpdate False
    65. End Sub
    66. Private Sub Form_Unload(Cancel As Integer)
    67.     'Unload notepad
    68.     DestroyWindow mWnd
    69.     'End this program
    70.     'TerminateProcess GetCurrentProcess, 0
    71. End Sub
    72.  
    73. Private Sub mnuFileInsert_Click()
    74.     Dim lHwndC As Long
    75.     Dim sString As String
    76.     Dim i As Integer
    77.     sString = InputBox("Enter text to send to Notepad", "Enter Text", vbNullString)
    78.     lHwndC = FindWindowEx(mWnd, 0&, "EDIT", vbNullString)
    79.     'sString = Mid$(sString, 1, 1)
    80.     If lHwndC <> 0 Then
    81.         For i = 1 To Len(sString)
    82.             PostMessage lHwndC, WM_CHAR, ByVal Asc(Mid$(sString, i, 1)), 0&
    83.         Next
    84.         PostMessage lHwndC, WM_KEYDOWN, VK_RETURN, 0&
    85.     Else
    86.         MsgBox "Error - Notepad not found!"
    87.     End If
    88. End Sub
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  9. #9

    Thread Starter
    Member
    Join Date
    Dec 2004
    Posts
    34

    Re: Transfering Data to Notepad (Revisted)

    Nothing but the best can be expected from a professional like yourself ====> Thank you!

  10. #10
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Transfering Data to Notepad (Revisted) [Solved For Now]

    Thanks. Its always nice to be appreciated.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  11. #11
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Transfering Data to Notepad (Revisted) [UnResolved Now]

    I'm not too sure what you mean, but if yo are using multiple instances of
    Notepad, you can get the correct one you want by passing the window
    caption of that instance in this line of code.

    VB Code:
    1. lHwndC = FindWindowEx(mWnd, 0&, "EDIT", vbNullString) 'Change to ...
    2. lHwndC = FindWindowEx(mWnd, 0&, "EDIT", "Untitled2 - Notepad") 'For ex.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width