Here is an update of the code with some help from other people in other forums who know a bit more about windows functions.
#include <Windows.h>
#include <SFML/Graphics.hpp>
int main()
{
// (1) get the device context of the screen
// Definition: The CreateDC function creates a device context (DC)
// ..for a device using the specified name.
HDC hScreenDC = CreateDC(L"DISPLAY", NULL, NULL, NULL);
// (2) and a device context to put it in
// Definition: The CreateCompatibleDC function creates a memory
// ..device context (DC) compatible with the specified device.
HDC hMemoryDC = CreateCompatibleDC(hScreenDC);
// (3) Gets the users screen size in x and y dimensions
// Definition: The GetDeviceCaps function retrieves device-specific
// ..information for the specified device.
int x = GetDeviceCaps(hScreenDC, HORZRES);
int y = GetDeviceCaps(hScreenDC, VERTRES);
// (4) maybe worth checking these are positive values
// Definition: The CreateCompatibleBitmap function creates a bitmap
// ..compatible with the device that is associated with the specified
// ..device context.
HBITMAP hBitmap = CreateCompatibleBitmap(hScreenDC, x, y);
// (5) get a new bitmap
// Definition: The SelectObject function selects an object into the
// ..specified device context (DC). The new object replaces the previous
// ..object of the same type.
HBITMAP hOldBitmap = (HBITMAP)SelectObject(hMemoryDC, hBitmap);
// Definition: The BitBlt function performs a bit-block transfer of the
// ..color data corresponding to a rectangle of pixels from the specified
// ..source device context into a destination device context.
BitBlt(hMemoryDC, 0, 0, x, y, hScreenDC, 0, 0, SRCCOPY);
// Don't need this apparently
//hBitmap = (HBITMAP)SelectObject(hMemoryDC, hOldBitmap);
//////////////////////////////////////////////////////////////////////////////////
// Create the SFML Window
sf::RenderWindow window(sf::VideoMode(800, 600), "SFML works!");
// Load the bitmap from memory into texture
sf::Texture Texture;
Texture.loadFromMemory(hOldBitmap,sizeof(hOldBitmap));
// Load the texture into a sprite
sf::Sprite Sprite;
Sprite.setTexture(Texture);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.draw(Sprite);
window.display();
}
// clean up
DeleteDC(hMemoryDC);
DeleteDC(hScreenDC);
return 0;
}
Still crashes however when run... Though I think it is an SFML issue. However, I'm not confident that the Windows part is completely right either..