Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3305592
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:11:15+00:00 2026-05-17T21:11:15+00:00

Is it possible to do some operations with a window from other process having

  • 0

Is it possible to do some operations with a window from other process having it’s handle? What I would like to do is:
-remove window decoration
-move window to any position of the screen
-let window stay on top without making it modal

A link to a command line tool, script or C/C++ code snippet be great.

Thank you very much!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T21:11:16+00:00Added an answer on May 17, 2026 at 9:11 pm

    I decided to take another shot, so I experimented with your code and added what was missing: a -naked option.

    The key to remove the decoration came from here. Though it works, you will eventually find out that the application who got naked might start displaying a few bugs after it.

    Enjoy:

    #include "windows.h"
    #include <iostream>
    #include <string>
    #include <sstream>
    #include <algorithm>
    #include <limits>
    
    using namespace std;
    
    #ifdef min
        #undef min
    #endif
    
    
    int main(int argc, char* argv[])
    {
      char** param = argv;
    
      unsigned int x = numeric_limits<int>::min(), y=numeric_limits<int>::min(), w=numeric_limits<int>::min(), h=numeric_limits<int>::min();
      HWND z = HWND_NOTOPMOST;
      unsigned int flags = (SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER);
      ++param;
    
      wstring winTitle;
      bool close = false;
      bool naked = false;
      while (*param)
      {
        string sparam(*param);
        if (sparam == "-title")
        {
          ++param; 
          if (!*param) break;
    
          sparam = *param;
          winTitle.resize(sparam.size());
          copy(sparam.begin(), sparam.end(), winTitle.begin());
        }
        else if (sparam == "-move")
        {
          ++param; 
          if (!*param) break;
    
          sparam =*param;
          stringstream sstr(sparam);
          char sep;
          sstr >> x >>sep >> y;
          if (x != numeric_limits<int>::min() && y != numeric_limits<int>::min())
          {
            flags &= ~SWP_NOMOVE;
          }
        }
        else if (sparam == "-resize")
        {
          ++param; 
          if (!*param) break;
    
          sparam = *param;
          stringstream sstr(sparam);
          char sep;
          sstr >> w >>sep >> h;
          if (h != numeric_limits<int>::min() && w != numeric_limits<int>::min() )
          {
            flags &= ~SWP_NOSIZE;
          }
        }
        else if (sparam == "-top")
        {
          z = HWND_TOP;
          flags &= ~SWP_NOZORDER;
        }
        else if (sparam == "-staytop")
        {
          z = HWND_TOPMOST;
          flags &= ~SWP_NOZORDER;
        }
        else if (sparam == "-bottom")
        {
          z = HWND_BOTTOM;
          flags &= ~SWP_NOZORDER;
        }
        else if (sparam == "-hide")
        {
          flags |= SWP_HIDEWINDOW;
        }
        else if (sparam == "-close")
        {
          close = true;
        }
        else if (sparam == "-naked")
        {
          naked = true;
        }
    
        ++param;      
      }
    
      if (winTitle.empty())
      {
        return -1;
      }
    
      HWND win_handle = FindWindow(0, winTitle.c_str());    
      if (win_handle != 0)
      {
         if (close)
         {
             TerminateProcess( (HANDLE )GetProcessId( win_handle ), 0);
             return 0;
         }
    
         SetWindowPos( win_handle, z, x, y, w, h, flags );
    
         if (naked)
         {
             SetWindowLong(win_handle, GWL_STYLE, GetWindowLong(win_handle, GWL_EXSTYLE) | WS_EX_TOPMOST);
             ShowWindow(win_handle, SW_SHOW);
         }
      }
      else
      {
          cout << "!!! FindWindow failed" << endl;
      }
    
      return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I'm inside a destructor is it possible that some other thread will start
Question So I've recently came up with some new possible projects that would have
I'm looking into some possible options for unit testing C++ classes. So, short and
Back in the old days, Help was not trivial but possible: generate some funky
Is it possible to set some image as title of Navigation bar? I think
Is it possible to merge some cells of a JTable object? (source: codeguru.com )
I know it's possible to change some columns in GridView controls to check boxes
In .NET framework, is it possible to set some of the items in the
In Visual c# Express Edition, is it possible to make some (but not all)
Possible Duplicate: String vs StringBuilder I just revisited some of the books that I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.