Coder Social home page Coder Social logo

stefankueng / sendmessage Goto Github PK

View Code? Open in Web Editor NEW
131.0 7.0 28.0 596 KB

SendMessage is a little tool to send Windows messages to any window.

Home Page: https://tools.stefankueng.com/SendMessage.html

C++ 90.21% C 5.39% JavaScript 2.39% Batchfile 2.01%
debug windows helper messages sendmessage

sendmessage's Introduction

SendMessage

SendMessage is a little tool to send Windows messages to any window.

Build Status

Ever wondered how you should test whether your application correctly responds to certain system messages like WM_ENDSESSION or WM_POWERBROADCAST? Of course you can test your application by actually triggering those messages, but especially the WM_ENDSESSION message and its purpose makes it impossible to attach a debugger to your application once Windows sends you that message.

With this tool, you can send that message and any other message you like to your application window. And you can do that while you have a debugger attached to your application!

Please visit the homepage of SendMessage for more information.

sendmessage's People

Contributors

azure-pipelines[bot] avatar datadiode avatar huangqinjin avatar stefankueng avatar xhmikosr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

sendmessage's Issues

Crash when dragging target across text editor windows

The accessible name of a text editor window is its contents, which overflows the buffer in DisplayInfoOnFoundWindow. This can be easily fixed as shown in this extract, where lines containing szAccName are changed or new:

`bool CMainDlg::DisplayInfoOnFoundWindow(HWND hwndFoundWindow)
{
RECT rect; // Rectangle area of the found window.
TCHAR szText[512];
TCHAR szClassName[100];
TCHAR szAccName[100];

// Get the screen coordinates of the rectangle of the found window.
GetWindowRect(hwndFoundWindow, &rect);

// Get the class name of the found window.
GetClassName(hwndFoundWindow, szClassName, _countof(szClassName));

// Get its accessible name.
_tcsncpy_s(szAccName, _countof(szAccName), CAccessibleName(hwndFoundWindow).c_str(), _TRUNCATE);

// Display some information on the found window.
_stprintf_s
    (
    szText, _countof(szText), _T("Window Handle == 0x%p\r\nClass Name : %s\r\nAccessible Name : %s\r\nRECT == { Left: %d, Top: %d, Right: %d, Bottom: %d }\r\n"),
    hwndFoundWindow,
    szClassName,
    szAccName,
    rect.left,
    rect.top,
    rect.right,
    rect.bottom
    );

`

Use _set_invalid_parameter_handler so app doesn't crash when ie: buffer overflows

Hi, thanks for the tool, very useful.

Your tool crashed for me while trying to diagnose an application, caused by the accessible name (Scintilla is the underlying Hwnd, doing something strange) being longer than approx 512 chars (in DisplayInfoOnFoundWindow). By default, the invalid parameter handler for the safe CRT functions crash the application.

It would probably better to allow the app to continue running, with a truncated name. The handler can be changed by setting the _set_invalid_parameter_handler.

I can submit a pull request if you are ok with this.

Cant send keys to admin terminal?

I've been using this alongside task scheduler to write to cmd on a schedule (using a bat script). Had to run the process under the administrators group to use another command, which broke sendmessage as commands are no longer sent to the existing terminal. Is there any way to force sendmessage to an administrator terminal?

Example snippet from bat file:

SendMessage64.exe /windowtitle: "Test Window" /message:WM_CHAR /wparam:116 /1param:1

[Help] How to send CTRL+C (graceful shutdown) to a opened .jar on CMD

I can't figure out how to send a "CTRL+C" to the open java window to tell it to do a graceful shutdown (a batch running this .jar in a CMD with a specific window title).
The problem is that the only command I find, closes the window instant.
In theory the value "0x03" should see it as "CTRL+C" but I don't know where to write it.

Thanks in advance

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.