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. General Programming
  3. C / C++ / MFC
  4. Platform question

Platform question

Scheduled Pinned Locked Moved C / C++ / MFC
question
8 Posts 5 Posters 0 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.
  • A Offline
    A Offline
    Anonymous
    wrote on last edited by
    #1

    I made an app that can run on Win9x/Win2k. I want that on Win2k my dialog become transparent, so I used the fonction SetLayeredWindowAttributes(...). It won't compile, I've added /D "_WIN32_WINNT=0x0500" to the compiler additional Options, now it compils but don't work on Win9x... Is it a way to make my app work on all Windows ?

    L S A 3 Replies Last reply
    0
    • A Anonymous

      I made an app that can run on Win9x/Win2k. I want that on Win2k my dialog become transparent, so I used the fonction SetLayeredWindowAttributes(...). It won't compile, I've added /D "_WIN32_WINNT=0x0500" to the compiler additional Options, now it compils but don't work on Win9x... Is it a way to make my app work on all Windows ?

      L Offline
      L Offline
      Lakitu
      wrote on last edited by
      #2

      Unfortunately not... Transpareny was introduced in W2K (WinNT 5.0)

      A 1 Reply Last reply
      0
      • L Lakitu

        Unfortunately not... Transpareny was introduced in W2K (WinNT 5.0)

        A Offline
        A Offline
        Anonymous
        wrote on last edited by
        #3

        Yes I know, but I thought that the app can run on Win9x and the fonction simply ignored.... And I know I can load SetLayeredWindowAttributes directly from "User32.dll" with LoadLibrary blabla, but I was asking if there is a solution to simply use SetLayeredWindowAttributes (I don't need to load it from User32.dll because I have the last Platform SDK) and make my app run on all Windows (and the fonction does nothing on Win9x). Ouch sorry for my english I hope someone will understand what I want to say ;o) Anyway, Lakitu thanks for your answer.

        1 Reply Last reply
        0
        • A Anonymous

          I made an app that can run on Win9x/Win2k. I want that on Win2k my dialog become transparent, so I used the fonction SetLayeredWindowAttributes(...). It won't compile, I've added /D "_WIN32_WINNT=0x0500" to the compiler additional Options, now it compils but don't work on Win9x... Is it a way to make my app work on all Windows ?

          S Offline
          S Offline
          Stephane Rodriguez
          wrote on last edited by
          #4

          OSVERSIONINFO os;
          ::GetVersionEx(&os);

          if ( os.dwMajorVersion>=5 )
          SetLayeredWindowAttributes(...).


          MS quote (http://www.microsoft.com/ddk) : As of September 30, 2002, the Microsoft® Windows® 2000 DDK, the Microsoft Windows 98 DDK, and the Microsoft Windows NT® 4.0 DDK will no longer be available for purchase or download on this site.

          A 1 Reply Last reply
          0
          • S Stephane Rodriguez

            OSVERSIONINFO os;
            ::GetVersionEx(&os);

            if ( os.dwMajorVersion>=5 )
            SetLayeredWindowAttributes(...).


            MS quote (http://www.microsoft.com/ddk) : As of September 30, 2002, the Microsoft® Windows® 2000 DDK, the Microsoft Windows 98 DDK, and the Microsoft Windows NT® 4.0 DDK will no longer be available for purchase or download on this site.

            A Offline
            A Offline
            Anonymous
            wrote on last edited by
            #5

            Yes I know this code, but it doesn't solve my problem ! To compile it I have to set /D "_WIN32_WINNT=0x0500" but when I set that it doesn't work on Win9x :-/

            S 1 Reply Last reply
            0
            • A Anonymous

              Yes I know this code, but it doesn't solve my problem ! To compile it I have to set /D "_WIN32_WINNT=0x0500" but when I set that it doesn't work on Win9x :-/

              S Offline
              S Offline
              Stephane Rodriguez
              wrote on last edited by
              #6

              Put this code in a separate DLL. And make two versions of this DLL, one without _WIN32_WINNT=0x0500. From your main app, you then just need to load the appropriate DLL depending on the os version. This DLL remains small, which is may be a better approach than having two whole apps compiled for each target os.


              MS quote (http://www.microsoft.com/ddk) : As of September 30, 2002, the Microsoft® Windows® 2000 DDK, the Microsoft Windows 98 DDK, and the Microsoft Windows NT® 4.0 DDK will no longer be available for purchase or download on this site.

              S 1 Reply Last reply
              0
              • S Stephane Rodriguez

                Put this code in a separate DLL. And make two versions of this DLL, one without _WIN32_WINNT=0x0500. From your main app, you then just need to load the appropriate DLL depending on the os version. This DLL remains small, which is may be a better approach than having two whole apps compiled for each target os.


                MS quote (http://www.microsoft.com/ddk) : As of September 30, 2002, the Microsoft® Windows® 2000 DDK, the Microsoft Windows 98 DDK, and the Microsoft Windows NT® 4.0 DDK will no longer be available for purchase or download on this site.

                S Offline
                S Offline
                Steve S
                wrote on last edited by
                #7

                The alternative is to write a wrapper function for the one you're trying to use, which detects the OS version and if it's Win2000/XP or later, gets the address of the function from USER32 and calls it, otherwise does nothing. Your problem is two things; You don't have the function declaration unless you have _WIN32_WINNT set to 0x0500, and with that in place, you have a reference to the function in your EXE. When the EXE runs on an earlier (NT,9x) system, the function cannot be located by the import lib code you pulled in when you built. You can either do what Stephane suggests, what I suggest, or not use the function :) Steve S [This signature space available for rent]

                1 Reply Last reply
                0
                • A Anonymous

                  I made an app that can run on Win9x/Win2k. I want that on Win2k my dialog become transparent, so I used the fonction SetLayeredWindowAttributes(...). It won't compile, I've added /D "_WIN32_WINNT=0x0500" to the compiler additional Options, now it compils but don't work on Win9x... Is it a way to make my app work on all Windows ?

                  A Offline
                  A Offline
                  Atlantys
                  wrote on last edited by
                  #8

                  give this a try: http://www.codeproject.com/dialog/clayeredwindowhelperst.asp[^] He basically does everything that you're having problems with.

                  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