Hi and Thanks
is it works for you on ppc 2003 and change the background brightness ?
(make it darker and lighter)?
Hello,
Many thanks to Sergey Bogdanov, the next code is working for me :
[DllImport("coredll")]
extern static IntPtr GetDC(IntPtr hWnd);
[DllImport("coredll")]
extern static void ReleaseDC(IntPtr hWnd, IntPtr hDC);
[DllImport("coredll")]
extern static int ExtEscape(IntPtr hDC, int Esc, int cbInData, int []
InData, int cbOutData, IntPtr OutData);
private void btnMinus_Click(object sender, System.EventArgs e)
{
IntPtr hDC = GetDC(IntPtr.Zero);
int[] vpm = new int[2];
vpm[0] = CONTRAST_CMD_DECREASE;
vpm[1] = 3; // decrease with this value
int r = ExtEscape(hDC, CONTRASTCOMMAND, 8, vpm, 0, IntPtr.Zero);
ReleaseDC(IntPtr.Zero, hDC);
}
private void btnDefault_Click(object sender, System.EventArgs e)
{
IntPtr hDC = GetDC(IntPtr.Zero);
int[] vpm = new int[2];
vpm[0] = CONTRAST_CMD_DEFAULT;
vpm[1] = 0;
int r = ExtEscape(hDC, CONTRASTCOMMAND, 8, vpm, 0, IntPtr.Zero);
ReleaseDC(IntPtr.Zero, hDC);
}
private void btnPlus_Click(object sender, System.EventArgs e)
{
IntPtr hDC = GetDC(IntPtr.Zero);
int[] vpm = new int[2];
vpm[0] = CONTRAST_CMD_INCREASE;
vpm[1] = 3; // increase with this value
int r = ExtEscape(hDC, CONTRASTCOMMAND, 8, vpm, 0, IntPtr.Zero);
ReleaseDC(IntPtr.Zero, hDC);
}
private void btnSet_Click(object sender, System.EventArgs e)
{
IntPtr hDC = GetDC(IntPtr.Zero);
int[] vpm = new int[2];
vpm[0] = CONTRAST_CMD_SET;
vpm[1] = 75; // value to set between 0 and 256
int r = ExtEscape(hDC, CONTRASTCOMMAND, 8, vpm, 0, IntPtr.Zero);
ReleaseDC(IntPtr.Zero, hDC);
}
private void btnGet_Click(object sender, System.EventArgs e)
{
IntPtr hDC = GetDC(IntPtr.Zero);
int[] vpm = new int[2];
vpm[0] = CONTRAST_CMD_GET;
vpm[1] = 0;
int r = ExtEscape(hDC, CONTRASTCOMMAND, 8, vpm, 0, IntPtr.Zero);
textBox1.Text = r.ToString(); //does r returns Zero? If so then the
device
capabilitie of
//this function was not implemented by an OEM.
ReleaseDC(IntPtr.Zero, hDC);
}
Kind regards,
Peter
"Shaul" <
[email protected]> schreef in bericht
thanks the thread is very usefull but I didnt secceed to change the
background brightness with it.
what parameter I need to change?
code from thread:
...
const int CONTRASTCOMMAND = 6149;
const int CONTRAST_CMD_GET = 0; // Parm=Ignored, Out=Current
setting
const int CONTRAST_CMD_SET = 1; // Parm=NewSet, Out=Resulting setting
const int CONTRAST_CMD_INCREASE = 2; // Parm=Amount, Out=Resulting
setting
const int CONTRAST_CMD_DECREASE = 3; // Parm=Amount, Out=Resulting
setting
const int CONTRAST_CMD_DEFAULT = 4; // Parm=Ignored, Out=Resulting
setting
const int CONTRAST_CMD_MAX = 5; // Parm=Ignored, Out=Max value
...
[DllImport("coredll")]
extern static void ReleaseDC(IntPtr hWnd, IntPtr hDC);
[DllImport("coredll")]
extern static IntPtr ExtEscape(IntPtr hDC, int Esc, int cbInData, int[]
InData, int cbOutData, IntPtr OutData);
[DllImport("coredll")]
private static extern IntPtr GetDC(IntPtr hwnd);
...
(the button function
...
IntPtr hDC = GetDC(IntPtr.Zero);
int[] vpm = new int[2];
vpm[0] = CONTRAST_CMD_SET;
vpm[1] = 0;
ExtEscape(hDC, CONTRASTCOMMAND, 8, vpm, 0, IntPtr.Zero);
ReleaseDC(IntPtr.Zero, hDC);
...
check this thread - maybe it will be usefull: