Hejsa.
nogen der kan sige mig hvorfor jeg får disse fejl:
error C2065: 'WS_EX_LAYERED' : undeclared identifier
error C2065: 'SetLayeredWindowAttributes' : undeclared identifier
error C2065: 'LWA_Alpha' : undeclared identifier
her er min kode:
<pre>
// Custom Window.cpp : Defines the entry point for the application.
//
#define _WIN32_WINNT 0x0500
#include "stdafx.h"
#include <windows.h>
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_PAINT:
break;
case WM_KILLFOCUS:
break;
case WM_COMMAND:
break;
case WM_CLOSE:
DestroyWindow(hwnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
return 0;
}
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
WNDCLASSEX wc;
HWND hwnd;
MSG Msg;
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = 0;
wc.lpfnWndProc = WndProc;
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 = "MSN DeskTop";
wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
if(!RegisterClassEx(&wc))
{
MessageBox(NULL, "Window Registration Failed!", "Error!",
MB_ICONEXCLAMATION | MB_OK);
return 0;
}
hwnd = CreateWindowEx(
WS_EX_CONTROLPARENT,
"MSN Desktop", //Angiver vores klasse navn
"MSN Desktop", //Titlen på vores vindue
WS_POPUP, //Angiver at det er et normalt vindue vi vil lave (dette er en sammentrækning af en masse styles)
0, //Vælg en standard x poisition til vinduet
0, //Vælg en standard y poisition til vinduet
250, //Bredden på vinduet
500, //Højden på vinduet
NULL, //Vi har ingen ejer af vinduet
NULL, //Ingen menu
hInstance, //Handleren til .exe filen
NULL);
/* HRGN hRegion = CreateRoundRectRgn(0,0, 220,260,15,15);
SetWindowRgn(hwnd, hRegion, true);
SetLayeredWindowAttributes(hwnd, 0, 170, LWA_Alpha);
*/
SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_ASYNCWINDOWPOS);
SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_CAPTION);
LONG OldState = GetWindowLong(hwnd, GWL_EXSTYLE);
LONG NewState = OldState | WS_EX_LAYERED | WS_EX_TRANSPARENT | WS_EX_TOOLWINDOW;
SetWindowLong(hwnd, GWL_EXSTYLE, NewState);
SetLayeredWindowAttributes(hwnd, 0, 0, LWA_Alpha);
UpdateWindow(hwnd);
ShowWindow(hwnd, nCmdShow);
while(GetMessage(&Msg, NULL, 0, 0) > 0)
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
//DeleteObject(hRegion);
return Msg.wParam;
}
</pre>
- SpeC|DK - #SpeC.DK @ Q-NET
26 svar postet i denne tråd vises herunder
0 indlæg har modtaget i alt 0 karma