From: Nhat Dung on
Hello,
I create progressbar and process it WM_PAINT and it look fine. However on
the system that doesn't apply "visual styles" the progressbar seem have a
border. And paint does only inside that border.
How to remove that border ?

From: nico on
Nhat Dung wrote:
> Hello,
> I create progressbar and process it WM_PAINT and it look fine. However
> on the system that doesn't apply "visual styles" the progressbar seem
> have a border. And paint does only inside that border.
> How to remove that border ?

Could you show a picture ?
Have you checked if the control has border style (WS_BORDER)?
From: Nhat Dung on
No, the control only have WS_CHILD or WS_VISIBLE style.
I uses CreateWindowExW with "msctls_progress32" class and WS_CHILD or
WS_VISIBLE style, Ex style = 0

preview :
http://f.imagehost.org/0583/progress_bar.png

here is the code

#include <windows.h>
#include "commctrl.h"

#pragma comment(lib,"comctl32.lib")

HWND pb1;
HINSTANCE g_hinst;

LRESULT CALLBACK WindowProc (HWND, UINT, WPARAM, LPARAM);

// **********
// Windows Main Function.
// - Here starts our demo program
int WINAPI WinMain ( HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow )
{
HWND hwnd;
MSG msg;

WNDCLASS wc;
g_hinst = hInstance;
wc.style = CS_HREDRAW|CS_VREDRAW;
wc.lpfnWndProc = WindowProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor (NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH) (COLOR_WINDOW+1);
wc.lpszMenuName = NULL;
wc.lpszClassName = L"test";

RegisterClass (&wc);

hwnd = CreateWindow (L"test",L"test",WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,
0,0,hInstance,0);

ShowWindow (hwnd,nCmdShow);
UpdateWindow (hwnd);

while (GetMessage(&msg,0,0,0))
{
TranslateMessage (&msg);
DispatchMessage (&msg);
}

return msg.wParam;
}

void * pb_old_proc;
LRESULT CALLBACK ProgressBarWindowProc
(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
if (message == WM_PAINT)
{
HBRUSH hbr = CreateSolidBrush(RGB(255, 0, 0));
PAINTSTRUCT ps;
HDC dc = BeginPaint(hwnd, &ps);
FillRect(dc, &ps.rcPaint, hbr);
DeleteObject(hbr);
return 0;
}
if (message == WM_ERASEBKGND) return 1;
return CallWindowProcW((WNDPROC)pb_old_proc, hwnd, message, wParam,
lParam);
}
// **********
// Main Window Procedure.
// - Processes Window Messages
LRESULT CALLBACK WindowProc
(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HDC hdc;
PAINTSTRUCT ps;

switch (message)
{
case WM_CREATE:
InitCommonControls();
pb1 = CreateWindowEx(0, PROGRESS_CLASS, (LPTSTR) NULL, WS_CHILD |
WS_VISIBLE,
10, 10, 400, 18, hwnd, (HMENU) 0, g_hinst, NULL);
pb_old_proc = (void *) GetWindowLong(pb1, GWL_WNDPROC);
SetWindowLong(pb1, GWL_WNDPROC, (LONG) &ProgressBarWindowProc);
return 0;
case WM_PAINT:
hdc=BeginPaint (hwnd,&ps);
EndPaint (hwnd,&ps);
return 0;
case WM_DESTROY:
PostQuitMessage (0);
return 0;
}
return DefWindowProc (hwnd,message,wParam,lParam);
}




From: Christian ASTOR on
On 29 jan, 04:10, "Nhat Dung" <nhatd...(a)hotmail.com> wrote:
> No, the control only have WS_CHILD or WS_VISIBLE style.
> I uses CreateWindowExW with "msctls_progress32" class and WS_CHILD or
> WS_VISIBLE style, Ex style = 0

Remove WS_EX_STATICEDGE ext. style if you don't want it...