none
how to show to status messages on IE using MFC and COM RRS feed

Answers

  • I found the code below on the internet last week and put it into one of my C# applications.  It work very well and uses kernal32.dll.  It uses the standard console and should work easily on the C++ application.

           [DllImport("kernel32.dll",
            EntryPoint = "GetStdHandle",
            SetLastError = true,
            CharSet = CharSet.Auto,
            CallingConvention = CallingConvention.StdCall)]
            private static extern IntPtr GetStdHandle(int nStdHandle);
            [DllImport("kernel32.dll",
                EntryPoint = "AllocConsole",
                SetLastError = true,
                CharSet = CharSet.Auto,
                CallingConvention = CallingConvention.StdCall)]
            private static extern int AllocConsole();
            [DllImport("user32.dll", SetLastError = true)]
            static extern bool BringWindowToTop(IntPtr hWnd);
            private const int STD_OUTPUT_HANDLE = -11;
            private const int MY_CODE_PAGE = 437;   
                AllocConsole();
                IntPtr stdHandle = GetStdHandle(STD_OUTPUT_HANDLE);
                SafeFileHandle safeFileHandle = new SafeFileHandle(stdHandle, true);
                FileStream fileStream = new FileStream(safeFileHandle, FileAccess.Write);
                Encoding encoding = System.Text.Encoding.GetEncoding(MY_CODE_PAGE);
                StreamWriter standardOutput = new StreamWriter(fileStream, encoding);
                standardOutput.AutoFlush = true;
                BringWindowToTop(stdHandle);
                
                Console.SetOut(standardOutput);   


    jdweng

    Monday, May 14, 2012 12:02 PM

All replies

  • Do you ureally want to bring up an IE or do youo just want to bring up a console window?  Bringup an IE involves creating a webpage that will accept messages.  I have some simple Win32 API code that will open a Text window to display messages.

    jdweng

    Monday, May 14, 2012 8:59 AM
  • I already have a webpage on which this entire process runs.

    in actual case on IE there is 1 silver light window when you click OK on window this window get destroyed and entire data is process in mfc in com.  i want to show some updates on IE status messages via mfc and com.

    Monday, May 14, 2012 11:32 AM
  • I found the code below on the internet last week and put it into one of my C# applications.  It work very well and uses kernal32.dll.  It uses the standard console and should work easily on the C++ application.

           [DllImport("kernel32.dll",
            EntryPoint = "GetStdHandle",
            SetLastError = true,
            CharSet = CharSet.Auto,
            CallingConvention = CallingConvention.StdCall)]
            private static extern IntPtr GetStdHandle(int nStdHandle);
            [DllImport("kernel32.dll",
                EntryPoint = "AllocConsole",
                SetLastError = true,
                CharSet = CharSet.Auto,
                CallingConvention = CallingConvention.StdCall)]
            private static extern int AllocConsole();
            [DllImport("user32.dll", SetLastError = true)]
            static extern bool BringWindowToTop(IntPtr hWnd);
            private const int STD_OUTPUT_HANDLE = -11;
            private const int MY_CODE_PAGE = 437;   
                AllocConsole();
                IntPtr stdHandle = GetStdHandle(STD_OUTPUT_HANDLE);
                SafeFileHandle safeFileHandle = new SafeFileHandle(stdHandle, true);
                FileStream fileStream = new FileStream(safeFileHandle, FileAccess.Write);
                Encoding encoding = System.Text.Encoding.GetEncoding(MY_CODE_PAGE);
                StreamWriter standardOutput = new StreamWriter(fileStream, encoding);
                standardOutput.AutoFlush = true;
                BringWindowToTop(stdHandle);
                
                Console.SetOut(standardOutput);   


    jdweng

    Monday, May 14, 2012 12:02 PM