|
You could check out the source of my Bluetooth remote control written in C++/MFC. It uses modified MFC CAsyncSocket to listen to Bluetooth connections.
|
|
|
|
|
Hello,
I am VC++/MFC developer. First of all I wanted to know is there any way in windows to block website. Suppose I wanted to block Facebook.com.
Secondly, I wanted to create one application that will block listed website. Suppose I have list of website with me viz; Google.com, orkut.com, Microsoft.com. I want to write application which can block these website.
Thanks in advance.
|
|
|
|
|
There are couple of things i can think off.
1. put sites url to a ini file for example then use API for working with inifiles (write / read profilestring)
2. get a list from ini file and resolve each site's ip
3. put then these ips into C:\Windows\System32\drivers\etc\hosts file and redirect to localhost for example
4. write a driver to disable write permissions on that file (you need to hook ntwritefile and some more)
5. that still will not block apps, which use custom resolver (anyways, most of apps use gethostbyname).
Or, maybe, detect network threads, then inject own thread into them and block access to a site on that level.
011011010110000101100011011010000110100101101110
0110010101110011
|
|
|
|
|
csrss wrote: There are couple of things i can think off.
1. put sites url to a ini file for example then use API for working with inifiles (write / read profilestring)
2. get a list from ini file and resolve each site's ip
3. put then these ips into C:\Windows\System32\drivers\etc\hosts file and redirect to localhost for example
4. write a driver to disable write permissions on that file (you need to hook ntwritefile and some more)
5. that still will not block apps, which use custom resolver (anyways, most of apps use gethostbyname).
Or, maybe, detect network threads, then inject own thread into them and block access to a site on that level.
Hi,
I have added following line @ hosts file
66.220.146.11 www.facebook.com
but still facebook is running.
|
|
|
|
|
It should be:
127.0.0.1 www.facebook.com
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
The simple solution is having a program that modifies the hosts file, and gives the blocked domains an invalid IP address.
The normal solution in a corporate network is to setup a filter on the gateway to the Internet.
|
|
|
|
|
Rolf Kristensen wrote: The normal solution in a corporate network is to setup a filter on the gateway to the Internet.
Can you please give me steps how should I filter gateway?
|
|
|
|
|
The gateway is a seperate computer working as router, that includes its own software for configuring DNS lookups and firewall.
Usually the router provides a web-browser interface that allows one to configure it. Not something you would do through a MFC application.
|
|
|
|
|
Consult your gatway OS manual.
Every product is different!
2 bugs found.
> recompile ...
65534 bugs found.
|
|
|
|
|
I am trying to access shared memory on an ISA bus card, under Windows XP. Is there any simple way to do this in C? I would be working in VS6 since I have it installed on a spare machine, I have not done any real software work for years.
I had a similar problem years ago, where I wanted to access I/O ports on an ISA bus card, and found InpOut32.dll which provides direct port access under Windows XP. Wonderful stuff. But is there anything similar that allows physical memory access?
From what I remember, there should be no problem if I run under Windows 95 or 98, right? Just set a pointer to the address I want and read or write freely, or does Win95 / Win98 protect some memory areas?
I'd hate to have to dig up MSVC 1.52C, to compile the program for DOS!
|
|
|
|
|
I try to make an CComboBoxExt derived from CCOmboBox . In
void CComboBoxExt::OnEditchange()
{
CString sText;
GetDlgItemText(this?,sText);
ShowDropDown();
}
I try to retrive the text that user entered in combobox , and if text is not empty show drop down list , if is empty then hide drop down list .. but I stuck on GetDlgItemText method : how can I retrieve the text that user entered ? Can you help me please ? Thank you !
|
|
|
|
|
To retrieve text from the edit box of the CComboBox, use GetWindowText() . To retrieve text from the listbox, use GetLBText() .
|
|
|
|
|
|
I have Visual Studio 2008 at work but I must admit I've only used it for C# applications so far. I ported a reasonably large MFC app (from Visual C++ 2003) to it a few months back as a proof of concept and realized some important features of ATL were removed for webservices and regular expressions. I hacked around to get it to compile and the experience was somewhat painless (except for the regular expressions omissions off course).
However, I've not really toyed with in C++ beyond that and I'm looking to purchase a personal copy of Visual Studio 2008 (or 2010 but the reviews for 2010 seem pretty bad and I like to stay a step behind the leading edge for IDE's) and I wanted to ask those of you who have beat Visual C++ 2008 up a bit to see if you feel like Visual Studio 2008 was a good investment.
Specifically looking for opinions from those who still prefer to utilize MFC/ATL shared libraries for collection classes, CString, etc... as opposed to the C++ standard library equivalents.
thanks in advance.
|
|
|
|
|
I have ported many apps from VS6 to VS2008 for my clients. No major gotchas, and using VS2008 for x64 development presents no problems either.
VS2010 is an entirely different story. Extremely slow startup times, several crashes during the day, and, of course, a help system that is near totally useless (I use google instead). VS2010 is not worth it, unless there are features you really need.
To be honest, I have found that MS has fixed numerous bugs in the MFC Feature Pack stuff in VS2010. But most of my clients hate the ribbon interface, so I'm not sure if that is a major benefit.
|
|
|
|
|
I agree about the ribbon interface since the 16:9 aspect ratios of contemporary monitors tend to make vertical screen real estate ever more precious.
Thanks for taking the time to share your thoughts. It is much appreciated.
|
|
|
|
|
I would probably wait for VS2010 Service Pack 1 to arrive, and see if it fixes the things for VS2010. I think over time you will be developing more .NET applications, and the improved WPF designer and .NET 4.0 will be good to have.
VS2008 without Service Pack also had a lot of bugs.
|
|
|
|
|
I agree, SP1 will help VS2010 a lot. I've been using the SP1 Beta with no problems and it's help viewer is waaaay better.
If you use STL, VS2010 is much nicer with the elements of C++0x they've included so that's definitely better than VS2008.
I've not experienced the slow startup times others mention so I think some of that's tied to your h/w such as RAM.
John
|
|
|
|
|
I've used VS2008 for C++ with MFC extensively and really like it. Probably one of the best C++ IDEs to work with. It does have SP1 out so watch for that specially if you're using it within Win Vista or 7 (there are frequent compilation errors that get fixed with SP1). I've used Studio 6, 2003, 2005, and 2008. This is the best one yet. With that said, haven't used VS2010.
|
|
|
|
|
I'm using XP Professional at home and at work but I'm guessing we can't hold out much longer. I've only tested our compiled products (before releasing to production) on Vista and Windows 7 and had not had a chance to test any versions of Visual Studio on either OS yet so your comments are helpful and encouraging.
I did some searching before I posted and have been watching any comments made on 2008 and 2010 over time but I couldn't quite get a good handle on the C++ experience as so many are using C# to pay the bills these days.
Thanks for taking time out to share your thoughts.
|
|
|
|
|
Another thing to keep in mind: VS2008 and VS2010 work fine on Win7; I have them both installed on my Win7x64 system.
However, VS6 and VS2005 will not install on Win7. To use these, you have to set up a VM (like VMWare).
|
|
|
|
|
ouch! I'm glad you passed that on as I was debating a new home workstation to go along with Visual Studio 2008 and I couldn't make up my mind if I wanted the Windows 7 Professional with option to revert to XP that some stores offer. I might choose to downgrade Windows 7 to XP Professional since I have a ton of VC++ 2003 code that I honestly don't want to migrate as those programs will just die a natural slow death over time. However, in the meantime, I need to support them and will need Visual Studio 2003 installed.
I have finally got myself free of needing VC++ 6.0 but I must admit to still using it's MSDN more when looking up topics that didn't change much over the years.
thanks again.
|
|
|
|
|
I've been using Win7 for a little over a year and never want to go back to XP. Get yourself a nice VM like VMWare and map the hard drive with your dev sources. This has worked perfectly for me. I think there's a nice free VM (VirtualBox?) but I haven't tried it.
It's funny what you said about MSDN. I couldn't install VS6 on Win7, but I could install MSDN 2003, and I usually have it open on my second monitor.
I also have a macro that I use from within VS2008 that opens the Microsoft MSDN site inside a window in VS2008. Much, much faster than the builtin help.
I have converted 100's of projects from VS2005 to VS2008 with no problems. Just make a backup, and let VS2008 convert them.
|
|
|
|
|
Sure, just don't forget to install SP1, otherwise you'll be cursing the day you read my review of the product.
I use C++ extensively and I compile the same code (huge multi-project applications) on both XP Pro on my work computer and my home Win7 computer. One of my Junior Engineers uses Win Vista to work on the same code. So it does work and Win7 is WAYYYYY better than Vista! ...I do keep multiple OS's around in case I need it and for testing.
|
|
|
|
|
If you are a native code developer, the last "well packaged" version for C++ was VS2005 + SDK2003R2.
You get all what you need for native apps, plus all the native API documentation.
2008 version miss the most of the native documentation, and introduces the WPF (but with an interface that is very low performant, respect to 2005).
2010 has a pretty C++0x standard compiler, but the product around it tends to be a huge bloat.
If you are looking for a standard compiler and a IDE far less "bloated" consider MinGW as a compiler and Codeblock, Codelite or Qt-creator as an IDE.
If you need MFC, ATL etc. or all the .Net stuff, consider SharpDevelop (for C#).
2 bugs found.
> recompile ...
65534 bugs found.
|
|
|
|