This is my c# code.
But every time I run this code, whenever I click the left click the file is saved in default path : "C:\NewFolder\"
But I don't know how to set the folder selected using right click as my default folder forever.
After I select a folder using right click, whenever I run the exe file, the file should save in that selected folder
string folderpath = "C:\\NewFolder\\";
private void button1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == System.Windows.Forms.MouseButtons.Left)
{
bool exists = System.IO.Directory.Exists(folderpath);
if (!exists)
System.IO.Directory.CreateDirectory(folderpath);
this.Hide();
System.Threading.Thread.Sleep(1000);
SendKeys.Send("{PRTSC}");
Image img = Clipboard.GetImage();
img.Save(folderpath + "\\" + DateTime.Now.Ticks + ".jpg");
this.Show();
}
if (e.Button == System.Windows.Forms.MouseButtons.Right)
{
DialogResult result = folderBrowserDialog1.ShowDialog();
if (result == DialogResult.OK)
{
folderpath = folderBrowserDialog1.SelectedPath;
}
}
}