• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

Has anyone used this glass code in VB.NET?

Joined
Jul 29, 2007
Messages
392 (0.06/day)
Location
Portugal
System Name Lil'Lighty
Processor Intel Core i3 530 @ Stock
Motherboard Asus P7P55D
Cooling Artic Cooling Freezer Pro Rev.2
Memory Gskill Ripjaw 1600MHz 9-9-9-24 8GB
Video Card(s) MSI GeForce GTX650 OC 1GB
Storage WD Blue 500GB AAKS
Display(s) ASUS 20'
Case Aerocool Aeroengine II // Two 120mm Blue Fans
Audio Device(s) Creative SoundBlaster LE // Logitech X-230
Power Supply Corsair VX450W
Software Windows 8.1 Pro x64
Like the title says:

Code:
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential)> _
Public Structure MARGINS
    Public cxLeftWidth As Integer
    Public cxRightWidth As Integer
    Public cyTopHeight As Integer
    Public cyBottomHeight As Integer
End Structure

Public Class Form 1
<DllImport("dwmapi.dll")> _
Public Shared Function DwmExtendFrameIntoClientArea(ByVal hWnd As IntPtr, ByRef pMarinset As MARGINS) As Integer
    End Function

Private Sub Form1_Load(......)
On Error Resume Next
        Dim margins As MARGINS = New MARGINS
        margins.cxLeftWidth = -1
        margins.cxRightWidth = -1
        margins.cyTopHeight = -1
        margins.cyBottomHeight = -1
        'set all the four value -1 to apply glass effect to the whole window
        'set your own value to make specific part of the window glassy.
        Dim hwnd As IntPtr = Me.Handle
        Dim result As Integer = DwmExtendFrameIntoClientArea(hwnd, margins)
End Sub

Has anyone used this code on some kind of app of yours? If so, did it integrate well with glass or not? I'm not being able to make it integrate well.
 

Lillebror

New Member
Joined
Jul 28, 2007
Messages
719 (0.12/day)
Location
Denmark
Processor Intel Core2Duo e8400 @ 3.6ghz
Motherboard Asus P5Q Pro w/ mBios
Cooling Xigmatec something with a orange fan
Memory Kingston HyperX 4 gig
Video Card(s) Sapphire hd4870
Storage 320 gb Maxtor 750gb samsung f11 250gb hitachi
Display(s) IIyama e1900s
Case CoolerMaster Ammo
Audio Device(s) Asus Xonar D2/PM Pci
Power Supply Corsair 750w
Software Windows 7 x64
You need to make your background black for that one to work.
 

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.63/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
What do you mean by "not being able to make it integrate well?"
 
Joined
Jul 29, 2007
Messages
392 (0.06/day)
Location
Portugal
System Name Lil'Lighty
Processor Intel Core i3 530 @ Stock
Motherboard Asus P7P55D
Cooling Artic Cooling Freezer Pro Rev.2
Memory Gskill Ripjaw 1600MHz 9-9-9-24 8GB
Video Card(s) MSI GeForce GTX650 OC 1GB
Storage WD Blue 500GB AAKS
Display(s) ASUS 20'
Case Aerocool Aeroengine II // Two 120mm Blue Fans
Audio Device(s) Creative SoundBlaster LE // Logitech X-230
Power Supply Corsair VX450W
Software Windows 8.1 Pro x64
You need to make your background black for that one to work.

Yes, I know that, but some objects become so badly integrated:



The labels look not so bad, but the one on the status bar becomes awful.
 

Lillebror

New Member
Joined
Jul 28, 2007
Messages
719 (0.12/day)
Location
Denmark
Processor Intel Core2Duo e8400 @ 3.6ghz
Motherboard Asus P5Q Pro w/ mBios
Cooling Xigmatec something with a orange fan
Memory Kingston HyperX 4 gig
Video Card(s) Sapphire hd4870
Storage 320 gb Maxtor 750gb samsung f11 250gb hitachi
Display(s) IIyama e1900s
Case CoolerMaster Ammo
Audio Device(s) Asus Xonar D2/PM Pci
Power Supply Corsair 750w
Software Windows 7 x64
You should try to find a new way to get the glass effect - cause its not that good, for general use.
 
Joined
Jul 29, 2007
Messages
392 (0.06/day)
Location
Portugal
System Name Lil'Lighty
Processor Intel Core i3 530 @ Stock
Motherboard Asus P7P55D
Cooling Artic Cooling Freezer Pro Rev.2
Memory Gskill Ripjaw 1600MHz 9-9-9-24 8GB
Video Card(s) MSI GeForce GTX650 OC 1GB
Storage WD Blue 500GB AAKS
Display(s) ASUS 20'
Case Aerocool Aeroengine II // Two 120mm Blue Fans
Audio Device(s) Creative SoundBlaster LE // Logitech X-230
Power Supply Corsair VX450W
Software Windows 8.1 Pro x64
You should try to find a new way to get the glass effect - cause its not that good, for general use.

So I should mess with the glass position to not to use all the window, only what I need right? I'm doing sorta that... so that the program doesn't feel weird.
 

Lillebror

New Member
Joined
Jul 28, 2007
Messages
719 (0.12/day)
Location
Denmark
Processor Intel Core2Duo e8400 @ 3.6ghz
Motherboard Asus P5Q Pro w/ mBios
Cooling Xigmatec something with a orange fan
Memory Kingston HyperX 4 gig
Video Card(s) Sapphire hd4870
Storage 320 gb Maxtor 750gb samsung f11 250gb hitachi
Display(s) IIyama e1900s
Case CoolerMaster Ammo
Audio Device(s) Asus Xonar D2/PM Pci
Power Supply Corsair 750w
Software Windows 7 x64
It would work in theory, yeah.
 

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.63/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
Just get an image that somewhat ressembles glass and turn the opacity of the form down to like 80%.
 
Top