locked
Can C++ win32 dll methods be called by web api and there after those methods can be exposed to consumed by frontend technology RRS feed

  • Question

  • User-241333495 posted

    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(HWND) parameter from the web application. 
    If we use web form application how to pass the current web page handle as Windows handle and get return as web page handle from the C++ dll method ?

    If we want to expose those C++ functions through web API methods and will it be consumable by any front end technology like AngularJS ?

    Please help!!

    Thanks,
    Prabhat Ghosh.

    Friday, July 14, 2017 5:46 AM

All replies

  • User-474980206 posted

    web applications run as detached process. there is no window handle, because there is no window. while its techincally possible to attach to the desktop, this requires a monitor on the server and a continous login, so the desktop exists. you might see if it supports null (0) for the window handle.

    if you do this approach, you might find it easier to write a wrapper around the dll, that allows calling over http / remotimg. than just have the startup script start it when logging on to the server with the account you want to use.

    this will also handle any threading issues that may exist with the old dll. if you host the dll in asp.net, you will need to know its threading model. if its not free threaded, you will need to create a single background thread to host, and marshal requests to it.

    Friday, July 14, 2017 3:28 PM