merci Darksidious de ta reponse, j' ai trouver comment faire mais en fait ce que je voulais dire c' est:
que il n' y a que des exemples avec mfc, et cela est très déroutant, car je n' ai pas l' habitude de travailler "graphiquement"!
je poste la source que j' ai fait grace a la fonction d' anthraxx(http://www.cppfrance.com/code.aspx?ID=10721)
le fichier bmptorgn contient la fonction d' anthraxx
et resource.h contien #define ID_BUTTON 100
il faut créer un fichier c:\skin.bmp pour le skin la couleur transparente est le noir,
#include "resource.h"
#include <math.h>
#include "bmpTOrgn.cpp"
HBRUSH hbr;
char szappname[] = "Rondeur";
LRESULT CALLBACK AppWndProc(HWND hwnd, UINT mssg, WPARAM wParam, LPARAM lParam)
{
static HBITMAP hBitmap ;
HINSTANCE hInstance ;
HDC hDC;
HDC hdcMem ;
PAINTSTRUCT paintst;
switch(mssg) {
case WM_CREATE:
hInstance = ((LPCREATESTRUCT) lParam)->hInstance ;
hBitmap = (HBITMAP)LoadImage(hInstance,"c:\\skin.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE|LR_DEFAULTSIZE);
if (!hBitmap)MessageBox (NULL, "Erreur", "erreur", MB_OK);
SetWindowRgn(hwnd,BmpToRgn(hBitmap, 0), FALSE);
return 0 ;
case WM_PAINT:
hDC=BeginPaint(hwnd,&paintst);
if (!hBitmap) {
MessageBox (NULL, "Erreur 2: Impossible de redessiner la fenetre", "erreur", MB_OK);
}
else {
hdcMem = CreateCompatibleDC(hDC);
SelectObject (hdcMem, hBitmap) ;
BitBlt (hDC, 0, 0, 800, 600, hdcMem, 0, 0, SRCCOPY) ;
DeleteDC (hdcMem) ;
}
EndPaint(hwnd,&paintst);
return 0;
case WM_KILLFOCUS:
return 0;
case WM_KEYDOWN:
if(wParam == VK_ESCAPE) PostMessage(hwnd, WM_CLOSE, 0, 0l);
break;
case WM_DESTROY:
PostQuitMessage(0);
}
return DefWindowProc(hwnd, mssg, wParam, lParam);
}
int WINAPI InitInstance(HINSTANCE hinst)
{
HBITMAP hBitmap;
//GetStockObject(NULL_BRUSH) pour background.
WNDCLASS wndclass;
hbr = (HBRUSH) GetStockObject (NULL_BRUSH);
memset(&wndclass, 0, sizeof(WNDCLASS));
wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
wndclass.lpfnWndProc = AppWndProc;
wndclass.hInstance = hinst;
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);
wndclass.hbrBackground = hbr;
wndclass.lpszClassName = szappname;
return RegisterClass(&wndclass);
}
int WINAPI WinMain(HINSTANCE hinst, HINSTANCE, PSTR, int)
{
MSG msg;
if(!InitInstance(hinst)) return 0;
HWND hwnd = CreateWindow(szappname, 0,
WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS,
0, 0, 800, 600, 0, 0, hinst, 0);
HWND cmdhWnd = CreateWindowEx(0, "BUTTON", "", /*WS_VISIBLE*/|WS_CHILD|BS_PUSHBUTTON|BS_NOTIFY|BS_TEXT,508, 48, 27, 21, hwnd, (HMENU)ID_BUTTON, hinst, NULL);// pour cliquer sur la croix et que ca ferme
if(!hwnd) return 0;
ShowWindow(hwnd, SW_SHOW);
UpdateWindow(hwnd);
SetWindowText(cmdhWnd, "x");
// Met à jour le bouton
UpdateWindow(cmdhWnd);
// Donne le focus au bouton
//SetFocus(cmdhWnd);
while(GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
DarkBoss