Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. any tips to share on converting Win32 demo application to C#?

any tips to share on converting Win32 demo application to C#?

Scheduled Pinned Locked Moved The Lounge
csharpgraphicsalgorithmsquestion
13 Posts 9 Posters 4 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Southmountain

    I have a small Win32 app demo to show some algorithms on drawing 2D geometry. I plan to convert or rewrite it in C# because I like to use this algorithm in my WinForm app. any tips to share? it seems a little daunting to me...

    diligent hands rule....

    M Offline
    M Offline
    megaadam
    wrote on last edited by
    #3

    My tip: do not.

    "If we don't change direction, we'll end up where we're going"

    O 1 Reply Last reply
    0
    • M megaadam

      My tip: do not.

      "If we don't change direction, we'll end up where we're going"

      O Offline
      O Offline
      obermd
      wrote on last edited by
      #4

      I concur. If you must redo this demo as a C# application, write it from the ground up in C#. You'll end up with a more efficient application than if you do a straight conversion.

      S 1 Reply Last reply
      0
      • O obermd

        I concur. If you must redo this demo as a C# application, write it from the ground up in C#. You'll end up with a more efficient application than if you do a straight conversion.

        S Offline
        S Offline
        Southmountain
        wrote on last edited by
        #5

        yes, I plan to go through the code and understand the logic, then rewrite it...

        diligent hands rule....

        R 1 Reply Last reply
        0
        • CPalliniC CPallini

          I guess (I'm not an expert) going from Win32 to Windows Forms is far easier than the opposite. GDI+ is rather user-friendly, in my opinion.

          "In testa che avete, Signor di Ceprano?" -- Rigoletto

          S Offline
          S Offline
          Shao Voon Wong
          wrote on last edited by
          #6

          I second you. C++ GDI+ and C# GDI+ are very similar, one-to-one function replacement. I ported my [Outline Text](https://www.codeproject.com/Articles/42529/Outline-Text) from C++ to C# in one day.

          1 Reply Last reply
          0
          • S Southmountain

            yes, I plan to go through the code and understand the logic, then rewrite it...

            diligent hands rule....

            R Offline
            R Offline
            Ron Anders
            wrote on last edited by
            #7

            What's it written in now? Or, do you wish this to be a web app and hence C#?

            S 1 Reply Last reply
            0
            • S Southmountain

              I have a small Win32 app demo to show some algorithms on drawing 2D geometry. I plan to convert or rewrite it in C# because I like to use this algorithm in my WinForm app. any tips to share? it seems a little daunting to me...

              diligent hands rule....

              M Offline
              M Offline
              Member 9167057
              wrote on last edited by
              #8

              Depends on the language the original was written in as well as how well-structured it is. I would go about this by first and foremost separating business logic from plumbing. Then, by mapping the APIs used in the business logic part to .NET parts. While P/Invoking them is certainly feasible, that's only advised if the goal is defined as sticking as close as possible to the original and/or there's no corresponding .NET APIs.

              S 1 Reply Last reply
              0
              • S Southmountain

                I have a small Win32 app demo to show some algorithms on drawing 2D geometry. I plan to convert or rewrite it in C# because I like to use this algorithm in my WinForm app. any tips to share? it seems a little daunting to me...

                diligent hands rule....

                M Offline
                M Offline
                MikeCO10
                wrote on last edited by
                #9

                Not sure how we can answer that without knowing what language is it written in now?

                S 1 Reply Last reply
                0
                • S Southmountain

                  I have a small Win32 app demo to show some algorithms on drawing 2D geometry. I plan to convert or rewrite it in C# because I like to use this algorithm in my WinForm app. any tips to share? it seems a little daunting to me...

                  diligent hands rule....

                  S Offline
                  S Offline
                  Shmoken99
                  wrote on last edited by
                  #10

                  Ctrl+C Ctrl+V then start fixing the compiler errors. Converted an ancient app to C#. The biggest problem was changing all the 1 based indexes to 0 based. Wrote unit tests in both languages to ensure consistent behavior.

                  1 Reply Last reply
                  0
                  • M MikeCO10

                    Not sure how we can answer that without knowing what language is it written in now?

                    S Offline
                    S Offline
                    Southmountain
                    wrote on last edited by
                    #11

                    Win32, written in C++.

                    diligent hands rule....

                    1 Reply Last reply
                    0
                    • M Member 9167057

                      Depends on the language the original was written in as well as how well-structured it is. I would go about this by first and foremost separating business logic from plumbing. Then, by mapping the APIs used in the business logic part to .NET parts. While P/Invoking them is certainly feasible, that's only advised if the goal is defined as sticking as close as possible to the original and/or there's no corresponding .NET APIs.

                      S Offline
                      S Offline
                      Southmountain
                      wrote on last edited by
                      #12

                      thanks for you great experience!

                      diligent hands rule....

                      1 Reply Last reply
                      0
                      • R Ron Anders

                        What's it written in now? Or, do you wish this to be a web app and hence C#?

                        S Offline
                        S Offline
                        Southmountain
                        wrote on last edited by
                        #13

                        Win32, written in C++. would like to convert it into C# WinApp to play around with the algorithms in it,,,

                        diligent hands rule....

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups