Home > Software engineering >  After the sendmessage send no effect
After the sendmessage send no effect

Time:09-24

Do you want to be an automatic login program
But stuck
Turn to

Call in ollydbg
And when I write your own
Parameters are the same but can't achieve the same effect

Excuse me what reason be?
Penguin a game

CodePudding user response:

Look from the figure, is your notification message BN_CLICKED

That that's the button ID 1001 parameters should be low, high is BN_CLICKED value (0)

The last parameter is the handle on the button

See: https://msdn.microsoft.com/en-us/library/windows/desktop/bb761825 (v=versus 85). Aspx

Of course, do not rule out he software using some other means to prevent

CodePudding user response:

Using asynchronous PostMessage

CodePudding user response:

CodePudding user response:

Message to BN_CLICKED LPARAM/RPARAM try to 0

CodePudding user response:

 
BOOL SimClick (LPCWSTR wsWindName, UINT uBtnID)
{
BOOL bRet=FALSE;
HWND hParent=FindWindowW (NULL, wsWindName);
HWND hChild=GetDlgItem (hParent uBtnID);
If (hParent & amp; & HChild)
{
BRet=SendMessageW (hParent WM_COMMAND,
MAKEWPARAM (uBtnID BN_CLICKED), (LPARAM) hChild);
}

Return bRet.
}

Void CDlg7Dlg: : OnButton1 ()
{
//TODO: Add your the control notification handler code here
SimClick (L "calculator", 0 x83);//calculator number 7
}

CodePudding user response:

May be your FindWindow find window

1. Returns NULL
2 returned by the window is not your target window handle
3. You return to the window of the window procedure has not addressed the WM_COMMAND message with ID 1001

CodePudding user response:

Across processes, can not pass the address!

CodePudding user response:

More than 6.0 must be administrator privileges to perform, otherwise you will be filtered,

CodePudding user response:

Across processes of SendMessage cannot take a pointer parameter (different process pointer cannot access) such as
 
Void CRemoteListCtrlDlg: : RemoteHeaderItem (HWND HWND)
{
//GetItemCount
Int nHeaderCount=: : SendMessage (hWnd HDM_GETITEMCOUNT, 0, 0);//not to bring a pointer parameter
//Get hProcess
DWORD pid;
GetWindowThreadProcessId (hWnd, & amp; Pid);
HANDLE hProcess=OpenProcess (PROCESS_ALL_ACCESS, FALSE, pid);
//
HDITEM * pHeaderItem=(HDITEM *) VirtualAllocEx (hProcess, NULL, sizeof (HDITEM), MEM_COMMIT, PAGE_READWRITE);
Char * pItem=(char *) VirtualAllocEx (hProcess, NULL, 80, MEM_COMMIT, PAGE_READWRITE);
If ((! PHeaderItem) | | (! PItem))
{
: : MessageBox (NULL, "unable to allocate memory!" , "wrong!" , NULL);
The CloseHandle (hProcess);
return;
}
//
HDITEM HeaderItem;
HeaderItem. CchTextMax=80;
HeaderItem. Mask=HDI_TEXT;
HeaderItem. PszText=pItem;
//
Char ItemBuf [80].
for(int i=0; I{
HeaderItem. IOrder=I;
WriteProcessMemory (hProcess, pHeaderItem, & amp; HeaderItem, sizeof (HDITEM), NULL);
: : SendMessage (hWnd HDM_GETITEM, I, (LPARAM) pHeaderItem);//to the process with the pointer!
ReadProcessMemory (hProcess, pItem ItemBuf, 80, NULL);
//afxDump & lt; }
//release the memory
The CloseHandle (hProcess);
VirtualFreeEx (hProcess, pHeaderItem, 0, MEM_RELEASE);
VirtualFreeEx (hProcess, pItem, 0, MEM_RELEASE);
}
  • Related