I'm new to C++ just started to learn and I'm trying to change the appearance of a running process for example "Calculator" to be always on bottom/on desktop but with no successes.
Here is the code I have so far:
#include "stdafx.h"
#include <windows.h>
#include <stdio.h>
#include <string>
#include <iostream>
using namespace std;
void set_to_bg() {
LPCSTR app_name = "Calculator";
HWND hWnd = FindWindowA(0, (app_name));
HWND ProgmanHwnd = FindWindow(_T("Progman"), _T("Program Manager"));
SetParent(hWnd, ProgmanHwnd);
SetWindowPos(hWnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
}
int main()
{
set_to_bg();
}
What Happens is that the "Calculator" window disappears. I'm using Spy++ to monitor windows and I'v noticed that the "Calculator" is parented to "Program Manager" but it doesn't shows it. if I omit the "SetParent(hWnd, ProgmanHwnd);"
the "Calculator" is shown and sets to bottom. When I open a folder or some other app they overlap the "Calculator" which is a good result but if I click the "Calculator" then it losses its "OnBottom" property and overlaps all the other folders or apps that opened.
Any ideas, code snippets, guidance would be very appreciated!
Aucun commentaire:
Enregistrer un commentaire