L
bzw. wenn du die Funktion ohne klasse nutzen willst muss sie über der Funktione stehn in der sie das erste mal aufgerufen wird.
BOOL SetWindowTransparency(HWND hWnd, int nPercentage)
{
int nTrans = ((nPercentage*255) / 100);
BOOL bSet = ::SetLayeredWindowAttributes(hWnd, NULL, nTrans, LWA_ALPHA);
if(bSet == 0) return FALSE;
BOOL bSetPos = SetWindowPos(hWnd, hWnd, NULL, NULL, NULL, NULL, SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOSIZE | SWP_NOZORDER);
if(bSetPos == 0) return FALSE;
return TRUE;
}
void Cfader::OnBnClickedButton2()
{
HWND parentyy = ::FindWindow(NULL, "Rechner");
SetWindowTransparency(parentyy,40);
}