|
Hi All
I want to send a Keystroke to the window of other application.
I have got the Handle of that window.
Is there any API or Managed C# code which will directly send the Keystroke only to that window.
setting the window to foreground and then sending the keystroke is working fine.But in the meantime if the user click on other window that window becomes active and the keystrokes are send to that window not to that window for which it was meant.
I have also studied about SendMessage Api
SendMessage Function
Sends the specified message to a window or windows. The SendMessage function calls the window procedure for the specified window and does not return until the window procedure has processed the message.
To send a message and return immediately, use the SendMessageCallback or SendNotifyMessage function. To post a message to a thread's message queue and return immediately, use the PostMessage or PostThreadMessage function.
Syntax
LRESULT SendMessage(
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);
But i do not know how to put Keystrokes input into msg variable
Does anybody know how to send only to particular window?
Thanks in advance
THE SK
(Sandeep Kalra)
I am the One
|
|
|
|
|
hWnd is the handle of the window that you want to receive the message. This is explained in the MSDN sendmessage [^] docs.
The message you want to send is probably WM_KEYDOWN and then WM_KEYUP. (You can find a full list of the messages and their numbers here[^])
Look here[^] for an explanation of the WM_KEYDOWN message, and what to put in the wParam and lParam parameters. You can use google to find a similar doc page for the WM_KEYUP message.
Simon
|
|
|
|
|
i have developed an app that have 1 array of int type with 3 elements, assign their values on Load event. Assign a timer that keep write their values in a textbox. Next, i run that app and got the first element offset in kernel32.dll by using a software. Now i want to write new values to that array from another application by using that offset i got. for example
int[] Xarray = new int[3];
private void Form1_Load(object sender, EventArgs e)
{
Xarray[0] = 61457899;
Xarray[1] = 44527899;
Xarray[2] = 832429;
}
i got address of first element(of Xarray) that is 0x1D52EF4 then the next element value i can find it on 0x1D52EF8 and third one on 0x1D52EFC
so if i write from another application like this
APIDecalaration.WriteProcessMemory(hProcess, (IntPtr)(0x1D52EF4), ref Newvalue, 4, 0);
APIDecalaration.WriteProcessMemory(hProcess, (IntPtr)(0x1D52EF8), ref Newvalue1, 4, 0);
APIDecalaration.WriteProcessMemory(hProcess, (IntPtr)(0x1D52EFC), ref Newvalue2, 4, 0);
[DllImport("kernel32")]
public static extern int WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, ref int lpBuffer, long nSize, long lpNumberOfBytesWritten);
then it will write Newvalue successfully, but i cant do because here are only 3 elements what if i have 100. Therefore, i made a struct that have 3 int variables but when i try to write it nothing happens. Here is code
APIDecalaration.WriteProcessMemory(hProcess, (IntPtr)(0x1D52EF4), Xstruct_instance, 12, 0);
[DllImport("kernel32")]
public static extern Xstruct WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, Xstruct lpBuffer, ref long nSize, long lpNumberOfBytesWritten);
[StructLayout(LayoutKind.Sequential)]
public struct Xstruct
{
public int Newvalue;
public int Newvalue1;
public int Newvalue2;
}
anyidea guys to solve this ?
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
A struct is a value type, so it will be allocated as a part of the application object instead of as a sepearate object on the heap, so it will have a completely different memory address.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
can you explain in little more detail ?
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
When you create an array it is created as a spearete object on the heap outside the Application object. When you create a struct as a member of the Application object, it will be allocated on the heap as part of the Application object. Naturally the address of those variables will be different.
Also, you can't rely on the address of anything that is allocated on the heap being the same every time you run the program. Subtle differences like user culture settings can easily change the number of objects allocated at startup.
Besides, the garbage collector can move any object on the heap at any time (unless the object is fixed).
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
oh...but that was just an example, my original work is on a game where it has a fixed offset. I dunno what developers used, an array or struct but i know its all format (float then an interger then something). It was very time consuming to check effect in game so i made my own app and checked in it. Now any idea ?
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Hi, I have created one windows service.
Now i want to run any GUI made in C# as Schedule time.
Plz give me any idea?
Thanx in Advance......
|
|
|
|
|
Hi,
You can simply schedule the service through Scheduled Tasks in windows. Go to control panel --> Scheduled Task and add a new task for your service. You can install your service as well and it will run in the background and performs your task according to your requirements.
Regards,
|
|
|
|
|
Thanks for response...Can we do this Programmaticly.
|
|
|
|
|
|
Thanks.... it's very helpful....
|
|
|
|
|
Glad to help you
|
|
|
|
|
how to make "yahoo answers" website like paging list control(horizontal list with page nos in boxes style) in C# windows application..
In this type of control i wanna generate list of page nos dynamically..with proper style like hover.
example can also be seen in windows live search results at microsoft website. pl suggest solution for this..
|
|
|
|
|
The idea of CP is YOU write code and other people help with specific problems. Try css and c# code.
You should also try posting to the correct forum, this is an ASP.NET question.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
hi everyone!
I am trying to create a client-server application that would communicate
using xml in a http format.
I already researched about client-server transferring file using TCP/IP.
It uses tcplient/tcplistener which worked very fine. However I was trying to
build an application that could use an http format of request to do the transferring of file.
I also had downloaded some codes for an implementation of an http server
but the http client needs to be a web browser, is there a way that I could just have a FORM as a client and pass those http request?
Is there any suggestion that you can give?
Thank you very much in advance.
I hope you could help.
|
|
|
|
|
I already found the answer to my question.
I should use httplistener(server) and httprequest/httpresponse(client)
however the httplistener have some issues on access.
it shows an access is denied exception.
the solution for this are:
XP = httpcfg.exe
Server 2003 = httpcfg.exe
(don't know if it really works)
Vista = netsh.exe
(this is the one that I have tried but it is somehow successful because
i can have it running in Vista Home Basic but not in Vista Business)
until now I still can't figure it out.
I hope someone could help.
Thank in advance.
|
|
|
|
|
netsh.exe was not the solution for my problem.
I just need to run my Visual Studio as Administrator.
(right click then select "Run as Administrator")
Hope it can help for the developers in vista
|
|
|
|
|
Hello Everyone,
Can anyone say to find out the URL in web page?
truely,
|
|
|
|
|
assuming you have the web page in some sort of buffer, why not use a regular expression and 'grep' type search on it ..
in c++ (following a boost regex example) you'd look for :-
boost::regex e("<\\s*A\\s+[^>]*href\\s*=\\s*\"([^\"]*)\"",
boost::regex::normal | boost::regbase::icase);
I know c# has a regular expression function, so try that ..
'g'
|
|
|
|
|
Find What?
While (true) { Human.isLearnable = true; }
|
|
|
|
|
i have created a DataTable that have a column of type Keys enum, now im trying to select the DataRows by that column but i'm stuck here. Its giving error.
KeyTable.Columns.Add("FirstKey", typeof(Keys));
DataRow[] tmp_dr = KeyTable.Select("FirstKey=" + Keys.LShiftKey);
DataRow[] tmp_dr = KeyTable.Select("FirstKey='" + Keys.LShiftKey +"'");
anyidea guys ? or i should use string type col instead of Keys ?
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
The underlying type of your enum is Int32, so that's what the column contains.
Either use it that way or use string for the column with:
Keys.LShiftKey.ToString()
|
|
|
|
|
i dont understand it because when i set that datatable to datagridview as datasource it show me string(no numeric value, eg. A B C)
ok nevermind i will use string type column thats looks working...
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Is there any way to change the background colour of individual items in a listBox through code? I know you can do it with the listView control, but I have already built most of the functionality for the listBox, and don't really want to have to redo it.
|
|
|
|