Transperent
-
komisch ey irgentiwe ist das nicht das gelbe von ei !!

TUTS NICHT :
19 C:\Dev-Cpp\main.cpp `LWA_ALPHA' undeclared (first use this function)
19 C:\Dev-Cpp\main.cpp `SetLayeredWindowAttributes' undeclared (first use this function)
bor ey meine ****** was mach ich den falsch ????

-
pofix schrieb:
bor ey meine ****** was mach ich den falsch ????

ganz einfach: du liest nicht richtig bzw. liest überhaupt nicht und blendest vor deinem auge mancha posts einfach aus. ich hab dir doch bereits geschrieben, was du brauchst. wenn er LWA_ALPHA nicht kennt - dann musst du es eben selbst definieren. und diesen code habe ich dir bereits gepastet -.-
und wenn er SetLayeredWindowAttributes nicht kennt, dann musst du entweder erstmal nen SDK update machen oder versuchen, dir die Adresse der Funktion aus der user32.dll zu holen - dazu hab ich dir bereits auch hints gegeben.
augen auf und rtfm
-
Hast du das aktuelle PSDK? Wenn nein dann siehe den ersten (angepinnten) Post hier im WinApi Forum.
schirrmie
-
Damit wirst du etwas glücklicher:
-
so ich hab das teil jetzt gerade gebogen aber nun ein link error[Linker error] undefined reference to `SetLayeredWindowAttributes(HWND__*, unsigned long, unsigned char, unsigned long)'
-
user32.lib linken
(langsam beginne ich TGGC immer besser zu verstehen...)
-
Hey @ll.
Ich habe folgendes:
HWND sendButton, myWnd; #define bmSend 1 LPARAM lParam; HICON sendIconsendButton = CreateWindowEx( WS_EX_TRANSPARENT, "BUTTON", "Senden", BS_ICON | BS_FLAT | WS_CHILD | WS_VISIBLE, 250, 245, 100, 25, myWnd, (HMENU)bmSend, ((LPCREATESTRUCT)lParam)->hInstance, NULL );Sieht ganz schön schlecht aus, also will ich nen Icon drauflegen
if( 0 != sendButton ) SendMessage( sendButton, BM_SETIMAGE, IMAGE_ICON, (LPARAM)sendIcon );Ist OK, aber den übergebliebenen bereich vom Button, würde ich gerne Transparent machen.
brauche ich dazu unbedingt
CreateWindowEx(WS_EX_LAYERED,...);denn wenn ich das dahinschreibe geht es nach dem create in die else von
#define F04 err[3]if( 0 != sendButton ) { SendMessage( sendButton, BM_SETIMAGE, IMAGE_ICON, (LPARAM)sendIcon ); if( 0 == SetLayeredWindowAttributes( sendButton, 0, 255, 2 ) ) printf( "%d\n", GetLastError() ); } else { MessageBox( NULL, F04, appTitle, MB_ICONERROR | MB_SETFOREGROUND ); endProg = true; }err[3] ist eine Fehlermeldung.
Warum das ganze... Ich schreibe eine GUI für eine Konsolenanwendung, und die ist eigentlich fertig, aber da ich eh gerne sowas wissen würde und es ewig brauchen werde, dachte ich ich teste es an diesem Tool mal.
Ahso,
warum ich überhaupt poste: consolenausgabe ist "87" was "The parameter is incorrect." entspricht...
Ich habe mir gedacht das liegt an "SetLayeredWindowAttributes" weil ich ja im CreateWindowEx nicht einen Layered style verwende ?!Kann mir da auch wer helfen?
-
ICH HAB DES RÄTELS LÖSUNG :WindowTransparency (hwnd,220);!!!
#include <Windows.h> typedef BOOL (WINAPI TRNZ) ( HWND hwnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags ); typedef TRNZ* TRANSPARENCY; BOOL WindowTransparency ( HWND hwnd, BYTE bAlpha ) { HINSTANCE hCommonDLL; TRANSPARENCY WndTrcy; if ( NULL == ( hCommonDLL = LoadLibrary ( "user32.dll" ) ) ) { return false; } WndTrcy = ( TRANSPARENCY ) GetProcAddress ( hCommonDLL, "SetLayeredWindowAttributes" ); SetWindowLong ( hwnd, (-20), GetWindowLong ( hwnd, (-20) ) | 0x80000 ); WndTrcy ( hwnd, RGB( 255, 255, 255 ), bAlpha, 2 ); return true; } /* Declare Windows procedure */ LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM); /* Make the class name into a global variable */ char szClassName[ ] = "WindowsApp"; int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nFunsterStil) { HWND hwnd; /* This is the handle for our window */ MSG messages; /* Here messages to the application are saved */ WNDCLASSEX wincl; /* Data structure for the windowclass */ /* The Window structure */ wincl.hInstance = hThisInstance; wincl.lpszClassName = szClassName; wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */ wincl.style = CS_DBLCLKS; /* Catch double-clicks */ wincl.cbSize = sizeof (WNDCLASSEX); /* Use default icon and mouse-pointer */ wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION); wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION); wincl.hCursor = LoadCursor (NULL, IDC_ARROW); wincl.lpszMenuName = NULL; /* No menu */ wincl.cbClsExtra = 0; /* No extra bytes after the window class */ wincl.cbWndExtra = 0; /* structure or the window instance */ /* Use Windows's default color as the background of the window */ wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND; /* Register the window class, and if it fails quit the program */ if (!RegisterClassEx (&wincl)) return 0; /* The class is registered, let's create the program*/ hwnd = CreateWindowEx ( 0, /* Extended possibilites for variation */ szClassName, /* Classname */ "Windows App", /* Title Text */ WS_OVERLAPPEDWINDOW, /* default window */ CW_USEDEFAULT, /* Windows decides the position */ CW_USEDEFAULT, /* where the window ends up on the screen */ 544, /* The programs width */ 375, /* and height in pixels */ HWND_DESKTOP, /* The window is a child-window to desktop */ NULL, /* No menu */ hThisInstance, /* Program Instance handler */ NULL /* No Window Creation data */ ); /* Make the window visible on the screen */ ShowWindow (hwnd, nFunsterStil); WindowTransparency (hwnd,220); /* Run the message loop. It will run until GetMessage() returns 0 */ while (GetMessage (&messages, NULL, 0, 0)) { /* Translate virtual-key messages into character messages */ TranslateMessage(&messages); /* Send message to WindowProcedure */ DispatchMessage(&messages); } /* The program return-value is 0 - The value that PostQuitMessage() gave */ return messages.wParam; } /* This function is called by the Windows function DispatchMessage() */ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) /* handle the messages */ { case WM_DESTROY: PostQuitMessage (0); /* send a WM_QUIT to the message queue */ break; default: /* for messages that we don't deal with */ return DefWindowProc (hwnd, message, wParam, lParam); } return 0; }
-
Troll

-
Popoklopfer schrieb:
Troll

an die wand mit ihm

-
Bist du Dieter Nuhr? Neh dafür war der eigentlich zu schlecht

Hatte schon gehofft, aber naja...
Gibbet da ehrlich nichts?? Ich mein wie wird das mit jedem normalen button gemacht?
In PHP reichts wenn ich nen Bild drauflege was in Transparent verläuft, ok man kann immernoch in den transparenten bereich klicken, aber das könnte man ja in WinAPI abfragen...