I did this
Code:
#include <stdio.h>
#define _WIN32_WINNT 0x0500
#include <windows.h>
#define CHECK_ERROR(x) if (!x) error(__FILE__, __LINE__, GetLastError())
void error(const char *file, int line, int err)
{
printf("%s:%d: Error %d\n", file, line, err);
}
int main()
{
LONG lRet;
HWND hWnd = GetConsoleWindow();
CHECK_ERROR(hWnd);
SetConsoleTitle("Test");
lRet = SetWindowLong(hWnd, GWL_EXSTYLE,
GetWindowLong(hWnd, GWL_EXSTYLE) | WS_EX_LAYERED);
CHECK_ERROR(lRet);
lRet = SetLayeredWindowAttributes(hWnd, 0, 50, LWA_ALPHA);
CHECK_ERROR(lRet);
system("PAUSE");
return 0;
}
It would help to do something like:
Code:
#include <stdio.h>
#define _WIN32_WINNT 0x0500
#include <windows.h>
#define CHECK_ERROR(x, name) if (!x) error(__FILE__, __LINE__, name, GetLastError())
void error(const char *file, int line, const char *name, int err)
{
printf("%s:%d: Error on %s: %d\n", file, line, name, err);
}
int main()
{
LONG lRet;
HWND hWnd = GetConsoleWindow();
CHECK_ERROR(hWnd, "GetConsoleWindow");
...
--
Mats