Here is my code, I want to get the coordinate of the mouse position:

#include <iostream>
#include <string>
//#include "WinDef.h"
//#include "stdafx.h"
#include <windowsx.h>
#include <windows.h>
#include <atltypes.h>

using namespace std;

int main() {
	DWORD pos = GetMessagePos();
	CPoint pt(LOWORD(pos), HIWORD(pos));
	return 0;

But I could get it compiled through, below is the error information I got:

c:\documents and settings\yayang\my documents\visual studio 2008\projects\test2\test2\yyh2.cpp(7) : fatal error C1083: Cannot open include file: 'atltypes.h': No such file or directory

Does anyone help me? I am new to C++. Thanks!

Recommended Answers

All 3 Replies

Which compiler are you using? VC++ Express versions don't have the MFC or ATL components.

Yes, it is VC++ express version. Then what header file I need to add under this version for solving this problem?


I think you'll have to move up to a full version of Visual Studio (Standard or higher).

If you're a university student, see if your school participates in the Microsoft Developer Network Academic Alliance (MSDNAA).

Be a part of the DaniWeb community

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