Click here to Skip to main content
15,888,401 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Recieving a Namespace Error on this code....
8 IntelliSense: name followed by '::' must be a class or namespace name c:\fbcode\winmeover\winmeover\winmeover.cpp 7 30 WinMeOver

// WIN 7 WFP //
#include "stdafx.h"
#include <netfw.h>

int _tmain(int argc, _TCHAR* argv[])
{
typedef BOOL (*RuleCallback)(fw::INetFwRulePtr& Rule);
void ListRules(RuleCallback Callback); 
{ 
   HRESULT hr; 
   // Connect to the firewall 
   fw::INetFwPolicy2Ptr Pol2; 
   hr = Pol2.CreateInstance(__uuidof(fw::NetFwPolicy2)); 
   if(Pol2 == NULL) 
         return;
   // Retrieve collection rules 
   fw::INetFwRulesPtr Rules = Pol2->Rules; 
   if(Rules == NULL) 
         return;
   // enumerate the collection and call a callback function 
   ULONG num; 
   VARIANT obj; 
   IEnumVARIANTPtr enumerator = Rules->Get_NewEnum(); 
   while(enumerator->Next(1, &obj, &num) == S_OK) 
   { 
         fw::INetFwRulePtr Rule = obj; 
         if(!Callback(Rule)) 
               return; 
   } 
}

	return 0;
}

</netfw.h>
Posted

1 solution

I believe you haven't done the #import here.
#import is what gives you the smart pointers suffixed with Ptr.
#import Directive (C/C++)[^]
 
Share this answer
 
Comments
Member 7766180 20-Jul-11 13:34pm    
Thank you.

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