CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  1. #1
    Join Date
    Jan 2009
    Posts
    399

    Using web services from MFC

    Hi all of you. Is there a possible to adapt a MFC app (a GDI viewer who render standard images, jpg, bmp, etc.) to run on a server and render images in browser, using web services ?

    Of course that I have seeked this on internet, but I haven't found something that fit my needs ... Can you point me how to achieve this ? This is a request from someone, and I have to do some researches regarding this topic.

    Thank you for any response and for your time.

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Using web services from MFC

    Well, using the CHtmlView would be a good start.
    See also this thread.
    Victor Nijegorodov

  3. #3
    Join Date
    Jan 2009
    Posts
    399

    Re: Using web services from MFC

    And what part of my app could I run on a server in such a wat that client could see the images in any browser ?

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Using web services from MFC

    You could use a kind of Terminal Server (Remote Desktop) for example...
    Victor Nijegorodov

  5. #5
    Join Date
    Jan 2009
    Posts
    399

    Re: Using web services from MFC

    I this case I don't need the browser anymore ...

  6. #6
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Using web services from MFC

    Then sorry!
    Victor Nijegorodov

  7. #7
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Using web services from MFC

    Quote Originally Posted by mesajflaviu View Post
    Hi all of you. Is there a possible to adapt a MFC app (a GDI viewer who render standard images, jpg, bmp, etc.) to run on a server and render images in browser, using web services ?

    Of course that I have seeked this on internet, but I haven't found something that fit my needs ... Can you point me how to achieve this ? This is a request from someone, and I have to do some researches regarding this topic.

    Thank you for any response and for your time.
    The simple answer is "no." The complex answer is, "sure, anything is possible."

    The practical answer is there are are a host of issues running a native app from a web service. Security is one, streaming the image from the native app to the service is another.

    You don't mention what technology you are using to write the webservice. If it is something like .net, the you would be better of converting the native code into managed c++ that can be consumed by the .net service.

    If the MFC app rendered the images originally, then that rendering would be done on the client and supplied by a web server (which calls the web service to get the image data).

    Since the paradigm between rendering an image is so different that rendering the same in a browser, you are better off rewriting the functionality into the web service rather than trying to call the native app from the web service. Of course, that's just my opinion, and I have been surprised at the hacks that folks come up with.

  8. #8
    Join Date
    Jan 2009
    Posts
    399

    Re: Using web services from MFC

    Quote Originally Posted by VictorN View Post
    Then sorry!
    What I meant there is that was the request, there was not my idea ... I really don't want to be not polite or rude ... I am really sorry if you understand that !
    Last edited by mesajflaviu; September 11th, 2018 at 03:15 AM.

  9. #9
    Join Date
    Jan 2009
    Posts
    399

    Re: Using web services from MFC

    The one who request me this told me that the communication will be done by VPN.

    "You don't mention what technology you are using to write the webservice. If it is something like .net, the you would be better of converting the native code into managed c++ that can be consumed by the .net service."

    I know only C++/MFC ... this is not enough to complete the task ?

    "If the MFC app rendered the images originally, then that rendering would be done on the client and supplied by a web server (which calls the web service to get the image data)."

    Sound interesting ... can you elaborate a little bit ?

  10. #10
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Using web services from MFC

    I suppose while theoretically possible, it really isn't practical to write a modern web application in c++. Even if you did, you would either have to spend a ton of time writing it in c++ or end up with something that is the equivalent of a 20 year old web framework.

    C++ is great for many things, but writing web applications isn't one of them. If you want a web app that is current, you'll need to write it in a modern framework.

    I do Microsoft technologies, so I would write the web app and web service in .Net Core 2.x, but there are other languages that offer web frameworks, such java and python.

    You need to read up on web application development because the subject is too broad for me to give you even a start of what it is all about.

    For .NET Core 2.x web development, search bing or google for "how to write a web application in .net core 2". Plenty of info and tutorials out there. Btw, if you go this route, you'll want to use the lastest Visual Studio 2017 Community edition to develop with.

  11. #11
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: Using web services from MFC

    Quote Originally Posted by mesajflaviu View Post
    Hi all of you. Is there a possible to adapt a MFC app (a GDI viewer who render standard images, jpg, bmp, etc.) to run on a server and render images in browser, using web services ?
    I have a strong suspicion that you have no idea what web service is. Web services have nothing to do with browsers. As to browsers, those are capable of rendering "images, jpg, bmp, etc." with no help from server-side renderers. Unless your images are created on the fly, of course. You just specify a proper href to the image, and browser does the trick. The href may point at a special web page that reads image bytes from file, or database, or other sort of source and outputs those bytes accompanied with proper HTTP headers.

    I know only C++/MFC ... this is not enough to complete the task ?
    I have bad news for you. As long as it is about web server, you need to know about programming web servers.
    Best regards,
    Igor

  12. #12
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,234

    Re: Using web services from MFC

    As long as MFC is a C++ library, you can use C++ REST SDK to interact with web services in an MFC-based application (or other Windows native applications).
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  13. #13
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,234

    Re: Using web services from MFC

    ...then of course, can use GDI, GDI+ or Direct2D to render the images you have got with C++ REST SDK.
    Last edited by ovidiucucu; September 26th, 2018 at 04:09 AM.
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  14. #14
    Join Date
    Jan 2009
    Posts
    399

    Re: Using web services from MFC

    Quote Originally Posted by ovidiucucu View Post
    As long as MFC is a C++ library, you can use C++ REST SDK to interact with web services in an MFC-based application (or other Windows native applications).
    I didn't know it (REST C++ SDK), sound interesting ... from my searches I saw that example of REST C++ SDK are thin on internet ... there remain a part of the task: how to visualize the images on every machine (PC, laptop, phone) without any installation ... the client suggest to render the images in browser ... I guess there is another options ... but I don't know them.

  15. #15
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Using web services from MFC

    Quote Originally Posted by mesajflaviu View Post
    I didn't know it (REST C++ SDK), sound interesting ... from my searches I saw that example of REST C++ SDK are thin on internet ... there remain a part of the task: how to visualize the images on every machine (PC, laptop, phone) without any installation ... the client suggest to render the images in browser ... I guess there is another options ... but I don't know them.
    The REST sdk is C++ code that can call a rest web api service from c++. So if you have a c++ app and need to call a REST web sevrice api, you can use the c++ REST SDK.

    If your customer wants you to render images that can be seen in a browser, you need to create and host a web site, and C++ is of little help there (DISCLAIMER: I recently have been made aware that Facebook uses C++ to host their website, and there may be others that do it; however, for website development, c++ is not the language of choice).

Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured