Windows.h

Pages: 12
Hi. I have recently hit a spot where i need to use windows.h. It is for simulating keystrokes and other stuffs. Now the problem I face is for the statement
#include <windows.h>
it reports error that it is not found. So i checked it in the include file and it was not there. NOTE NOTE NOTE : I use TurboC++. So i downloaded a piece of code from net, saved it as windows.h in my include file. But after seeing inside windows.h i realized it just includes many other header files, all of which are not in my include directory... I checked in the net about this problem and I saw that there was solutions for Visual C++ and Dev-C++. But please tell me a solution for TurboC++ any version. Please post the link of where i should download all these windows libraries. Thanks in advance :)
By the way am just student learning c++ in school so i can't change to Dev-C++, even if TC++ is outdated :D
Last edited on
You might need to download the Windows SDK.
'
Windows 8 SDK : http://msdn.microsoft.com/en-US/windows/hardware/hh852363

Windows 7 SDK : http://www.microsoft.com/en-us/download/details.aspx?id=8279
Could you please explain what is SDK? What does installing it does?
Am downloading for windows 7. By the way, what is the .NET framework?
Last edited on
SDK stands for Software Development Kit. It is a collections of header files (like the one you are trying to get), scource files, and other files.

Installing it will mean that you have the Header files you need to work with
Windows API.


.NET is a programming framework created by Microsoft that developers can use to create applications more easily.A framework is just a bunch of code that the programmer can call without having to write it explicitly.
It's a capital 'w', problem solved XD
#include <Windows.h>
closed account (Dy7SLyTq)
no its not:
http://www.winprog.org/tutorial/start.html
I use Turbo C++

If you're talking about Borland's ancient, 16-bit compiler, then you really do need to switch to a new compiler. Why are you still stuck with Turbo C++ when there are better, free alternatives about?

For Windows, the choices are GCC (the MinGW version, with an IDE like Code::Blocks, CodeLite, ...) or Microsoft Visual Studio IDE with it's compiler.

Andy
I've used Dev-Cpp, MS-VC++10 and MS-VS12 and they all have the windows library header as "Windows.h" so I suppose you might as well give it a try
Last edited on
The Windows file system is case insensitive, so it doesn't matter what case the letters are when you include it. Unlike Linux.

#include <WinDoWs.H>

will also work.

Andy
Last edited on
closed account (Dy7SLyTq)
The Windows file system is case insensitive

forgot about that. of course i was already used to the linux way when i switched to windows so i still am in the habit of things being in the right case (when it matters idc much in the forum). i still use cd Desktop even though i could do cd desktop
The Windows file system is case insensitive


Are you talking about the compiler's preprocessor system or window's actual filing system because I'm pretty sure that I've had many an error thanks to the casing of one letter in my include statements!

EDIT: Hm, nevermind... Just tested this and it works anyway I want, I'm sure I've had times where it's not worked through casing though :/
Last edited on
closed account (Dy7SLyTq)
Are you talking about the compiler's preprocessor system

hes talking about the filesystem i hope. pre processors should be case sensitive
Lol i already mentioned... Am a student and just learning with Turbo C++ and dont want to switch to Dev-C++ or some other IDEs cause that helps me to get marks in xams and not get confused :D
I've had many an error thanks to the casing of one letter in my include statements

Well yes the thing inside the include's <> is always CASE INSENSITIVE... the place where we get error is typing the code as :
1
2
#Include <iostream.h>
#inlcude <iostream.h> 
No I don't think I've ever done that, perhaps I'm just confused with something else...
Or maybe the #include "file" is this way?

ANYWAYS... Back to the ops question!
Last edited on
hmm during SDK download for windows 7 its stuck on the part where it says "downloading" ... is there a problem in my computer or the download?
I also have the same problem..
I'm also using TurboC++ on Windows XP
Where I could download its SDK?
Where I could download its SDK?

Well, you usually obtain the Windows SDK from the Microsoft web site.

But, isn't Turbo C++ a 16-bit compiler? (=> see 2nd "Edit" just below...)

(Edit: which version of Turbo C++ are you using? And do you mean "Borland Turbo C++" or "Borland C++" ??)

(Edit: I see the Turbo C++ did make it to 32-bit... post version 3.0 (with the blue screen). So if you're using version 4.5 (with the grey screen) ??)

If it is, you have problems. The SDKs available from Microsoft only provide the libraires for 32-bit and 64-bit use. You need the SDK for 16-bit Windows, which isn't available for download via the usual route. (It might still be available to paid up MSDN subscribers, from the vaults, but I don't have access.)

To check whether your compile is building 16-bit exes, run an app and keep it running somehow.

Then open up Task Manager, find your app in the "Applications" list, right-click on it, and select the "Go to process". It your app is 16-bit, then the process you go to will be called ntvdm.exe rather than your own apps name.

(NTVDM is the Windows NT Virtual DOS Machine, which is a 32-bit process that hosts 16-bit app on 32-bit version of Windows
http://en.wikipedia.org/wiki/Virtual_DOS_machine )


Andy

PS This question has been raised again and again...

But why on earth does anyone use Turbo C++ these days when far better free alternatives exist? MinGW GCC plus a decent editor would be better!! (prob. with a professor/teacher provided build script/makefile to start with.)
Last edited on
Where I could download its SDK?

The latest release in version 8.0, but I'm using version 7.1 on my older machines. The latest version (for Windows 8) adds support for new "Metro style" apps which adds a bit of complexity, so might be best avoided for the moment.

The SDKs aways supports not only the version of Windows they were released for plus all older versions. To ensure you enable only the Windows features that Windows XP supports, you need to #define WINVER and _WIN32_WINNT before including windows.h

1
2
3
4
5
6
// 0x0501 is the version for Windows XP
#define WINVER 0x0501
#define _WIN32_WINNT 0x0501
#include <windows.h>

// etc 


For web install (you install using the web installer directly from the Microsoft website)

Microsoft Windows SDK for Windows 7 and .NET Framework 4
http://www.microsoft.com/en-gb/download/details.aspx?id=8279

For ISO install (you download the ISO image, burn a DVD, and install off the DVD)

Microsoft Windows SDK for Windows 7 and .NET Framework 4 (ISO)
http://www.microsoft.com/en-us/download/details.aspx?id=8442

Andy

PS For the latest release is 8.0

For web install

Windows Software Development Kit (SDK) for Windows 8
http://msdn.microsoft.com/en-us/library/windows/desktop/hh852363.aspx

(Couldn't find ISO install for version 8.0 ?)

There is also a preview release of 8.1, but you should only go for that if you need to use some brand new Windows 8 feature. As you're using Windows XP, that's not relevant here.
Last edited on
SwatSid wrote:
By the way am just student learning c++ in school so i can't change to Dev-C++, even if TC++ is outdated :D

Fk*n god change school, what the hell are they supposed to teach you, old stuff?
It's like teaching you how to make a wheel with your bare hands: It works but it's easy to break it and there are newer ways to do it.
And, even worse, it's USELESS, because you'll have to re-learn C++ once you're up-to-date because of the C++03 and C++11 standardized features (and C++14 soon).

Unless you actually plan to go further developing programs it's ok, but if you DO plan on going further, I suggest you to avoid using TC++.
Also, if you plan on getting Dev-C++, don't get the Bloodshed version, get the Orwell version which is continuing on getting updated, as the Bloodshed version is stuck.
If you plan on getting CodeBlocks instead, get it with MinGW included, easier for you to install.
Pages: 12