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#
  4. Glass Effect using dwmapi.dll in windows xp on C#

Glass Effect using dwmapi.dll in windows xp on C#

Scheduled Pinned Locked Moved C#
graphicscsharpgame-devdebugginghelp
4 Posts 4 Posters 1 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.
  • V Offline
    V Offline
    Viswa Teja
    wrote on last edited by
    #1

    Hii i am writing a code to make the glass effect on windows form. Well the code works fine on vista but my target is on windows xp. I have copyed all the dll's that are reqired and when i debug i am getting an error "DLL NOT FOUND EXCEPTION UNHANDILED". Here is the code that i am using:- ----------------------------------------------------------------------------------------------------------------------------- This is the class where i import dwmapi dll. using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; namespace welcome_page { class VistaGlassEffect { internal class VistaApi { [DllImport("dwmapi.dll")] internal static extern void DwmExtendFrameIntoClientArea(System.IntPtr hWnd, ref Margins pMargins); [DllImport("dwmapi.dll")] internal static extern void DwmIsCompositionEnabled(ref bool isEnabled); internal struct Margins { public int Left, Right, Top, Bottom; } // consts for wndproc internal const int WM_NCHITTEST = 0x84; internal const int HTCLIENT = 1; internal const int HTCAPTION = 2; } } } ----------------------------------------------------------------------------------------------------------------------------- This the form where i call this class "VistaGlassEffect" using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using Microsoft.DirectX.AudioVideoPlayback; using System.Diagnostics; using System.Drawing.Drawing2D; namespace welcome_page { public partial class Form2 : Form { public Form2() { InitializeComponent(); this.FitGlass(); } Video video; private welcome_page.VistaGlassEffect.VistaApi.Margins marg; private Rectangle topRect = Rectangle.Empty; private Rectangle botRect = Rectangle.Empty; private Rectangle lefRect = Rectangle.Empty; private Rectangle rigRect = Rectangle.Empty; private void FitGlass() { // If DWM is not enabled then get out if (!this.IsGlassEnabled()) { return; } // Set the Margins to their default values marg.Top = 600; // extend from the

    C P D 3 Replies Last reply
    0
    • V Viswa Teja

      Hii i am writing a code to make the glass effect on windows form. Well the code works fine on vista but my target is on windows xp. I have copyed all the dll's that are reqired and when i debug i am getting an error "DLL NOT FOUND EXCEPTION UNHANDILED". Here is the code that i am using:- ----------------------------------------------------------------------------------------------------------------------------- This is the class where i import dwmapi dll. using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; namespace welcome_page { class VistaGlassEffect { internal class VistaApi { [DllImport("dwmapi.dll")] internal static extern void DwmExtendFrameIntoClientArea(System.IntPtr hWnd, ref Margins pMargins); [DllImport("dwmapi.dll")] internal static extern void DwmIsCompositionEnabled(ref bool isEnabled); internal struct Margins { public int Left, Right, Top, Bottom; } // consts for wndproc internal const int WM_NCHITTEST = 0x84; internal const int HTCLIENT = 1; internal const int HTCAPTION = 2; } } } ----------------------------------------------------------------------------------------------------------------------------- This the form where i call this class "VistaGlassEffect" using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using Microsoft.DirectX.AudioVideoPlayback; using System.Diagnostics; using System.Drawing.Drawing2D; namespace welcome_page { public partial class Form2 : Form { public Form2() { InitializeComponent(); this.FitGlass(); } Video video; private welcome_page.VistaGlassEffect.VistaApi.Margins marg; private Rectangle topRect = Rectangle.Empty; private Rectangle botRect = Rectangle.Empty; private Rectangle lefRect = Rectangle.Empty; private Rectangle rigRect = Rectangle.Empty; private void FitGlass() { // If DWM is not enabled then get out if (!this.IsGlassEnabled()) { return; } // Set the Margins to their default values marg.Top = 600; // extend from the

      C Offline
      C Offline
      Covean
      wrote on last edited by
      #2

      Is it possible that your Vista is a 64 bit version? You can't mix 64 bit apps with 32 bit dlls. [edit] I should learn to read ....... just ignore this post :laugh:

      Greetings Covean

      modified on Wednesday, November 4, 2009 8:41 AM

      1 Reply Last reply
      0
      • V Viswa Teja

        Hii i am writing a code to make the glass effect on windows form. Well the code works fine on vista but my target is on windows xp. I have copyed all the dll's that are reqired and when i debug i am getting an error "DLL NOT FOUND EXCEPTION UNHANDILED". Here is the code that i am using:- ----------------------------------------------------------------------------------------------------------------------------- This is the class where i import dwmapi dll. using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; namespace welcome_page { class VistaGlassEffect { internal class VistaApi { [DllImport("dwmapi.dll")] internal static extern void DwmExtendFrameIntoClientArea(System.IntPtr hWnd, ref Margins pMargins); [DllImport("dwmapi.dll")] internal static extern void DwmIsCompositionEnabled(ref bool isEnabled); internal struct Margins { public int Left, Right, Top, Bottom; } // consts for wndproc internal const int WM_NCHITTEST = 0x84; internal const int HTCLIENT = 1; internal const int HTCAPTION = 2; } } } ----------------------------------------------------------------------------------------------------------------------------- This the form where i call this class "VistaGlassEffect" using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using Microsoft.DirectX.AudioVideoPlayback; using System.Diagnostics; using System.Drawing.Drawing2D; namespace welcome_page { public partial class Form2 : Form { public Form2() { InitializeComponent(); this.FitGlass(); } Video video; private welcome_page.VistaGlassEffect.VistaApi.Margins marg; private Rectangle topRect = Rectangle.Empty; private Rectangle botRect = Rectangle.Empty; private Rectangle lefRect = Rectangle.Empty; private Rectangle rigRect = Rectangle.Empty; private void FitGlass() { // If DWM is not enabled then get out if (!this.IsGlassEnabled()) { return; } // Set the Margins to their default values marg.Top = 600; // extend from the

        P Offline
        P Offline
        Pete OHanlon
        wrote on last edited by
        #3

        You asked this question here[^] and were told you couldn't do this using dwmapi.dll. This is a Vista+ only DLL, and copying it onto XP doesn't mean it'll work on XP. If your logic held true, then I'd only need to get a Ferrari keyring to convert my car into one. Bottom line - you can't do this with dwmapi, find another way and stop bumping posts.

        "WPF has many lovers. It's a veritable porn star!" - Josh Smith

        As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

        My blog | My articles | MoXAML PowerToys | Onyx

        1 Reply Last reply
        0
        • V Viswa Teja

          Hii i am writing a code to make the glass effect on windows form. Well the code works fine on vista but my target is on windows xp. I have copyed all the dll's that are reqired and when i debug i am getting an error "DLL NOT FOUND EXCEPTION UNHANDILED". Here is the code that i am using:- ----------------------------------------------------------------------------------------------------------------------------- This is the class where i import dwmapi dll. using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; namespace welcome_page { class VistaGlassEffect { internal class VistaApi { [DllImport("dwmapi.dll")] internal static extern void DwmExtendFrameIntoClientArea(System.IntPtr hWnd, ref Margins pMargins); [DllImport("dwmapi.dll")] internal static extern void DwmIsCompositionEnabled(ref bool isEnabled); internal struct Margins { public int Left, Right, Top, Bottom; } // consts for wndproc internal const int WM_NCHITTEST = 0x84; internal const int HTCLIENT = 1; internal const int HTCAPTION = 2; } } } ----------------------------------------------------------------------------------------------------------------------------- This the form where i call this class "VistaGlassEffect" using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using Microsoft.DirectX.AudioVideoPlayback; using System.Diagnostics; using System.Drawing.Drawing2D; namespace welcome_page { public partial class Form2 : Form { public Form2() { InitializeComponent(); this.FitGlass(); } Video video; private welcome_page.VistaGlassEffect.VistaApi.Margins marg; private Rectangle topRect = Rectangle.Empty; private Rectangle botRect = Rectangle.Empty; private Rectangle lefRect = Rectangle.Empty; private Rectangle rigRect = Rectangle.Empty; private void FitGlass() { // If DWM is not enabled then get out if (!this.IsGlassEnabled()) { return; } // Set the Margins to their default values marg.Top = 600; // extend from the

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

          Viswa Teja wrote:

          works fine on vista but my target is on windows xp. I have copyed all the dll's that are reqired

          This will not work. You cannot copy those .DLL's from a Vista system and expect them to work on XP. The rendering system work quite a bit differently. As for the error that you're getting, what you didn't take into account is that the .DLL's you copied are depending on other .DLL's themselves which you haven't copied and that cannot be loaded because of other problems, not the least of which is you're trying to run Vista .DLL's on an XP system.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007, 2008
          But no longer in 2009...

          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