User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 375,200 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,227 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser:
Views: 640 | Replies: 12
Reply
Join Date: Mar 2008
Location: UK
Posts: 240
Reputation: williamhemswort has a spectacular aura about williamhemswort has a spectacular aura about 
Rep Power: 2
Solved Threads: 31
williamhemswort's Avatar
williamhemswort williamhemswort is offline Offline
Posting Whiz in Training

Re: Mouse Click

  #11  
May 10th, 2008
Not only that, most people think that it is entirely impossible to do graphics in console applications. Heres the proof againts that:

#define _WIN32_WINNT 0x0500
#include<windows.h>
#include<iostream>
using namespace std;

int main() {
	HWND console = GetConsoleWindow();
	HDC hdc = GetDC(console);
	SelectObject(hdc, CreatePen(0, 30, RGB(255,255,255)));
	POINT p;
	GetCursorPos(&p);
	ScreenToClient(console, &p);
	MoveToEx(hdc, p.x, p.y, NULL);
	for (;;) {
		GetCursorPos(&p);
		ScreenToClient(console, &p);
		LineTo(hdc, p.x, p.y);
		Sleep(1);
	}
	ReleaseDC(console, hdc);
	cin.ignore();
	return 0;
}
Reply With Quote  
Join Date: May 2008
Posts: 78
Reputation: n1337 is on a distinguished road 
Rep Power: 1
Solved Threads: 7
n1337 n1337 is offline Offline
Junior Poster in Training

Re: Mouse Click

  #12  
May 10th, 2008
how very interesting...

I suppose my point was only that, why would you want to detect a mouse click if only using a text-based console...Hence why I would have never considered exploring the subject on a console...

Thanks for that will!
Reply With Quote  
Join Date: Mar 2008
Location: UK
Posts: 240
Reputation: williamhemswort has a spectacular aura about williamhemswort has a spectacular aura about 
Rep Power: 2
Solved Threads: 31
williamhemswort's Avatar
williamhemswort williamhemswort is offline Offline
Posting Whiz in Training

Re: Mouse Click

  #13  
May 10th, 2008
Well, programs used to always be made in console windows for example, Turbo C++ from before I was born would have fully text based menus and therefore need to be able to detect the cursor positions and mouse clicks.

http://www.weiqigao.com/blog/images/turbo-cpp.png
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb C++ Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the C++ Forum

All times are GMT -4. The time now is 2:38 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC