Ive posted this on another forum, and haven't gotten very far. I had a few skillful coders give it a go, and no luck.
We got errors...

I'm trying to make a console app... Transparent, or translucent. (See-through)
Ive tried:

#include <iostream>
#define _WIN32_WINNT 0x0500
#include <windows.h>
using namespace std;
int main()
{
    HWND hWnd = GetConsoleWindow();
    SetConsoleTitle("Test");
    SetWindowLong(hWnd, GWL_EXSTYLE,
    GetWindowLong(hWnd, GWL_EXSTYLE) | WS_EX_LAYERED);
    SetLayeredWindowAttributes(hWnd, 0, 50, LWA_ALPHA);
    system("PAUSE");
    return 0;
}

And got:

K:\Computers\C++ stuff\C++ Projects\Untitled1.cpp:21: Error 5
K:\Computers\C++ stuff\C++ Projects\Untitled1.cpp:23: Error 87

Any idea's as to if it's possible?
Thanks guys. :)

~BRADSZY~

which line is 21 and 23?

#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;
}

That was the error checking code...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.