|
I want to verify internet connection from my application in VC++.
(Is it or not ?)
How ?
|
|
|
|
|
|
Hi Progman!
Try this small function:
long MyView::IsConnected()
{
unsigned long ulConnectionFlags = 1;
return InternetGetConnectedState(&ulConnectionFlags ,0);
}
To be sure you can add an attempt to open a site but I don’t think it is necessary.
You must add the #include "WININET.H" line and WININET.lib to your project.
|
|
|
|
|
If using a modem use:
RasEnumConnections(..) fn
and check for to see if the number of connection is > 0.
If checking to see if LAN is present then Ping a url.
I avoid InternetGetConnectedState(..) because it is not dynamic. ie Pull the LAN connection out of the wall and your icon on you computer shows it is disconnected but the InternetGetConnectedState(..)fn won't track it!
Art
|
|
|
|
|
i Have a few Wav resources in my VC++ project. And i want to merge it into one Wav file.
how can i do it ?
|
|
|
|
|
|
I'm outputting WAV resources in that way (in the loop) :
hWav=FindResource(AfxGetResourceHandle(),MAKEINTRESOURCE(ui_res),"WAVE");
HGLOBAL hPtrDataWav;
hPtrDataWav=LoadResource(AfxGetResourceHandle(), hWav);
sndPlaySound((LPCTSTR)hPtrDataWav,SND_MEMORY|SND_ASYNC );
May be possible to record THIS sound into the file ?
How ?
|
|
|
|
|
I know one way - using GINA. We can write Gina, export appropreate functions for winlogon as it is written in MSDN and the task is solved. The disadvantages is:
-We need the rights to write down in HKEY_LOCAL_MACHINE;
-Our GINA could be overriten by another one;
-If something goes wrong, user cannot login at all and has to reinstall the system.
Is it possible to solve this problem, hooking the keyboard events before they occured in winlogon.exe or take them directly from the keyboard ports or drivers?
Appreciate any suggestions
|
|
|
|
|
what is the name of your application? i want to make sure i never install something that tries to disable ctrl-alt-del, for any reason.
-c
Image tools: ThumbNailer, Bobber, TIFFAssembler
|
|
|
|
|
Do not be so suspicious. It should be done to protect parents from any occasional actions of their children.
|
|
|
|
|
Valera241176 wrote:
It should be done
i disagree. i think it should never be done. there are certain basic functions of Windows that are essential. ctrl-alt-del is one of them.
-c
Image tools: ThumbNailer, Bobber, TIFFAssembler
|
|
|
|
|
I agree with Chris. I was surprised looking over some
of my bathroom reading materials that the JAN 2002
edition of Windows:: Developer has in big bold letters
at the top of the cover "Disabling Ctrl+Alt+Delete on
Win NT/2000". What were they thinking?
|
|
|
|
|
I need that, without that I would not be able to program under windows...
I create programs that are used to move machine prototypes (www.tamelectromecanica.com), if I can't prevent the user to modify anything in the OS, the machine would not be as safe as it should...
1. My OS loads automatically and loads automaitcally my apps.
2. I have a System wide keyboard and mouse hook in order to prevent something to be done whilst the application is being loaded and when it is loaded also.
3. I must avoid the user to be able to exit my app.
4. I need to be able to avoid Ctrl Alt Del in order to prevent the user to shut down the PC in an incorrect way, to load any other app. or to do anything that would not be allowed for the right care of the machine.
I'm agree that in most cases handling this is stupid and that could be used in order to write viruses and other things, but in my case, its needed...
NOTE:
Imagine that one of those machines would cost 300000$, and that one user gets fired, if the user knows anything about computers, he/she could make the machine crash and it would be a great pain for the machine owner.
|
|
|
|
|
to Joan Murt:
Is it just the cosiderations about "is is good or bad to block ctrl+alt+del" or you have some original solution?
I would be appreciate very much if you share this solution.
Sorry for my bad english.
|
|
|
|
|
That was only a consideration, but in order to keep the security in the OS, the only way to do it in NT based OSes is using a GINA.DLL...
Is needed to do it in that way: that cannot be reached from any program in order to prevent malintetioned users to capture passwords and so on...)
At least this is what I know...
Hope this helps.
|
|
|
|
|
InMSDN I've found the descriptions of the following bugs, which may occur when using third-party GINA.dll:
System Policies May Not Work with Third-Party GINA DLLs
ID: Q163215
· Loss of Desktop After Logon When Using a Filter Gina.dll
ID: Q189290
· Access Violation in Winlogon with Third-Party Gina.dll
ID: Q180854
MSDN tells to download ne SP(NT 4.0 Service Pack (4.0)).
Do you know about them, and how to take care with them better (except prompting user to download this SP)?
Any suggestions?
|
|
|
|
|
Sorry, but as I make numerical control machines, I can choose the OS that the industrial PC has installed, then I use Win2k and I don't have this problem.
I don't know nothing about that, but if we think about the program requirements... you can require the SP4 to be installed in order to let your app. to run.
If you are writting a legal app. this shouldn't be a problem, and I'm not sure about that, but in your installation you should be able to check it and you should be able to launch the sp4 installation (I think it's legal to redistribute the sp's (I'm not sure about this last sentence)).
Hope this helps.
|
|
|
|
|
|
Thank you a lot for such an information! I'll try it out.
|
|
|
|
|
I can not get my Toolbar.bmp (256 colors) to display proprerly. I am using Brent Corkum's http://www.codeproject.com/menu/bcmenu.asp?forumid=150&select=170880[^] XP toolbar and Menu class.
I am so disparate, I am making my whole MDI project/workspace (VC++ 6.0 sp5) available to download just so I can solve this problem.
I am thinking about making this years version of JoeSwammi MLB free anyway because I am not to pleased with my progress. Please no comments about my coding habits/logic
The program will not work for you because there are many elements that are taking care of with the installation script which is not necessary to solve my problem.
1) You will need Speech SDK 5.1(69606 KB).
http://download.microsoft.com/download/speechSDK/SDK/5.1/WXP/EN-US/SpeechSDK51.exe[^]
although it is not totally necessary, if you wish to eliminate all the corresponding code and project settings to get it to compile. This is not related to my toolbar problem
2) run this registry entry[^](this is normally done by the installation program) it is not necessary but you will get an error upon execution of program but you will be able to see to messed up tool bar.
3) Download my workspace/project[^].
you may have to manual paste in your browser to get the file to download. It is encrypted .zip file
this is the key to unlock
(note my CP notifications have been quite delayed lately so I must manually check and see who responded )
thanks a whole lot. Hopefully it is just something stupid I am missing.
ps. this message will self destruct in a day or two.;P
pps. I just edited it not deleted it. Thanks!! MAAK!!
Later, JoeSox www.joeswammi.com The only thing that saves us from the bureaucracy is inefficiency. An efficient bureaucracy is the greatest threat to liberty.
Eugene McCarthy
|
|
|
|
|
As I understand, your problem is that the 256 colors toolbar bitmap is shown using only 16 colors. If that is the problem then this is the solution.
Firstly add your 256 toolbar bitmap as a bitmap resource, let its ID be IDB_MYTOOLBAR .
Then in the CMainFrame class (or the Child Frame class if it's a child's toolbar) declare an image list object, let it be CImageList m_ToolBarImages , after doing that go to the CMainFrame::OnCreate and write this code after the creation of the toolbar.
m_ToolBarImages.Create(16, 15, ILC_COLOR8 | ILC_MASK, 3, 3);<br>
CBitmap bmp;
bmp.LoadBitmap(IDB_MYTOOLBAR);<br>
m_ToolBarImages.Add(&bmp, RGB(192, 192, 192));<br>
m_wndToolBar.GetToolBarCtrl().SetImageList(&m_ToolBarImages);
This code should set 8bits or even 24bits buttons to the toolbar with no further procedure, hope it could help you.
|
|
|
|
|
you don't even know how much sleep I have lost over this!
Thank you!! it works great!!
Later, JoeSox www.joeswammi.com The only thing that saves us from the bureaucracy is inefficiency. An efficient bureaucracy is the greatest threat to liberty.
Eugene McCarthy
|
|
|
|
|
1. string s1 = "First", s2 = "Second".
How can I append the strings in a way that s1 is partially overwritten. for example: s1.append(s2, 1) ===> "FSecond.
s1.append(s2, 3) ===> "FirSecond".... Something like that
2. I must comment - Manipulating strings in C++ is quite hard in comparison to Java. A good API reference may considerably help on this issue. I couldn't find my way in MSDN Can you recommend an alternative? (does CodeProject have one to offer? )
|
|
|
|
|
First declare variables:
CString s1="First";
CString s2="Second";
s1=s1.Left(3) + s2;
A. Riazi
|
|
|
|
|
I have done this:
struct s_Person{
char Letter1 : 10,
Letter2 : 10,
Letter3 : 12;
}Person[5];
What I want to do is have a string of 4 chars ( which is 32 bits ), and set the first 10 BITS of the string to be letter 'a' or something else...
The struct fails because it says that the field types are too small.
How do I put a character(or characters) into the first 10 bits of a string of 4 lenght??
Also, if the data field is only 10 bits, which is 2 chars + 2 bits, the maximum I could actually fit into Letter1 would be 2 letters..Is this right??
Thanks,
grahamoj.
|
|
|
|