Red progressbar on Vista.

  • Thread starter Thread starter Sin Jeong-hun
  • Start date Start date
S

Sin Jeong-hun

Some system utilities such as Windows Backup on Windows Vista show RED
progress bars when something went wrong. Is this possible in C#
applications? As far as I know, the ForeColor property means nothing
when visual style is enabled. I tried to search Google, but nothing
came up with the keywords 'red progressbar vista'.
 
Thank you. But I cannot find the constant values for
PBM_SETSTATE
and
PBST_ERROR
.. Could you please tell me where I can find these values?
 
Sin Jeong-hun said:
Thank you. But I cannot find the constant values for
PBM_SETSTATE
and
PBST_ERROR
. Could you please tell me where I can find these values?


The header files are the only valid sources when calling C style API's. The PBM_SETSTATE
value is introduced with Vista, so you'll have to get a copy of the Windows SDK and search
the header that contains the PBM_SETSTATE constant (guess it's CommCtrl.h).

Willy.
 
I installed SDK for Vista, and searched the header file and found the
value. But this process is time consuming. I hope MDSN page would list
those constant values for non-VC++ languages. Anyways, here is the
code I've just written. I hope this could help those who want to do
the same thing. It worked fine on my PC. Thank you for your answers
all.

const int WM_USER=0x400;
const int PBM_SETSTATE=WM_USER+16;
const int PBST_NORMAL=0x0001;
const int PBST_ERROR=0x0002;
const int PBST_PAUSED=0x0003;

[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError =
false)]
static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr
wParam, IntPtr lParam);

SendMessage(ErrorPB.Handle,PBM_SETSTATE,
(IntPtr)PBST_ERROR,IntPtr.Zero);
 

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

Back
Top