How to get web page window handle RRS feed

  • Question

  • Hi,

    In my project there is a C++ dll that deals with windows handle. It was typically written to be used with Old Gupta Sql windows application. Now we will have to reuse the same dll in .net web application. we could able to call all the methods of the C++ dll from C# code through interop and mershalling. But now the question is how to pass the windows handle parameter from the web application. If we use web form application how to pass the current web page handle to the C++ dll method ? Please help!!


    Prabhat Ghosh.

    Thursday, July 13, 2017 12:39 PM

All replies

  • Are you build a web app? If so then you aren't going to be able to use a C++ DLL to get the web browser window. The web browser is on the client, all your code is running on the server. The only code that has access to the web browser is the client side JavaScript code. JavaScript cannot call your C++ DLL nor anything other than JavaScript (and maybe ActiveX if you happen to be running on an older IE version and the network team hasn't disabled support).

    For further questions related to web development please post in the ASP.NET forums.

    Michael Taylor

    • Proposed as answer by Hart Wang Friday, July 14, 2017 5:44 AM
    Thursday, July 13, 2017 1:57 PM
  • You need to post to the ASP.NET Web forum. You should keep in mind that a Web form is made up of HTML,  and a Web application is stateless, due to it doesn't run all of the time, unlike a Windows program that keeps state all of the time while it is running. I have never heard of Web form handles.

    Thursday, July 13, 2017 1:59 PM
  • Hi Prabhat Ghosh,

    Thank you for posting here.

    I agree with Michael Taylor. we are not able to get handle of web browser window. You could post the issue on ASP.NET forum, I will move the case to off-topic forum.

    Best Regards,


    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Friday, July 14, 2017 5:48 AM
  • Thank you all.
    • Proposed as answer by Hart Wang Friday, July 14, 2017 6:22 AM
    Friday, July 14, 2017 6:00 AM