|
CFileVersionInfo fvi;
char szVer[ 512 ] = { 0 };
if( fvi.Open( _T( "Econovent.dll" )))
{
::wsprintf( szVer,
_T( "%d.%d.%d.%d" ),
fvi.GetFileVersionMajor(), fvi.GetFileVersionMinor(), fvi.GetFileVersionBuild(), fvi.GetFileVersionQFE() );
fvi.Close();}
It works perfect in win32, But when complied in x64 the "wsprintf", stops working. Are the a better solution that works in x64 and win32 at the same time.
I understand that i have change. I have tried but then its not working in win32 mode.
The code need to be old C-style version. I'm not native C/C++ i'm just trying to fixa a "bug".
|
|
|
|
|
jn4u@msn.com wrote: the "wsprintf", stops working.
You need to provide some more information, as this does not give any clues as to what may be happening. Try using your debugger to step through your code and see exactly what values are being returned from the function calls.
Binding 100,000 items to a list box can be just silly regardless of what pattern you are following. Jeremy Likness
|
|
|
|
|
Use
GetLastError() method after you called wsprintf and provide the error code
|
|
|
|
|
When compling in platform win32 works. Whan compile in x64.
cannot convert parameter 1 from 'char [512]' to 'LPWSTR'
in the wsprintf call first parameter szVer.
Understand that de definition "change" för char in the call or
I have tride windhows.h and TCHAR.
|
|
|
|
|
check your build settings. you probably have "Multi-byte" or "Unicode" set for "Character set" on the x64 build, but "not set" on the x86 build.
|
|
|
|
|
Thank you.
I missed that on my project. It’s work perfect.
Some of my collage at work pointed out that change to “std::string” in the project. But still the interface to dll need to be native C with c-style string. Is std::string more neutral to the character set?
Comming from Delphi to C# world then C/C++ for this project lot of reading "new" things. My old Charles Petzold book is back on the self again. ;D
|
|
|
|
|
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
|
|
|
|