Compare commits

..

1 Commits

Author SHA1 Message Date
8d040202ea Add project 2024-01-10 17:14:25 -06:00
4 changed files with 57 additions and 24 deletions

View File

@ -562,7 +562,7 @@ namespace Program_Hide
} }
public static Form2 f2; public static Form2 f2;
private void button1_Click(object sender, EventArgs e) private void button1_Click(object sender, EventArgs e) //need to make a version like this for the actual keybind list
{ {
StopRecording(); StopRecording();
if (ShowHideKeysList.Count == 2 && ShowHideKeysList.Contains(KeyboardHook.VKeys.LSHIFT) && ShowHideKeysList.Contains(KeyboardHook.VKeys.LMENU)) if (ShowHideKeysList.Count == 2 && ShowHideKeysList.Contains(KeyboardHook.VKeys.LSHIFT) && ShowHideKeysList.Contains(KeyboardHook.VKeys.LMENU))
@ -715,11 +715,11 @@ namespace Program_Hide
} }
else if (size.x < image.Width && !(size.y < image.Height)) else if (size.x < image.Width && !(size.y < image.Height))
{ {
props.rcDestination = new Rect(image.Left + ((image.Width - (props.rcDestination.Left + size.x)) / 2), image.Top, image.Right, image.Bottom); props.rcDestination = new Rect(image.Left + ((image.Width - (props.rcDestination.Left + size.x)) / 2), image.Top, image.Right, image.Bottom); //x is good, x is centered
} }
else if (!(size.x < image.Width) && size.y < image.Height) else if (!(size.x < image.Width) && size.y < image.Height)
{ {
props.rcDestination = new Rect(image.Left, image.Top + ((image.Height - (props.rcDestination.Top + size.y)) / 2), image.Right, image.Bottom); props.rcDestination = new Rect(image.Left, image.Top + ((image.Height - (props.rcDestination.Top + size.y)) / 2), image.Right, image.Bottom);//y is good, y is centered
} }
else if (!(size.x < image.Width && size.y < image.Height)) else if (!(size.x < image.Width && size.y < image.Height))
{ {

View File

@ -101,8 +101,9 @@ namespace Program_Hide
label1.Location = new Point(((this.Width / 2) - label1.Width / 2), label1.Location.Y); label1.Location = new Point(((this.Width / 2) - label1.Width / 2), label1.Location.Y);
} }
if (keybindMethod == "APP") if (keybindMethod == "APP") //when creating new form2 and sending params in form1, just send intptr as null aslong as string or just empty
{ {
//label1.Text = "\"" + applicationLocation + "\"";
label1.Visible = false; label1.Visible = false;
checkBox2.Visible = true; checkBox2.Visible = true;
checkBox3.Visible = true; checkBox3.Visible = true;
@ -111,6 +112,7 @@ namespace Program_Hide
#region KeyUp Detection System #region KeyUp Detection System
bool alreadyShownMB; bool alreadyShownMB;
//bool ShowingForm; //never used... as of 1/26/2020:8:12PM
bool keyIsNew; bool keyIsNew;
public static bool NewWindowRecording; public static bool NewWindowRecording;
public static bool Form2ForceRecord; public static bool Form2ForceRecord;
@ -144,9 +146,12 @@ namespace Program_Hide
} }
} }
} }
//else //WHY WOULD AN ELSE BE HERE?
//{
//Debug.WriteLine("KEYS RESET");
textBox1.Text = ""; textBox1.Text = "";
for (int i = 0; i < TempKeysList.Count; i++) for (int i = 0; i < TempKeysList.Count; i++) //probably should make a better system than this.
{ {
if (i < 1) if (i < 1)
{ {
@ -159,6 +164,7 @@ namespace Program_Hide
textBox1.SelectionStart = textBox1.TextLength; textBox1.SelectionStart = textBox1.TextLength;
} }
//}
} }
} }
keyIsNew = false; keyIsNew = false;
@ -180,7 +186,7 @@ namespace Program_Hide
textBox1.Text = ""; textBox1.Text = "";
for (int i = 0; i < TempKeysList.Count; i++) for (int i = 0; i < TempKeysList.Count; i++) //probably should make a better system than this.
{ {
if (i < 1) if (i < 1)
{ {
@ -243,11 +249,13 @@ namespace Program_Hide
} }
else else
{ {
label1.Text = "\"" + fileName.Substring(0, 28) + "....exe\""; label1.Text = "\"" + fileName.Substring(0, 28) + "....exe\""; //stops at 29th character, reason is because ....exe takes up space also | adds + 3 chars anyways cause of "..."
} }
label1.Location = new Point(((this.Width / 2) - label1.Width / 2), label1.Location.Y); label1.Location = new Point(((this.Width / 2) - label1.Width / 2), label1.Location.Y);
label1.Visible = true; label1.Visible = true;
//... Add other functionality here
} }
private void checkBox2_CheckedChanged(object sender, EventArgs e) private void checkBox2_CheckedChanged(object sender, EventArgs e)
@ -280,7 +288,7 @@ namespace Program_Hide
{ {
for (int i2 = 0; i2 < NewWindowKeysList.Count; i2++) for (int i2 = 0; i2 < NewWindowKeysList.Count; i2++)
{ {
if (!Form3.AllKeyBinds[i1].Contains(NewWindowKeysList[i2])) if (!Form3.AllKeyBinds[i1].Contains(NewWindowKeysList[i2])) //dont really think it matters if i put form3.allkeybinds on outside or inside of contains or not, so just put it like this as it seems simpler
{ {
break; break;
} }
@ -375,7 +383,10 @@ namespace Program_Hide
{ {
Form2ForceRecord = true; Form2ForceRecord = true;
Form1.Form1ForceRecord = false; Form1.Form1ForceRecord = false;
//if (Form1.ShowHideRecording)
//{
// Form1.ShowHideRecording = false;
//}
this.ActiveControl = null; this.ActiveControl = null;
if (!NewWindowRecording) if (!NewWindowRecording)
@ -422,7 +433,7 @@ namespace Program_Hide
} }
} }
public void SetNewKeys() public void SetNewKeys() //don't know if this is necessary
{ {
NewWindowKeysList = TempKeysList.ToList(); NewWindowKeysList = TempKeysList.ToList();
button1.Enabled = true; button1.Enabled = true;
@ -508,4 +519,12 @@ namespace Program_Hide
StopRecording(); StopRecording();
} }
} }
//public class ProgramHideExceptions : Exception //do an exception if the thing doesnt match
//{
// public InvalidInputTypeException()
// {
// }
//}
} }

