Hi all,
In my previous topic about a week ago on this forum I attempted to use ReadProcessMemory. After several hours of trying different things, It worked. Next up I tried figuring out WriteProcessMemory. I was hoping that after hours of trying things, it would work. Unfortunately, I can't seem to get this one to work, and also my search on the internet resulted nothing useful.
I got this code, which in my eyes should work without any errors, but VB proves me wrong.
What it should do is pretty simple; press T, encode a message from a listbox from ASCII to Bytes, and write it, Then press Enter. -
Private Sub timerC_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles timerC.Tick
-
Const WM_KEYDOWN = &H100
-
Const WM_KEYUP = &H101
-
Const VK_T = &H54
-
Const VK_RETURN = &HD
-
Dim hwnd, hprocess, idprocess As Integer
-
Dim Automsg As String
-
Static msg As Integer
-
-
If msg = listC.Items.Count - 1 Then msg = -1
-
msg = msg + 1
-
-
hwnd = FindWindow(vbNullString, windowname.Text)
-
If hwnd < 0 Or hwnd > 0 Then
-
-
SendMessage(hwnd, WM_KEYDOWN, VK_T, 0&)
-
SendMessage(hwnd, WM_KEYUP, VK_T, 0&)
-
-
Wait(120)
-
-
GetWindowThreadProcessId(hwnd, idprocess)
-
hprocess = OpenProcess(PROCESS_ALL_ACCESS, False, idprocess)
-
Automsg = msg
-
-
System.Text.Encoding.ASCII.GetBytes(Automsg)
-
WriteProcessMemory(hprocess, &H875F34, Automsg, 59, 0&)
-
CloseHandle(hprocess)
-
-
Wait(120)
-
-
SendMessage(hwnd, WM_KEYDOWN, VK_RETURN, 0&)
-
SendMessage(hwnd, WM_KEYUP, VK_RETURN, 0&)
-
-
ElseIf hwnd = 0 Then
-
MsgBox("Cannot find " & windowname.Text), MsgBoxStyle.Critical, "Error!")
-
timerC.Enabled = False
-
Exit Sub
-
End If
-
-
End Sub
-
I just can't seem to figure out where the problem is, since it doesn't give any errors.
Though, it doesn't write to memory nor press Enter. It does press T but that's all there is.
Could anyone help fixing my code ?
Any help is appreciated.
Thanks in advance,
Evolution445
2 2099
Anyone has any idea on solving this ?
Thanks
I re-attempted the code again, this time thinking it only writes one character per WriteProcessMemory action. -
Dim AutomsgByte As Byte
-
Automsg = msg
-
For i As Integer = 0 To Automsg.Length
-
System.Text.Encoding.ASCII.GetBytes(Automsg)
-
Automsg = AutomsgByte
-
WriteProcessMemory(hprocess, &H471E58, AutomsgByte, 59, 0&)
-
Next i
-
Still no result.
If anyone knows how to fix my problem, please let me know.
Thanks!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Charles Law |
last post by:
I have defined LVITEM as follows:
<StructLayout(LayoutKind.Sequential)> Private Structure LVITEM
Dim mask As Int16
Dim iItem As Int16
Dim iSubItem As Int16
Dim state As Int16
Dim stateMask As...
|
by: STiAT |
last post by:
Hello.
I tried to find a similar Function to WriteMemory, and couldnt find any
memory manipulating functions in dotNET at all.
I now wanted to know if there are any similar functions to the...
|
by: Jerry Spence1 |
last post by:
1. Is there a more suitable, dedicated newsfeed for VB2005 yet?
2. I'm confused as to which version to get. I work for a small company and
we will just need VB2005 on my PC. Therefore that tends...
|
by: Rich |
last post by:
Hello,
I just upgraded a vb2003 app to vb2005. The vb2003 app had/has a statusbar
object - which contains panels and I can see the properties of the statusbar
in the properties window in...
|
by: r1100r98 |
last post by:
I am having a problem moving the data from a datatable to the SQL2005
table (using VB2005). See code below. The SQL2005 table is empty, the
datatable is being filled from a text file, not from...
|
by: erickwan88 |
last post by:
I am doing a final year project for my school and is going to provide for an organization, so I am asking for some help on here.
Indeed, I have no idea on how to get the input from my pen driver...
|
by: Aalaan |
last post by:
I am presently a user of classic vb6 and hang out on those newsgroups. Some
of you may be aware that there is a very anti MS and vb2005 feeling there. I
have tried to get them to tell me which...
|
by: Jeffrey Christiansen |
last post by:
I wanted to add a toggle button to a VB2005 form to be used for a
simple Windows Application (i.e. compiled to a "*.exe"), so I added
the ActiveX Microsoft Forms Object toggle button, however I...
|
by: Vae07 |
last post by:
Ok so here is a brief summary of my problem. I need a pop up form that submits input text box information to a pocket excel workbook upon a command botton click. Text box inputs are checked for...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |