Click here to Skip to main content
15,881,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
private void button2_Click(object sender, EventArgs e)
       {

           for (int i = 0; i < dataGridViewinvoice.Rows.Count; i++)
           {
               if (dataGridViewinvoice.Rows.Count > 0 /*|| dataGridViewinvoice.Rows[i].Cells[2].ToString() == ""*/)
               {

ProcessStartInfo startInfo = new ProcessStartInfo("iexplore.exe", "www.dbl5.lk/service1st/dispatch.php?tel=" + dataGridViewinvoice.Rows[i].Cells[4].Value.ToString() + "&&message=Your Order number-" + dataGridViewinvoice.Rows[i].Cells[2].Value.ToString() + " has been Processed. Invoice No-" + dataGridViewinvoice.Rows[i].Cells[0].Value.ToString() + " Amount-Rs." + dataGridViewinvoice.Rows[i].Cells[6].Value.ToString() + " Thank you for your continued patronage.");

startInfo.WindowStyle = ProcessWindowStyle.Minimized;
                   Process.Start(startInfo);
                   System.Threading.Thread.Sleep(2500);


What I have tried:

this is my code.i want to open minimized internet explore exe.my 1 st recode is minimized.
but other record is not minimized.
how to run internet explore in background..??
Posted
Updated 9-Nov-20 18:18pm
Comments
Richard Deeming 10-Nov-20 5:05am    
Do you actually need to run Internet Explorer? Is there some script or component on the page which needs to execute on the user's computer? Or do you just need to make a request to the specified URL?

1 solution

Browser default action is defined by user system and thus the behaviour would be different for different system.

You can try to find the process and try to minimize explicitly if the permissions are in place.
Example snippet:
C#
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;

namespace ConsoleApplication1
{
    class Program
    {
        [DllImport("user32.dll")]
        static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);

        static void Main()
        {
            var processes = Process.GetProcessesByName("iexplore");

            foreach (var process in processes)
            {
                ShowWindow(process.MainWindowHandle, 2);
            }
        }
    }
}

For detailed discussion on it, see here[^].
 
Share this answer
 
Comments
Member 14783717 10-Nov-20 1:18am    
sandeep i cant understand.pls help me?
Sandeep Mewara 10-Nov-20 1:35am    
What's not clear?

You cannot start a process(IE) as minimized. You can though try to find the process on system that you need and then try to set it as mnimized.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900