Announcement

Collapse
No announcement yet.

compile with icon???

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • compile with icon???

    I want to add an icon to my source code, so that it is displayed in the exe file of my
    16bit application. How can I do this?
    Is it possible to place the icon in the source before compiling or is there a possibility to add this icon after compiling?
    Any software that do this?
    Is this possible with 16bit application(windows 3.1 compatibel)?
    Any help would be great.
    Thanks

    ------------------

  • #2
    To my knowledge, it is not possible to embed an icon in a
    16-bit *DOS* program. I think it is possible with a 16-bit
    *Windows* program.


    ------------------
    mailto:[email protected][email protected]</A>

    Comment


    • #3
      Correct -- DOS does not support linked resource files, whereas Windows does, so there is no reason for Windows to show anything other than the standard DOS-executable icon for the DOS application.

      ------------------
      Lance
      PowerBASIC Support
      mailto:[email protected][email protected]</A>
      Lance
      mailto:[email protected]

      Comment


      • #4
        I think that is possible placed myprog.ico and myprog.pif into
        myprog.exe in "crypto form". Myprog.exe
        then creates both files in same directory after first run. I did
        some experiments of this type. Similar efect can be obtained
        with help an instalation program.

        Lubos

        ------------------
        Lubos
        A view on PowerBASIC

        Comment


        • #5
          Lance ..

          I wonder if this is not an option?

          Correct -- DOS does not support linked resource files, whereas Windows does, so there is no reason for Windows to show
          anything other than the standard DOS-executable icon for the DOS application.
          WordStar 7 and SuperCalc 5.21 both are straight DOS programs and were
          distributed with the Icon's for them, even though they are just DOS
          appliations. Whenever you use OS/2 and ask for the Desktop to search
          for new programs and add them to the Desktop, if there is an .ICO file
          of the same name as the executable, in this case WS.ICO and SC5.ICO,
          OS/2 cheerfully knows how to pick up that Icon and use it. That as
          well as understand the embedded Icon operation.

          I have no experience at all with WIN-upwards. Thus do not know if a
          parallel distribution of the .ICO file would be of help here. But it
          was a technique in the 16 bit world which does work with OS/2. Thus
          if a more upwardly mobile WIN operating system knows how to handle
          WIN 3.1 suites, one would think that the early incantation of all
          this would still be in it's bag of tricklettes?




          ------------------
          Mike Luther
          [email protected]
          Mike Luther
          [email protected]

          Comment


          • #6
            But those icons were not part of the main exe file. They were unpacked
            during the installation.
            Keith Shelton

            ------------------

            Comment


            • #7
              How does the user get the application, Keith?

              I uderstand this doesn't address the issue of 'distribution' of an
              executable with a built-in Icon. We have these in OS/2 native operations
              as well. All I was trying to do is point out that package distribution can
              be made with an Icon which works well. The user, in the OS/2 scenario,
              never knows whether the it is a 16 bit application with a separate
              packaged Icon, or a 'better' more modern version with it embedded. The
              operating system is smart enough to know what to do with the issue from
              the get-go and the user has the same look and feel no matter what the
              method was to get it there!

              I said I have no experience at all with whether WIN can do this as well.


              ------------------
              Mike Luther
              [email protected]
              Mike Luther
              [email protected]

              Comment


              • #8
                Hi Mike, in windows you have to create a pif file for the 16-bit program. This specifies where
                the icon file is. If you are using pure dos you will not have a graphical shell to display
                any icons. Which brings us back to what Lance said.

                ------------------

                Comment


                • #9
                  Thanks Keith. So much to learn. So little time.. ;(


                  ------------------
                  Mike Luther
                  [email protected]
                  Mike Luther
                  [email protected]

                  Comment


                  • #10
                    The Portable Executable file format supports containing the DOS
                    and Windows version of a program, which also means you could
                    add an Icon into the executable.... but PowerBASIC does not
                    produce such creatures, so your out of luck there.

                    ------------------
                    Amos
                    mailto:[email protected][email protected]</A>

                    Comment


                    • #11
                      Amos, off hand, do you know of any <U>DOS</U> compilers that produce such EXE files, and that Windows Explorer can/does display the icon for such an app? (curious minds enquire...!)

                      Thanks!


                      ------------------
                      Lance
                      PowerBASIC Support
                      mailto:[email protected][email protected]</A>
                      Lance
                      mailto:[email protected]

                      Comment


                      • #12
                        Sorry, but it looks like the PE format won't work under DOS
                        From http://www.windowsitlibrary.com/Content/356/11/toc.html :

                        If you look at the hex dump of a PE file, the first 2 bytes: might look familiar. Aren’t they M and Z? Yes, a PE file starts with the DOS executable header. It is followed by a small program that prints an error message saying that the program cannot be run in DOS mode. It’s the same idea that was used in 16-bit Windows executables. This program code is executed, if the PE image is run under DOS.
                        I had my hopes up too.


                        ------------------
                        What can go wrong will go wrong.
                        Anything can go wrong.
                        What hasn't?!?!
                        What can go wrong will go wrong.
                        Anything can go wrong.
                        What hasn't?!?!

                        Comment


                        • #13
                          Hello,

                          Anyone of you ever looked at SpinRite ... In Windows you get
                          this very cool looking icon. But Spinrite is a DOS program. So,
                          if you run it, it will throw up a nice looking splash-screen and
                          tell it'll goto DOS.

                          Now, if you run this exact same exe in DOS, it just runs
                          Spinrite!

                          So, one 'exe' that does different things depending upon the OS ..

                          It is ONE exe, that can be run from DOS AND Windows, it really
                          looks very cool ... so, there must be way to do this ...

                          Another detail, if you right click the spirite.exe in Windows,
                          it does not list the typical properties you get for an DOS exe,
                          instead it looks like a pure Windows program.

                          regards,
                          Joep

                          ------------------
                          Joep

                          http://www.diydatarecovery.nl
                          Joep

                          http://www.diydatarecovery.nl

                          Comment


                          • #14
                            Hahaaah, found something that may do the trick ...

                            http://www8.pair.com/dmurdoch/programs/#glue

                            It is called Glue and does something with the STUB whatever it is

                            Normally this STUB throws up the message "this program cannot be
                            run in DOS bla, bla" Glue replaces this and points to your DOS
                            program instead.

                            I am gonna try it.

                            Joep

                            ------------------
                            Joep

                            http://www.diydatarecovery.nl
                            Joep

                            http://www.diydatarecovery.nl

                            Comment


                            • #15
                              Yep ..

                              It is called Glue and does something with the STUB whatever it is

                              Normally this STUB throws up the message "this program cannot be
                              run in DOS bla, bla" Glue replaces this and points to your DOS
                              program instead.
                              And what I want is a switcher that will determine that the operating
                              system is DOS - WIN(whatever) - LINUX - or grin OS/2 .. and switch to
                              the appropriate bundled executable all distributed as one even if
                              gigantic distro. Not that different file systems etc., might get in the
                              way, but surely there is a way to play this game...

                              That way we really could start an iconoclastic movement

                              ------------------
                              Mike Luther
                              [email protected]
                              Mike Luther
                              [email protected]

                              Comment


                              • #16
                                Yep,

                                Works! The version of Glue on the website is an older version and
                                works with win3.x stuff only. I contacted the author as the website
                                states that Glue 2.0 will combine DOS and Windows 32 exes and will
                                be received upon registration of Glue 1.0 ...

                                Since the author no longer supports the program he sent me a copy
                                of Glue 2.0. If you want I can sent it. Contact me at
                                [email protected]

                                I tested and it works ... combined a DOS exe with a Windows one,
                                and if I run DOS it executes the DOS program, If I run the same
                                exe in Windows it starts the Windows program.

                                Of course you can write a Windows program that will display just
                                a splash screen stating "Sorry, this program requires DOS..." and
                                combine that with your DOS exe. You could even gracefully exit,
                                reboot and run DOS (On Win9x systems).

                                And, to get back the original post, it has an icon now ....

                                Kind regards,
                                Joep



                                ------------------
                                Joep

                                http://www.diydatarecovery.nl
                                Joep

                                http://www.diydatarecovery.nl

                                Comment


                                • #17
                                  Hmm ... Update:

                                  I have now discovered I can not get it wo work on XP ...

                                  I have a DOS exe and a Windows one glued together now. If I right
                                  click the new executable I can get properties like version,
                                  copyright info etc. It also has an icon.

                                  In other words, so far it behaves like a Win32 application. If I
                                  start it though I get the message that this is not a valid Win32
                                  application.

                                  I can run the same exe from 98 and ME though.

                                  I even was able to pack both the DOS and the windows executables
                                  with UPX! (No if I do NOT pack I still can't run from XP ...)

                                  Kind regards,

                                  ------------------
                                  Joep

                                  http://www.diydatarecovery.nl
                                  Joep

                                  http://www.diydatarecovery.nl

                                  Comment


                                  • #18
                                    Wow.... haven't been here in awhile... The answer to your
                                    question Lance, is in the original post.

                                    The Out of luck part would imply that I do not know of such a
                                    thing.

                                    On Seal (sealsystem.sourceforge.net) we appended the icons to
                                    the end of some files as an extended resource, but we also used
                                    a custom (DLX based) executable format to execute calling Seal
                                    API functions. This was done with DJGPP and Grabber.

                                    As far as the "Glued" executables, and XP I would imagine it
                                    could be solved by changing the compatibility level settings
                                    for your program. It's possible that malforming executables in
                                    such a way would skew the checksum causing XP to think it's a
                                    corrupted file.

                                    ------------------
                                    Amos
                                    mailto:[email protected][email protected]</A>

                                    Comment

                                    Working...
                                    X