GetContrast and SetContrast Ce 6



Hi Community
Can anyone help with GetContrast and SetContrast.
I have made something in vb.

<Runtime.InteropServices.DllImport("coredll.dll")> _
Private Shared Function CreateDC(ByVal lpszDriver As String, ByVal
lpszDevice As String, _
ByVal lpszOutput As String, ByRef deviceMode As IntPtr) As IntPtr
End Function
Declare Function ExtEscape Lib "coredll" Alias "ExtEscape" (ByVal
hdc As IntPtr, _
ByVal nEscape As Int32, _
ByVal cbInput As Int32, _
ByVal plszInData As Integer(), _
ByVal cbOutput As Int32, _
ByVal lpszOutData As IntPtr) As Int32
Const CONTRASTCOMMAND As Integer = 6149
Const CONTRAST_CMD_GET As Integer = 0
<Runtime.InteropServices.DllImport("coredll.dll")> _
Private Shared Function ReleaseDC(ByVal Hwnd As IntPtr, _
ByVal hdc As IntPtr) As Integer
End Function
Public Property Kontrast() As Long
Dim vpm(1) As Integer
vpm(1) = 0
Dim Wert As Integer = 10
Dim hdc As Integer
hdc = CreateDC("ddi.dll", 0, 0, 0)
Wert = ExtEscape(hdc, CONTRASTCOMMAND, 8, vpm,
Integer.MaxValue, Wert)
ReleaseDC(0, hdc)
Return Wert
End Get
Set(ByVal value As Long)

End Set
End Property

But it always return 0 what shuld I do , have anyone an example in vb
or c#

Thanks Tim

Paul G. Tobey [eMVP]

"It" always returns zero? What exactly returns zero? The ExtEscape call?
Are you sure that the get and set contrast operations are supported in your
display driver?

Paul T.

Chris Tacke, eMVP

I've not seen a device that even used or needed contrast in some time - it
was typically used in passive monochrome displays. Contrast typically makes
no sense and can't be changed on an active display (which most devices use
today). Even on the older stuff, the contrast was often adjusted through a
proprietary API or even a physical pot on the board. Have you verified with
the OEM that they even support contrast adjustment? Also, checking the last
Win32 error is a worthwhile thing to consider any time an API call fails.


Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question