From: spam116 on
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
Get
Dim vpm(1) As Integer
vpm(0) = CONTRAST_CMD_GET
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
From: "Paul G. Tobey [eMVP]" p space tobey no spam AT no instrument no spam DOT on
"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.

<spam116(a)googlemail.com> wrote in message
news:77457219-e351-40b0-ad48-b346594ba3fd(a)t54g2000hsg.googlegroups.com...
> 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
> Get
> Dim vpm(1) As Integer
> vpm(0) = CONTRAST_CMD_GET
> 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


From: Chris Tacke, eMVP on
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
http://community.OpenNETCF.com


<spam116(a)googlemail.com> wrote in message
news:77457219-e351-40b0-ad48-b346594ba3fd(a)t54g2000hsg.googlegroups.com...
> 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
> Get
> Dim vpm(1) As Integer
> vpm(0) = CONTRAST_CMD_GET
> 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