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. Visual Basic
  4. Fade out effect in my form...??

Fade out effect in my form...??

Scheduled Pinned Locked Moved Visual Basic
question
13 Posts 6 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.
  • X Offline
    X Offline
    Xandip
    wrote on last edited by
    #1

    hi guys.. when i close my exe, i want it to close with a fade effect.. does anyone know bout it..??

    The name is Sandeep

    C K 2 Replies Last reply
    0
    • X Xandip

      hi guys.. when i close my exe, i want it to close with a fade effect.. does anyone know bout it..??

      The name is Sandeep

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Set the opacity in a loop, calling Invalidate and Application.DoEvents so they get shown, then close the form.

      Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

      X 1 Reply Last reply
      0
      • C Christian Graus

        Set the opacity in a loop, calling Invalidate and Application.DoEvents so they get shown, then close the form.

        Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

        X Offline
        X Offline
        Xandip
        wrote on last edited by
        #3

        im using vb..

        The name is Sandeep

        C 1 Reply Last reply
        0
        • X Xandip

          im using vb..

          The name is Sandeep

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          If you're using VB6, you need to say so. If you're using VB.NET, then do what I said.

          Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

          X 1 Reply Last reply
          0
          • C Christian Graus

            If you're using VB6, you need to say so. If you're using VB.NET, then do what I said.

            Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

            X Offline
            X Offline
            Xandip
            wrote on last edited by
            #5

            I cant do what u said.. coz i am using VB..

            The name is Sandeep

            R C 2 Replies Last reply
            0
            • X Xandip

              I cant do what u said.. coz i am using VB..

              The name is Sandeep

              R Offline
              R Offline
              Robert Rohde
              wrote on last edited by
              #6

              VB6 or VB.NET?!?

              X 1 Reply Last reply
              0
              • X Xandip

                I cant do what u said.. coz i am using VB..

                The name is Sandeep

                C Offline
                C Offline
                Christian Graus
                wrote on last edited by
                #7

                OK, I can only assume when you say VB, you mean VB6. VB6 is a dead language, and it sucked to start with. If you have any choice, move to VB.NET. Otherwise, tell people you're using VB6 when you ask questions here.

                Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

                D 1 Reply Last reply
                0
                • R Robert Rohde

                  VB6 or VB.NET?!?

                  X Offline
                  X Offline
                  Xandip
                  wrote on last edited by
                  #8

                  VB 6..

                  The name is Sandeep

                  D 1 Reply Last reply
                  0
                  • C Christian Graus

                    OK, I can only assume when you say VB, you mean VB6. VB6 is a dead language, and it sucked to start with. If you have any choice, move to VB.NET. Otherwise, tell people you're using VB6 when you ask questions here.

                    Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

                    D Offline
                    D Offline
                    Dileep_Vickey
                    wrote on last edited by
                    #9

                    Hi Graus, You said VB6 is a dead language. But nobody have a little experience in working with VB should'nt say like that. They would say it as the most flexible language. We can write a complex coding in other language in a very simple way in VB. By Dileeeeeeeep.

                    D C 2 Replies Last reply
                    0
                    • D Dileep_Vickey

                      Hi Graus, You said VB6 is a dead language. But nobody have a little experience in working with VB should'nt say like that. They would say it as the most flexible language. We can write a complex coding in other language in a very simple way in VB. By Dileeeeeeeep.

                      D Offline
                      D Offline
                      Dave Kreskowiak
                      wrote on last edited by
                      #10

                      It's dead. MS stopped supporting it entirely. It's been replaced, thankfully, with VB.NET. Finally! Real OOP support!

                      A guide to posting questions on CodeProject[^]
                      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                           2006, 2007

                      1 Reply Last reply
                      0
                      • X Xandip

                        VB 6..

                        The name is Sandeep

                        D Offline
                        D Offline
                        Dave Kreskowiak
                        wrote on last edited by
                        #11

                        In VB.NET this would have been easy. In VB6, I don't think you can do it because VB6 creates its forms differently, without support for Layered Windows, which is required to support opacity.

                        A guide to posting questions on CodeProject[^]
                        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                             2006, 2007

                        1 Reply Last reply
                        0
                        • D Dileep_Vickey

                          Hi Graus, You said VB6 is a dead language. But nobody have a little experience in working with VB should'nt say like that. They would say it as the most flexible language. We can write a complex coding in other language in a very simple way in VB. By Dileeeeeeeep.

                          C Offline
                          C Offline
                          Christian Graus
                          wrote on last edited by
                          #12

                          1 - it's dead in that it is no longer supported and will not be subject to any updates or service packs 2 - actually, the way this works in VB6 is usually that you write 2 lines of code that call a C++ COM object to do the complex stuff that VB cannot do.

                          Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

                          1 Reply Last reply
                          0
                          • X Xandip

                            hi guys.. when i close my exe, i want it to close with a fade effect.. does anyone know bout it..??

                            The name is Sandeep

                            K Offline
                            K Offline
                            Kiran Kumar B
                            wrote on last edited by
                            #13

                            Hi Xandip, I hope the code is useful... Here is the API declaration : Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _ (ByVal hwnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetLayeredWindowAttributes Lib "user32" _ (ByVal hwnd As Long, ByVal crey As Byte, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _ (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Private Const GWL_EXSTYLE = (-20) Private Const LWA_ALPHA = &H2& Private Const WS_EX_LAYERED = &H80000 Here is the code where you should use : Private Sub Command2_Click() Dim fadeCtr As Integer Call SetWindowLong(Me.hwnd, GWL_EXSTYLE, GetWindowLong(Me.hwnd, GWL_EXSTYLE) Or WS_EX_LAYERED) For fadeCtr = 255 To 0 Step -1 Call SetLayeredWindowAttributes(Me.hwnd, 0, fadeCtr, LWA_ALPHA) DoEvents Call Sleep(5) Next End End Sub Please dont use this code in Unload event of form - as you observe, I had used DoEvents in the above function. If this is useful, reply me to answer again.

                            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