|
well it all depends on how the user has access to the net. If you are at an office with a network connection then their internet access is routed through a proxy (a computer which connects to the T1 and disperses the connection to all the other computers).
I think we may be confused here, what does this have to do with coding, and what are the specifics of the network?
the easiest way to keep someone from getting on the net is to unplug their network connection
-dz
|
|
|
|
|
Well it sounds like an useless app that I'm doing!
I don't want my "self connecting apps" that want to check for updates to check for their updates.. and then I want to block the internet access so they don't...
And some more reasons for why I'm ask for this...
Rickard Andersson@Suza Computing
ICQ#: 50302279 (Add me!)
E-mail: nikado@pc.nu
I'm from the winter country SWEDEN!
|
|
|
|
|
ZoneAlarm may be what you're looking for. www.zonelabs.com.
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
Yes!
But I want to do it myself.. in my app...
Rickard Andersson@Suza Computing
ICQ#: 50302279 (Add me!)
E-mail: nikado@pc.nu
I'm from the winter country SWEDEN!
|
|
|
|
|
Rickard Andersson wrote:
Is there a way to block all internet acces on a computer??
You can add a rule at the firewall to deny all packets to/from that machine's IP address
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Yes but I want to do it in my app!
Hooow!
Rickard Andersson@Suza Computing
ICQ#: 50302279 (Add me!)
E-mail: nikado@pc.nu
I'm from the winter country SWEDEN!
|
|
|
|
|
I guess that would require you to listen to every single request going through port 80 (assuming they check for updates through the http port), determine if the request is for an IP you don't want, and if so somehow blocking it.. i don't have a clue about how to do this at all so ill shut up now
the easiest thing would be just to install some IP sniffing software and look to see what IP address the software is trying to access.. then install a firewall and block access to that IP.. like nish said.
good luck in whatever your trying to do
-dz
|
|
|
|
|
Okay!
Then it was a little bit harder to do than I thought!
Rickard Andersson@Suza Computing
ICQ#: 50302279 (Add me!)
E-mail: nikado@pc.nu
I'm from the winter country SWEDEN!
|
|
|
|
|
My CTreeCtrl uses checkboxes. When a user checks / unchecks a box I would like to do some error checking on what was just checked and uncheck it if I don't want the user to have it checked.
TVN_SELCHANGED is only called when the highlighting is changed, and NM_CLICKED is called before the checkbox is updated (so if something was just checked it is still considered unchecked when this message is thrown).
Is there a way to call a function whenever the checkboxes are updated? Is there a way to keep an item from being checked (either at the time of adding it to the tree, or when it is checked) ?
any insight would be great! I have heard ppl mention using timers which can run such procedures every 100ms or something, this could be a possibility for me, is this hard to do, examples?
thanks!
-dz
|
|
|
|
|
There are other ways i think, but i got around this by simply subclassing the tree and overriding WM_LBUTTONDOWN . You can use CTreeCtrl::HitTest() to determine what bit of what item was clicked on; just watch for TVHT_ONITEMSTATEICON and you're good to go. Just use !GetCheck(hItem); to determine if it will be checked.
---Shog9---
From now on we can call C# and MC++ "The square wheel languages" -- Jack Handy, The Lounge
|
|
|
|
|
thanks for the suggestion so your saying i need to create my own class which is derived from CTreeCtrl right? ill give it a try!
thanks again!
-dz
|
|
|
|
|
Good luck. If you hit any snags, just ask.
---Shog9---
From now on we can call C# and MC++ "The square wheel languages" -- Jack Handy, The Lounge
|
|
|
|
|
I want to write a function that return CList and items in CList is CString .I declare it in these two way but I get some errors.
CList FindFile(LPCTSTR directorypath);
CList<cstring ,="" cstring&=""> FindFile(LPCTSTR directorypath);
What is the correct way for it?
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
I would return a CList* rather than the CList to prevent the entire list from being copied into a temporary variable, you will simply return the address of the CList.
Also, is there a problem in your declaration of the CList that you are using, I think that there may be a CStringList class that you can use that is predefined in MFC.
One more suggestion is to possibly think about dumping the inferior Micorsoft containers and switching to STL.
Good luck!
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
kilowatt wrote:
I think that there may be a CStringList class that you can use that is predefined in MFC.
Now I use this one,But I get error in the RETURN statement of my function:
error C2558: class 'CStringList' : no copy constructor available or copy constructor is declared 'explicit'
Any Suggestion?
Thanks
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
return "CStringList *" or "CStringList &"
-c
The ants are my friends. They're blowing in the wind.
|
|
|
|
|
Thanks
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
If you are trying to return a CList as opposed to a CList*, you're going to have trouble. You have two choices here:
1. Send in the address of or a reference to the CList like so:
BOOL FindFile( LPCTSTR directorypath, CListCList<TYPE_LIST>* list )
{
}
CList<TYPE_LIST> myList;
if( !FindFile( "bob.txt", &myList ) )
{
}
or
BOOL FindFile( LPCTSTR directorypath, CList<TYPE_LIST>& list )
{
}
CList<TYPE_LIST> myList;
if( !FindFile( "bob.txt", myList ) )
{
}
2. The other way you can do this is by creating your CList with new inside the function like this:
CListCList<TYPE_LIST>* FindFile( LPCTSTR directorypath )
{
CListCList<TYPE_LIST>* myList = new CListCList<TYPE_LIST>();
.
.
.
return myList;
}
CList<TYPE_LIST>* list = FindFile( "bob.txt" );
.
.
.
list->RemoveAll();
delete list;
You must call delete on the list if you do it this last way or you'll have a memory leak.
Hope this helps.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
Thank you very much Matt.It is very helpful.
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
I was under the impression that you usually use extern "C" when you are trying to access code in other languages from C++..but I have also noticed that extern "C" is used sometimes within C++ to call various functions especially in a lot of DLLs..
For instance, the other day I came across a piece of code where you had a dialog resource in one separate DLL project and an MFC Doc/View exe in another project. Now, one of the dialogs opened by the the MFC Doc/View was in the resource DLL and in order to establish a link between these two, the following task was done:
there was a extern "C" function which was created in a separate C++ within the MFC Doc/View project. Inside of the function, there was a call made to certain method in certain class within this project. Also, in the header file for that class, this function was defined as extern "C".
Next, an event handler in the resource DLL was built and it would make a reference to this extern "C" function.
|
|
|
|
|
Is your question what is extern "C" for?
All that extern "C" does, is instructs the compiler to not include namemangling in the symbols that it creates for that function, variable or whatever. This will allow dlls from other languages to more easily access the functions.
Normally the compiler adds decorations to the names in order to allow function overloading in C++. IF you trun off name mangling, then you will not be able to over load your functions. That is the drawback.
Good Luck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
hi,
look at this:
"ULONG PacketGetAdapterNames(PTSTR pStr, PULONG BufferSize)
Usually, this is the first function that should be used to communicate with the driver. It returns the names of the adapters installed on the system in the user allocated buffer pStr. After the names of the adapters, pStr contains a string that describes each of them."
suppose that in my machine I'he several adapters, hwo I use pStr to get those names?
|
|
|
|
|
My guess would be:
<br />
TCHAR caBuffer[ 4096 + 1 ];<br />
DWORD dwBufSize = 4096;<br />
<br />
PacketGetAdapterNames( caBuffer, &dwBufSize );<br />
caBuffer[ 4096 ] = _T( '\0' );<br />
Peace!
-=- James.
"Fat people are hard to kidnap."
(Try Check Favorites Sometime!)
|
|
|
|
|
1. How to programatically (VC++) find out the network default settings on a machine, if it's DialUp or LAN
2. How to find out if the connection is "ON", i.e the computer is connected ? That is either the DIalUp is on, or the LAN is active???
many thanks..
Hawk
|
|
|
|
|
1. Lee Hamel's article Retrieving NIC information using SNMP queries gives you the means to retrieve the list of IP interfaces installed on the machine. Please note interfaces can coexist both for LAN and Dial-up.
2. For LAN interfaces, there's no easy way to know if the machine is actually connected (meaning by that that the cable is plugged in.) There's a way to do it in Win2000, but the thing is messy. As for Dial-up interfaces, simply check whether the IP address is valid: when not connected, it is 0.0.0.0.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|