VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Get current resolution,number of colors and bits/pixels using GetDeviceCaps API

by Karthikeyan (187 Submissions)
Category: Windows API Call/Explanation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Thu 1st November 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Get current resolution,number of colors and bits/pixels using GetDeviceCaps API

API Declarations


Const HORZRES = 8 ' X axis in pixels
Const VERTRES = 10 ' Y axis in pixels
Const BITSPIXEL = 12 ' Number of bits per pixel


Rate Get current resolution,number of colors and bits/pixels using GetDeviceCaps API



Dim x, y, bp, ncol As Long
x = GetDeviceCaps(Me.hdc, HORZRES)
y = GetDeviceCaps(Me.hdc, VERTRES)
MsgBox "Current Resolution is " & x & " X " & y & " Pixels"
bp = GetDeviceCaps(Me.hdc, BITSPIXEL)
MsgBox "Current Resolution has " & bp & " Bits / Pixels"
ncol = 1
For i = 1 To bp
ncol = ncol * 2
Next
MsgBox "Number of Colors is " & ncol
End
End Sub

Download this snippet    Add to My Saved Code

Get current resolution,number of colors and bits/pixels using GetDeviceCaps API Comments

No comments have been posted about Get current resolution,number of colors and bits/pixels using GetDeviceCaps API. Why not be the first to post a comment about Get current resolution,number of colors and bits/pixels using GetDeviceCaps API.

Post your comment

Subject:
Message:
0/1000 characters