LVM_GETHOTITEM not declared in this scope?

Questions about programming languages and debugging
Post Reply
User avatar
Gogeta70
^_^
^_^
Posts: 3275
Joined: 25 Jun 2005, 16:00
18

LVM_GETHOTITEM not declared in this scope?

Post by Gogeta70 »

I'm trying to make a program that won't show up in the windows task manager, but when i try to send a message to the windows task manager's process list, my program won't compile. Here's the relevant code:

Code: Select all

//Headers:
#include <windows.h>
#include <string>
#include <sstream>
#include <commctrl.h>

//enumchildwindows callback function:

BOOL CALLBACK RemList(HWND hwnd, LPARAM lParam)
{
	char Buff[30];
	GetClassName(hwnd, Buff, 30);

	std::string chk = Buff;
	if(chk.substr(0, 13) == "SysListView32")
	{
		int count = SendMessage(hwnd, LVM_GETHOTITEM, 0, 0);
		//int count = ListView_GetHotItem(hwnd);
		std::string tst = int2str(count);
		MessageBox(0, tst.c_str(), "test", 0);
		Sleep(3000);
		return FALSE;
	}
	return TRUE;
}

And this is the compiler error:
error: 'ListView_GetHotItem' was not declared in this scope

I have also added commctrl32.a to the linker settings... What's wrong?
¯\_(ツ)_/¯ It works on my machine...

User avatar
Lundis
Distorter of Reality
Distorter of Reality
Posts: 543
Joined: 22 Aug 2008, 16:00
15
Location: Deadlock of Awesome
Contact:

Re: LVM_GETHOTITEM not declared in this scope?

Post by Lundis »

http://msdn.microsoft.com/en-us/library/aa926274.aspx" onclick="window.open(this.href);return false;

Looks like it takes two arguments.

User avatar
Gogeta70
^_^
^_^
Posts: 3275
Joined: 25 Jun 2005, 16:00
18

Re: LVM_GETHOTITEM not declared in this scope?

Post by Gogeta70 »

No, i'm not trying to use the function, i'm trying to send the LVM_GETHOTITEM message to another window, but it's saying that LVM_GETHOTITEM was not declared in that scope...
¯\_(ツ)_/¯ It works on my machine...

User avatar
leetnigga
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 447
Joined: 28 Jul 2009, 16:00
14

Re: LVM_GETHOTITEM not declared in this scope?

Post by leetnigga »

gogeta70 wrote:No, i'm not trying to use the function, i'm trying to send the LVM_GETHOTITEM message to another window, but it's saying that LVM_GETHOTITEM was not declared in that scope...
commctrl.h defines the constant. It seems like something is going wrong with including it, or the constant is not defined in the commctrl.h you have. Check where it's being included from, if at all.

User avatar
Gogeta70
^_^
^_^
Posts: 3275
Joined: 25 Jun 2005, 16:00
18

Re: LVM_GETHOTITEM not declared in this scope?

Post by Gogeta70 »

In my commctrl.h, it is defined on line 1158. :/
¯\_(ツ)_/¯ It works on my machine...

User avatar
leetnigga
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 447
Joined: 28 Jul 2009, 16:00
14

Re: LVM_GETHOTITEM not declared in this scope?

Post by leetnigga »

Then the file isn't being included, or the definition is wrapped in some #IF statement. What command is being run to compile the program? Is the directory of commctrl.h in the list of include directories?

User avatar
Gogeta70
^_^
^_^
Posts: 3275
Joined: 25 Jun 2005, 16:00
18

Re: LVM_GETHOTITEM not declared in this scope?

Post by Gogeta70 »

leetnigga wrote:Then the file isn't being included, or the definition is wrapped in some #IF statement. What command is being run to compile the program? Is the directory of commctrl.h in the list of include directories?
I am using the code blocks IDE, so i don't know what commands it sends to the compiler. I have it configured to use mingw. As for the definition, the if statement it is wrapped in is as follows:

Code: Select all

#if (_WIN32_IE >= 0x0300)
#define LVM_APPROXIMATEVIEWRECT (LVM_FIRST+64)
#define LVM_SETEXTENDEDLISTVIEWSTYLE (LVM_FIRST+54)
#define LVM_GETEXTENDEDLISTVIEWSTYLE (LVM_FIRST+55)
#define LVM_SETCOLUMNORDERARRAY (LVM_FIRST+58)
#define LVM_GETCOLUMNORDERARRAY (LVM_FIRST+59)
#define LVM_GETHEADER (LVM_FIRST+31)
#define LVM_GETHOTCURSOR (LVM_FIRST+63)
#define LVM_GETHOTITEM (LVM_FIRST+61)
#define LVM_GETSUBITEMRECT (LVM_FIRST+56)
#define LVM_SETHOTCURSOR (LVM_FIRST+62)
#define LVM_SETHOTITEM (LVM_FIRST+60)
#define LVM_SETICONSPACING (LVM_FIRST+53)
#define LVM_SUBITEMHITTEST (LVM_FIRST+57)
#endif
And yes, commctrl.h is in the list of include directories.
¯\_(ツ)_/¯ It works on my machine...

User avatar
leetnigga
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 447
Joined: 28 Jul 2009, 16:00
14

Re: LVM_GETHOTITEM not declared in this scope?

Post by leetnigga »

Try this definition before the #include of commctrl.h:

Code: Select all

#define _WIN32_IE 0x0300
Though I'd think it would be defined elsewhere. Maybe it's less than 3. Try printing it, too (without that #define above).

Post Reply