Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm getting this error: Error C2039: '_InitNetworkAddressControl' : is not a member of 'CShellWrapper' on this code...and I can't figure it out, any help appreciated. Thanks.

C++
#include "stdafx.h"
#include "afxwin.h"
#include <wtsapi32.h>
#include <iostream>
#include <iphlpapi.h>

#pragma comment(lib,"wtsapi32.lib")
 
using namespace std;
 
int main()
{
        DWORD pCount = 0; 
	PWTS_PROCESS_INFO ppProcessInfo,pProcess;
	WTSEnumerateProcesses(WTS_CURRENT_SERVER_HANDLE,0,1,&ppProcessInfo,&pCount);
	pProcess = ppProcessInfo;
        CString internet = "iexplore.exe";
 
	for(int i = 0; i < int(pCount); i++)
	{
		pProcess->pProcessName;
		if (internet.CompareNoCase ( pProcess->pProcessName) == 0)
		{
			cout<< "iexplore running";
		}
		pProcess++;
	}
}
Posted
Updated 9-Sep-11 9:22am
v3
Comments
TRK3 9-Sep-11 17:29pm    
The code itself looks fine. I even pasted it into a new console app in VS2008 and it compiled fine. The problem must be in a header file and/or compiler command line switches. Works for me with:

/Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /D "_AFXDLL" /Gm /EHsc /RTC1 /MDd /Yu"stdafx.h" /Fp"Debug\test.pch" /Fo"Debug\\" /Fd"Debug\vc90.pdb" /W3 /nologo /c /ZI /TP /errorReport:prompt

Does the compiler give you a file and line number for that error? Are you compiling with different switches than the above?
Member 7766180 9-Sep-11 18:22pm    
I'm using VS 2010, Win 7. Using UNICODE, MFC Shared dll. Console. I'm not sure about the switches, I'm new to this. The error is happening in afxcomctl32.inl on this line...SHELL_AFXCTXFUNC (BOOL, InitNetworkAddressControl,(void),()) Red underline SHELL_AFXCTXFUNC only.
TRK3 9-Sep-11 19:05pm    
My best guess would be there is a preprocessor symbol defined somewhere in a way that's incompatible with the latest include files.

Can you post the contents of stadfx.h? (And if it references targetver.h -- then post those contents.)

In my test that worked fine the only thing that is defined in those files is:

#define __WIN32_WINNT 0x0600 // minimum platform is Windows Vista

It's not uncommon to have a bunch of things defined in stdafx.h that cause the compiler to skip including a bunch of stuff that isn't normally needed. It may be in your case you actually need it.
Member 7766180 9-Sep-11 19:22pm    
stadfx.h
#pragma once

#include "targetver.h"

#include "stdio.h"
#include "tchar.h"

targetver.h
#pragma once

#include <sdkddkver.h>
TRK3 9-Sep-11 19:13pm    
Another thing you might try is to look at what the preprocessor is generating. (If you right click on your project and select "Properties" and the go to "Configuration Properties -> C/C++ -> Preprocessor" and change "Generate Preprocessed File" to "Yes", it will create a file a file containing the preprocessor output -- basically the actual input to the compiler -- and you'll be able to see how that line is actually being expanded by the preprocessor and then the error will probablly be a lot clearer.)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900