View File

@ -51,10 +51,13 @@ namespace Program_Hide
label1.Visible = false; label1.Visible = false;
panel1.Location = new Point(0, 0); panel1.Location = new Point(0, 0);
panel1.MouseWheel += Panel1_MouseWheel; panel1.MouseWheel += Panel1_MouseWheel;
//panel1.AutoScroll = true;
vScrollBar1 = new VScrollBar(); vScrollBar1 = new VScrollBar();
vScrollBar1.Dock = DockStyle.Right; vScrollBar1.Dock = DockStyle.Right;
//vScrollBar1.LargeChange = 0; //maybe reenable
vScrollBar1.Scroll += (osender, eargs) => { vScrollBar1.Scroll += (osender, eargs) => {
UpdateScroll(true); UpdateScroll(true);
}; };
@ -76,7 +79,7 @@ namespace Program_Hide
} }
public void ShowForm(int i) public void ShowForm(int i) //RN IT JUST HIDES THE WINDOW ALWAYS WHEN KEYPRESSED, MAKE AN OPTION TO JUST MINIMIZE IT OR SOMETHING | CHECK 2-9-20 NOTES
{ {
if (i == 0) if (i == 0)
{ {
@ -87,15 +90,19 @@ namespace Program_Hide
} }
if (ShowingWindow[i]) if (ShowingWindow[i])
{ {
//this.Hide();
ShowWindowAsync(AllHandles[i], SW_HIDE); ShowWindowAsync(AllHandles[i], SW_HIDE);
ShowingWindow[i] = false; ShowingWindow[i] = false;
} }
else else
{ {
//this.Show();
ShowWindowAsync(AllHandles[i], SW_SHOW); ShowWindowAsync(AllHandles[i], SW_SHOW);
SetForegroundWindow(AllHandles[i]); SetForegroundWindow(AllHandles[i]);
//BringWindowToTop(this.Handle);
//BringToFront();
if (Maximize[i]) if (Maximize[i]) //dont need to add checkbox for maximize for main menu
{ {
ShowWindowAsync(AllHandles[i], SW_MAXIMIZE); ShowWindowAsync(AllHandles[i], SW_MAXIMIZE);
} }
@ -142,7 +149,7 @@ namespace Program_Hide
CurrentKeys.Remove(key); CurrentKeys.Remove(key);
} }
int changeInScroll = 5; int changeInScroll = 5; //THIS IS PRETTY MUCH USELESS BECAUSE MICROSOFT IS LAZY AND RUINED THE FEATURE OF HAVING THE SCROLLBAR ACTUALLY GO ALL THE WAY DOWN :( //CAN POSSIBLY FIX LATER
int scrollFreeSpace; int scrollFreeSpace;
float VScrollBar1Translation; float VScrollBar1Translation;
private void Panel1_MouseWheel(object sender, MouseEventArgs e) private void Panel1_MouseWheel(object sender, MouseEventArgs e)
@ -160,14 +167,14 @@ namespace Program_Hide
scrollFreeSpace = panel1.Height - this.ClientSize.Height; scrollFreeSpace = panel1.Height - this.ClientSize.Height;
Debug.WriteLine(scrollFreeSpace); Debug.WriteLine(scrollFreeSpace);
VScrollBar1Translation = (float)Math.Floor((double)(scrollFreeSpace / changeInScroll)); VScrollBar1Translation = (float)Math.Floor((double)(scrollFreeSpace / changeInScroll)); //pretty much does nothing...
vScrollBar1.Maximum = (int)VScrollBar1Translation; vScrollBar1.Maximum = (int)VScrollBar1Translation;
Debug.WriteLine("OUT OF: " + scrollFreeSpace / changeInScroll); Debug.WriteLine("OUT OF: " + scrollFreeSpace / changeInScroll);
Debug.WriteLine(vScrollBar1.Maximum); Debug.WriteLine(vScrollBar1.Maximum);
if (vScrollBar1.Maximum > 0) if (vScrollBar1.Maximum > 0)
{ {
if (e.Delta > 0) if (e.Delta > 0) //go up
{ {
if (vScrollBar1.Value - changeInScroll > vScrollBar1.Minimum) if (vScrollBar1.Value - changeInScroll > vScrollBar1.Minimum)
{ {
@ -178,7 +185,7 @@ namespace Program_Hide
vScrollBar1.Value = 0; vScrollBar1.Value = 0;
} }
} }
else else //go down
{ {
if (vScrollBar1.Value + changeInScroll < vScrollBar1.Maximum) if (vScrollBar1.Value + changeInScroll < vScrollBar1.Maximum)
{ {
@ -193,6 +200,7 @@ namespace Program_Hide
UpdateScroll(false); UpdateScroll(false);
} }
//if (this)
} }
} }
@ -213,16 +221,18 @@ namespace Program_Hide
{ {
Debug.WriteLine(vScrollBar1.Value + " OUT OF " + vScrollBar1.Maximum); Debug.WriteLine(vScrollBar1.Value + " OUT OF " + vScrollBar1.Maximum);
if (vScrollBar1.Value > ((vScrollBar1.Maximum / 10) * 9)) if (vScrollBar1.Value > ((vScrollBar1.Maximum / 10) * 9)) //this is included to prevent it from going into blank white space
{ {
Debug.WriteLine("true"); Debug.WriteLine("true");
panel1.Location = new Point(0, tempInt1); panel1.Location = new Point(0, tempInt1); //dk if this.cleintsize.height + 40 is needed
} }
else else //this is included to make the scroll wheel work up and down properly, still need to get it working properly
{ {
Debug.WriteLine("TRUE"); Debug.WriteLine("TRUE");
panel1.Location = new Point(0, tempInt1 - (int)(tempInt1 / -8.9f)); panel1.Location = new Point(0, tempInt1 - (int)(tempInt1 / -8.9f));//this just sucks D:, just keep it the way it is, its fine because it isnt cutting off any wording so its ok! for as of 2/1/12:36AM. Just fix it later or something!
} }
//panel1.Location = new Point(0, 0 - (vScrollBar1.Value * (panel1.Height / vScrollBar1.Maximum)) + (vScrollBar1.Value * ((this.ClientSize.Height + 40) / vScrollBar1.Maximum)) - 40);
//panel1.Location = new Point(0, (0 - (vScrollBar1.Value * (panel1.Height / vScrollBar1.Maximum)) + (vScrollBar1.Value * ((this.ClientSize.Height + 40) / vScrollBar1.Maximum))) / 9 * 10);
} }
else else
{ {
@ -232,7 +242,7 @@ namespace Program_Hide
if (!(tempInt1 > 0)) if (!(tempInt1 > 0))
{ {
Debug.WriteLine("WORKING"); Debug.WriteLine("WORKING");
panel1.Location = new Point(0, tempInt1); panel1.Location = new Point(0, tempInt1);// - (changeInScroll * vScrollBar1.Value)));
Debug.WriteLine(tempInt1); Debug.WriteLine(tempInt1);
} }
} }
@ -248,7 +258,7 @@ namespace Program_Hide
List<Panel> PanelList = new List<Panel>(); List<Panel> PanelList = new List<Panel>();
List<Label> LabelList = new List<Label>(); List<Label> LabelList = new List<Label>();
List<Label> NumLabelList = new List<Label>(); List<Label> NumLabelList = new List<Label>();
private void timer1_Tick(object sender, EventArgs e) private void timer1_Tick(object sender, EventArgs e) //may need to change way it works later, current works by disposing all panels whenever a new keybind is added and then recreates them all.
{ {
if (AllKeyBinds.Count != prevListValue) if (AllKeyBinds.Count != prevListValue)
{ {
@ -268,7 +278,7 @@ namespace Program_Hide
} }
public static bool forcePanelUpdate; public static bool forcePanelUpdate;
public void UpdatePanels() public void UpdatePanels() //current anchor set are good enough i guess...
{ {
if (!this.Visible) if (!this.Visible)
{ {
@ -283,7 +293,7 @@ namespace Program_Hide
} }
DisposeOldPanels(); DisposeOldPanels();
for (int i = 0; i < AllKeyBinds.Count; i++) for (int i = 0; i < AllKeyBinds.Count; i++) //just redraw always to make simple and not have errors!!!
{ {
p1 = new Panel(); p1 = new Panel();
PanelList.Add(p1); PanelList.Add(p1);
@ -299,6 +309,9 @@ namespace Program_Hide
panel1.Height = this.ClientSize.Height; panel1.Height = this.ClientSize.Height;
} }
//p1.AutoSize = true;
//p1.Anchor = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right); //anchor not working...
l1 = new Label(); l1 = new Label();
LabelList.Add(l1); LabelList.Add(l1);
l1.AutoSize = true; l1.AutoSize = true;

View File

@ -27,6 +27,7 @@ namespace KeyboardHook1
public enum VKeys//Vkeys //ACTUAL VKEYS, CHANGED OUT FOR UPDATED KEYS public enum VKeys//Vkeys //ACTUAL VKEYS, CHANGED OUT FOR UPDATED KEYS
{ {
// Losely based on http://www.pinvoke.net/default.aspx/Enums/VK.html // Losely based on http://www.pinvoke.net/default.aspx/Enums/VK.html
//NULL = 0x00, //I ADDED THIS ONE MYSELF <-----------------------------------
LBUTTON = 0x01, // Left mouse button LBUTTON = 0x01, // Left mouse button
RBUTTON = 0x02, // Right mouse button RBUTTON = 0x02, // Right mouse button
CANCEL = 0x03, // Control-break processing CANCEL = 0x03, // Control-break processing