1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

MSOFTCON Library help ..... for VC++

Discussion in 'Programming' started by mubashirnisar, Oct 24, 2009.

  1. #1
    hello friends,

    I'm using Microsoft visual c++ 2008 express edition .I want to use graphics in this compiler i helped from below link about usage of MSOFTCON Library ..

    http://www.tvdsb.on.ca/saunders/courses/online/ICS4M/Cplusplus/msconsole.htm

    but there is problem when i compile the code compiler give ma errors
    msoftcon.cpp(11) : error C2664: 'CreateFileW' : cannot convert parameter 1 from 'const char [8]' to 'LPCWSTR'
    Error showning in Image
    http://forums.digitalpoint.com/attachment.php?attachmentid=30421&stc=1&d=1256414073
    ///////////////////////////////////////init_graphics()//////////////////////////////////////
    void init_graphics()
    {
    COORD console_size = {80, 25};
    //open i/o channel to console screen
    hConsole = CreateFile("CONOUT$", GENERIC_WRITE | GENERIC_READ,// error C2664: 'CreateFileW' : cannot convert parameter 1 from 'const char [8]' to 'LPCWSTR'
    FILE_SHARE_READ | FILE_SHARE_WRITE,
    0L, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0L);
    //set to 80x25 screen size
    SetConsoleScreenBufferSize(hConsole, console_size);
    //set text to white on black
    SetConsoleTextAttribute( hConsole, (WORD)((0 << 4) | 15) );

    fill_char = '\xDB'; //default fill is solid block
    clear_screen();
    }


    //////////////////////////////////////////////Main.cpp////////////////////////////////////////////////
    #include <iostream>
    #include"msoftcon.h"

    using namespace std;

    int main ( )
    {
    color foreground, background;//variables to set colour scheme
    int x1,y1,x2,y2;
    //radius,height; // variables for x/y co-ordinates

    foreground = cBROWN;
    background = cDARK_BLUE;
    x1 = 11;
    y1 =11;

    init_graphics( );
    clear_screen( );
    set_color(foreground, background);
    set_cursor_pos(x1, y1);
    cout << "hello";

    x1 = 10;
    y1 = 10;
    x2 = 16;
    y2 = 12;

    draw_rectangle(x1,y1,x2,y2);
    return 0;
    }


    please reply me???
     

    Attached Files:

    Last edited by a moderator: Oct 24, 2009
    mubashirnisar, Oct 24, 2009 IP