G
G-Oker
Guest
Hello,
I am trying to create an application that overlays another program showing directions/instructions for the window behind it, and the next instruction to be shown when the correct button is clicked.
I was following
View: https://www.youtube.com/watch?v=t1ErGj0YnaM
and have created the following code to sit over Notepad:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace seeThru1_1
{
public partial class Form1 : Form
{
RECT rect; //NOT A CLASS (is a Struct), so no need to initialize a new one
public const string window_name = "Untitled - Notepad"; //Look for the window name
IntPtr handle = FindWindow(null, window_name);
public struct RECT //RECTangle object to use with DLL GetWindowRect import
{
public int left, top, right, bottom;
}
//"borrow" functionality to "click though" from C++ libraries
[DllImport("user32.dll", EntryPoint = "SetWindowLong")] //set transparent window size
static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
[DllImport("user32.dll", EntryPoint = "GetWindowLong")] //set transparent window size
static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll", SetLastError = true)]
static extern bool GetWindowRect(IntPtr hwnd, out RECT lpRect);
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.BackColor = Color.Wheat; //Set forms background to unused color
this.TransparencyKey = Color.Wheat; //Set transparency to background color
this.TopMost = true;
int initialstyle = GetWindowLong(this.Handle, -20); //Use c++ libraries to allow click though
SetWindowLong(this.Handle, -20, initialstyle | 0x80000 | 0x20);
GetWindowRect(handle, out rect); //Call function, pass handle, and output RECT)
this.Size = new Size(rect.right - rect.left, rect.bottom - rect.top); //setting size of window_name;
this.Top = rect.top;
this.Left = rect.left;
}
}
}
But what I would like to do now is to add arrows (with notation) to walk the user through procedures ( IE: click File, then Save, then enter a file name and click ok) and each time the user <g class=<g class="gr_ gr_14 gr-alert gr_gramm gr_inline_cards gr_run_anim Style replaceWithoutSep" data-gr-id="14" id="14">"gr</g>_ gr_13 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar multiReplace" data-gr-id="13" id="13">have</g> click these options in Notepad, to then change to the next instruction on the overlay window.
Could someone advise, point me to tutorials etc that would show me how I could do this?
Many Thanks
Continue reading...
I am trying to create an application that overlays another program showing directions/instructions for the window behind it, and the next instruction to be shown when the correct button is clicked.
I was following
and have created the following code to sit over Notepad:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace seeThru1_1
{
public partial class Form1 : Form
{
RECT rect; //NOT A CLASS (is a Struct), so no need to initialize a new one
public const string window_name = "Untitled - Notepad"; //Look for the window name
IntPtr handle = FindWindow(null, window_name);
public struct RECT //RECTangle object to use with DLL GetWindowRect import
{
public int left, top, right, bottom;
}
//"borrow" functionality to "click though" from C++ libraries
[DllImport("user32.dll", EntryPoint = "SetWindowLong")] //set transparent window size
static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
[DllImport("user32.dll", EntryPoint = "GetWindowLong")] //set transparent window size
static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll", SetLastError = true)]
static extern bool GetWindowRect(IntPtr hwnd, out RECT lpRect);
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.BackColor = Color.Wheat; //Set forms background to unused color
this.TransparencyKey = Color.Wheat; //Set transparency to background color
this.TopMost = true;
int initialstyle = GetWindowLong(this.Handle, -20); //Use c++ libraries to allow click though
SetWindowLong(this.Handle, -20, initialstyle | 0x80000 | 0x20);
GetWindowRect(handle, out rect); //Call function, pass handle, and output RECT)
this.Size = new Size(rect.right - rect.left, rect.bottom - rect.top); //setting size of window_name;
this.Top = rect.top;
this.Left = rect.left;
}
}
}
But what I would like to do now is to add arrows (with notation) to walk the user through procedures ( IE: click File, then Save, then enter a file name and click ok) and each time the user <g class=<g class="gr_ gr_14 gr-alert gr_gramm gr_inline_cards gr_run_anim Style replaceWithoutSep" data-gr-id="14" id="14">"gr</g>_ gr_13 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar multiReplace" data-gr-id="13" id="13">have</g> click these options in Notepad, to then change to the next instruction on the overlay window.
Could someone advise, point me to tutorials etc that would show me how I could do this?
Many Thanks
Continue reading...