|
jn4u wrote: Is std::string more neutral to the character set?
sadly, no. there is a std::wstring variation to handle wide char strings.
|
|
|
|
|
Can i change the code copy to the szVer in a better way that does not use wsprint. Just want the format.
xx.xx.xx.xx
|
|
|
|
|
You should use TCHAR for your array and _stprintf() to fill it. In that way you can compile for ANSI or Unicode without the need to change your source.
Binding 100,000 items to a list box can be just silly regardless of what pattern you are following. Jeremy Likness
|
|
|
|
|
Is there a way to prevent the user from logging off from their Windows account while my application is running?
|
|
|
|
|
Is WM_QUERYENDSESSION of any help?
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Yea thanks, I had forgotten about that mesage and it did the trick.
Thanks again 
|
|
|
|
|
Method for XP or earlier is slightly different from Vista/Win7 from my experience.
For XP or earlier, return 0 for WM_QUERYENDSESSION and this should be enough.
For Vista/Win7, I haven't found a way to entirely stop logging off. But temporarily blocking logging off is possible. I would return 1 for WM_QUERYENDSESSION and register a blocking reason during WM_ENDSESSION, by calling ShutdownBlockReasonCreate. Then call ShutdownBlockReasonDestroy when your application is finished running.
You should obey the description mentioned in WM_ENDSESSION Message[^] and WM_QUERYENDSESSION[^] to make sure both user and Windows system are happy.
|
|
|
|
|
Are you paying for their computer?
Iain.
I am one of "those foreigners coming over here and stealing our jobs". Yay me!
|
|
|
|
|
He he, no but the PC is running an important control system that the normal user is not authorised to shut down. However, if the user logs off, it closes my application.
|
|
|
|
|
Hello all,
How do you get a list of all files and folders of ALL types including system and critical ones, and files even in archives on a specific drive, and to put this string on a richtextbox or textbox.
Simple Thanks and Regards,
Brandon T. H.
Been programming in Visual Basic for 4 years this point forward, and is very good at it (I can even create programs completely on code, without dragging those items from the toolbox). Programming C++ for 1 year so far and the same with C#.
Many of life's failures are people who did not realize how close they were to success when they gave up. - Thomas Edison
|
|
|
|
|
Win32 or MFC?
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Win32
Simple Thanks and Regards,
Brandon T. H.
Been programming in Visual Basic for 4 years this point forward, and is very good at it (I can even create programs completely on code, without dragging those items from the toolbox). Programming C++ for 1 year so far and the same with C#.
Many of life's failures are people who did not realize how close they were to success when they gave up. - Thomas Edison
|
|
|
|
|
See the example here.
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Brandon T. H. wrote: How do you get a list of all files and folders
Not too difficult to find some suggestions[^].
Binding 100,000 items to a list box can be just silly regardless of what pattern you are following. Jeremy Likness
|
|
|
|
|
You could use FindFirstFile and FindNextFile to enumerate files/folders in a specified directory/drive. Listing the Files in a Directory[^] shows an example using these two functions. You will also get file/folder attributes when the functions successfully return.
Write a recursive function so it will enumerate subdirectories.
An alternative is using Shell interfaces such as IShellFolder and IEnumIDList combined with some Shell functions like SHGetDataFromIDList and SHGetDesktopFolder. It's bit more complicated than the other one, but it's more flexible. Consider this approach if FindFirstFile/FindNextFile method doesn't fit your need.
Also, you mentioned that you need to put the list of files/folders into a box. Loading this kind of huge list of items takes a long long time using default Windows control settings. Take a look at Virtual List Control at About List-View Controls[^]. You will happy to see your executable run more smoothly than the others at the end.
You can also try to google your concerns as suggested by Richard MacCutchan. Appending your keywords with "MSDN" or "Codeproject" will normally show good results. 
|
|
|
|
|
You can use WMI class CIM_DirectoryContainsFile to list all the files and all information you need including compression type, last date accessed, date created type, size, path and much more; all 33 different items describing each file on all the drives on local or remote computer.
JohnCz
|
|
|
|
|
i'd wrote an active control that have a dialog.but i cann't to move it as mfc controls.Anyone to help!! thank you 
|
|
|
|
|
mir5465 wrote: ...active control that have a dialog. Do you mean that you have an ActiveX control that is on a dialog?
mir5465 wrote: but i cann't to move it as mfc controls Meaning what exactly?
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
int *pi;
{
int i = 3;
pi = &i;
}
std::cout << *pi << std::endl;
I figure that the *pi value in std:cout can not be trusted since i goes out of scope and the address of i can be used for other stuff. Is that correct?
Thank
|
|
|
|
|
Yep, that's right. It's also why you should never return references to local variables - what they're based on disappears at the end of the block they're declared in.
Cheers,
Ash
|
|
|
|
|
It depends on stack usage.
If you return a local var thats now out of scope to a func that eats the stack it will get munged. If not, it is still there, but its is risky of course.
Actually we found a windows bug that did just this. It returned a local var. This was OK till we hooked the func, and thus increased its tack usage.
In your case i is out of scope at code level, but is still on the stack since you havent returned from your func yet (your code is actually compiled with i on the stack just after pi).
--edit--
I see no one has responded. I guess an understanding of assembler (ie, the way code actually compiles) is totally foreign territory to todays 3G coders.
==============================
Nothing to say.
modified 19-Apr-12 2:43am.
|
|
|
|
|
Erudite_Eric wrote: It depends on stack usage.
AFAIK it doesn't so much depend on stack, but on the runtime libraries used: if they choose to invalidate a memory address as soon as it goes out of scope, then code like this will crash with an access violation. It may depend on compiler settings, but I've never seen code like that actually work on Windows XP or 7.
Then again I never deliberately tried 
|
|
|
|
|
No, it isnt to do with libraries, but the very way local variables are allocated, ie, on the stack. This is only unwound, upwards dont forget, when the func the variables are declared in returns. Thats when the memory can be reused, by calling another func that declares its own variables.
So if you look at assembler you will see stuff like ebp+4 being set to a value. This is a local variable. At the end you see a ret 4. This returns from the func and winds the stack back by the same number as the size of the local variables declared.
==============================
Nothing to say.
|
|
|
|
|
hello guys... I have this dialogbox whose name I am trying to get. I have added a new dialogbox to the project using Add->Resource , so this gets an ID automatically, in the resource.h file. But when I use MAKEINTRESOURCE macro by providing resource id to get its name, it does not return it. It gives an assertion. What can be wrong here? thnx for any input.
This world is going to explode due to international politics, SOON.
modified 18-Apr-12 1:11am.
|
|
|
|
|
overloaded Name wrote: It gives an assertion.
Which is?
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|