-4

I'm using Visual Studio 6 for backward compatibility reasons and I need to use GetAncestor() like this to create a dll :

HWND ancestorhandle = GetAncestor(myvar, 2);

I've included these header files:

#include <windows.h>
#include "stdafx.h"
#include "offlinelib.h"
#include <stdio.h>

As per the documentation:

GetAncestor function

But while compiling, I get an error:

GetAncestor: Undeclared identifier

What am I doing wrong?

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
user994572
  • 139
  • 1
  • 11

2 Answers2

0

Try moving the #include "stdafx.h" (precompiled header) up, making it the first include line.

Mr.C64
  • 41,637
  • 14
  • 86
  • 162
  • I still get the same error after your suggested change: See here for the complete code http://pastebin.com/UA931nJu – user994572 Jul 17 '15 at 18:49
0

Solved by adding

#ifdef WINVER
#undef WINVER
#endif
#define WINVER 0x500

on top of stdafx.h

user994572
  • 139
  • 1
  • 11
  • It would be better to set the `WINVER` value in your project settings instead of in your code. But in any case `WINVER` should already be set to `0x500` (win2K) by default, so something else in your project is setting it to a lower value or `#undef`ing it, so you should find that something and remove that instead. – Remy Lebeau Jul 18 '15 at 00:30
  • You should delete the question. It's pointless. This answer shows why. It's only relevant to code that only you can see. – David Heffernan Jul 18 '15 at 04:32