|
Thanks, David, for your encouraging reply.
I have tried the code without the cast and I can't get sensible results.
This is what I now have...
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
hFind = FindFirstFile(strPath, &FindFileData);
CString strYears, strMonths, strDays;
SYSTEMTIME stNow;
GetSystemTime(&stNow);
const FILETIME ftFile = FindFileData.ftCreationTime;
FILETIME ftNow;
ULARGE_INTEGER ulNowTime, ulFileTime, ulAge;
SystemTimeToFileTime (& stNow, &ftNow);
ulNowTime.HighPart = ftNow.dwHighDateTime;
ulNowTime.LowPart = ftNow.dwLowDateTime;
ulFileTime.HighPart = ftFile.dwHighDateTime;
ulFileTime.LowPart = ftFile.dwLowDateTime;
ulAge.HighPart = ulNowTime.HighPart - ulFileTime.HighPart;
ulAge.LowPart = ulNowTime.LowPart - ulFileTime.LowPart;
FILETIME ftAge;
SYSTEMTIME stAge;
ftAge.dwHighDateTime = ulAge.HighPart;
ftAge.dwLowDateTime = ulAge.LowPart;
SystemTimeToFileTime(&stAge,&ftAge);
strYears.Format("%d", stAge.wYear-1601);
strMonths.Format("%d",stAge.wMonth-1);
strDays.Format("%d",stAge.wDay-1);
I'm foxed. I should really take your advice and move on...
Ben.
|
|
|
|
|
What exactly is this code snippet supposed to be doing?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I was trying to find the difference between a file's creation date, the current time and get the resulting data in a useful format. Doing this I was aware of the following warning from the MSDN library
Remarks
It is not recommended that you add and subtract values from the SYSTEMTIME
structure to obtain relative times. Instead, you should
-Convert the SYSTEMTIME structure to a FILETIME structure.
-Copy the resulting FILETIME structure to a ULARGE_INTEGER structure.
-Use normal 64-bit arithmetic on the ULARGE_INTEGER value.
However, I think at this point I was put off because the promised 'HighPart' and 'LowPart' members of ULARGE_INTEGER didn't appear in the autocomplete list on my editor. I have since written in the members anyway and found that they work without any trouble.
Since your last reply I have had a walk around the block and had another look at the code. I discovered that when I was removing some lines whilst taking out the code that used that (FILETIME *)&ULARGE_INTEGER cast, I removed one line I should have left in and edited and left in another line towards the end of the code that should have been removed...
Here is the (now, at last) working code with comments.
Thanks for your encouragement and for showing an interest,
Ben
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
hFind = FindFirstFile(strPath, &FindFileData);
CString strYears, strMonths, strDays;
SYSTEMTIME stNow;
GetSystemTime(&stNow);
const FILETIME ftFile = FindFileData.ftCreationTime;
FILETIME ftNow;
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
hFind = FindFirstFile(strPath, &FindFileData);
CString strYears, strMonths, strDays;
SYSTEMTIME stNow;
GetSystemTime(&stNow);
const FILETIME ftFile = FindFileData.ftCreationTime;
FILETIME ftNow;
SystemTimeToFileTime (& stNow, &ftNow);
ULARGE_INTEGER ulNowTime, ulFileTime, ulAge;
ulNowTime.HighPart = ftNow.dwHighDateTime;
ulNowTime.LowPart = ftNow.dwLowDateTime;
ulFileTime.HighPart = ftFile.dwHighDateTime;
ulFileTime.LowPart = ftFile.dwLowDateTime;
ulAge.HighPart = ulNowTime.HighPart - ulFileTime.HighPart;
ulAge.LowPart = ulNowTime.LowPart - ulFileTime.LowPart;
FILETIME ftAge;
SYSTEMTIME stAge;
ftAge.dwHighDateTime = ulAge.HighPart;
ftAge.dwLowDateTime = ulAge.LowPart;
FileTimeToSystemTime(&ftAge,&stAge);
strYears.Format("%d", stAge.wYear-1601);
strMonths.Format("%d",stAge.wMonth-1);
strDays.Format("%d",stAge.wDay-1);
|
|
|
|
|
Have you considered the COleDateTimeSpan class?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hmm. Looking this up in MSDN I have found out that CTime has constructors for accepting SYSTEMTIME and FILETIME objects.
Looks like I'll be rewriting the code with an even better solution!
|
|
|
|
|
I have got some shortcuts in "All Programs"-> "Accessories" -> "Test Menu".
“Test Menu” contains some shortcuts of applications and those are not sorted, can anyone please tell how to sort those shortcuts programmatically.
Manually I can do this by using popup menu “Sort by Name” as shown in screen shot.
http://img142.imageshack.us/my.php?image=shortcutsortingquestionbl8.jpg
Best Regards,
Mushq
Mushtaque Ahmed Nizamani
Software Engineer
Ultimus Pakistan
modified on Monday, February 25, 2008 6:57 AM
|
|
|
|
|
It may well be that there is no way of doing it programmatically. I know many things to do with the start menu are no longer controllable from external programs (ie the pin list) - and that's a good thing. What you want to do might fit in that category.
Is it so bad for the User to do this for themselves - after all they might not want things sorted, if they're used to the layout as it is now.
Iain.
Iain Clarke appearing in spite of being begged not to by CPallini.
|
|
|
|
|
Have you read through Michael Dunn's Shell Extension articles[^]? This sounds like you simply need to snag on to the contxt menu and select "Sort by Name."
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi,
In vista os,when i am trying to open a dialog in application b.exe through another application a.exe the dialog is always appearing on the taskbar.It is not getting displayed on the screen unless you press on the minimized dialog on taskbar.How to change this behaviour?This happens only in vista not in XP.
Thanks,
Sheetal
|
|
|
|
|
Do you have code in place that is initially minimizing the window?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
No code for minimizing.
This behaviour is only in Vista.
In xp it is not getting minimized.It is displayed on top of all other windows.
|
|
|
|
|
So what does your app's OnInitInstance() method look like?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
[edit]
Problem is solved.
1. The IDE of Visual C++ 2005 does NOT support individual manifest files for different configurations (Win32 and x64) in one single project, even though the Project Properties look like it can. No, it doesn't!
Solution: Use the command-line to run MT.exe.
2. For compatible with WinXP, we should use the sample manifest mentioned HERE[^].
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<ms_asmv2:trustInfo xmlns:ms_asmv2="urn:schemas-microsoft-com:asm.v2">
<ms_asmv2:security>
[/edit]
I was going to add something in the manifest files for UAC for my project. My project has two configurations: Win32 and x64. So I added two manifest files, "vista32.manifest" and "vista64.manifest, into the project.
Then I went to the project properties:
Configuration Properties | Manifest Tool | Input and Output,
and added "$(InputDir)vista64.manifest" in "Additional Manifest Files" field for Win32 configuration,
and "$(InputDir)vista32.manifest" for x64 configuration.
The content of "vista64.manifest" looks like this:
(because of the domain policy, my IE rejects copy-n-paste on CP. There might be typo below.)
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0"
processorArchitecture="X64"
name="IntelClkRun64"
type=""/>
<description>some description</description>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="requireAdministrator"
uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
And Win32 version is similar. The only difference is below:
<assemblyIdentity version="1.0.0.0"
processorArchitecture="X86"
name="IntelClkRun32"
type="Win32"/>
It won't compile happily when file "vista32.manifest" is assigned to Win32 configuration and file "vista64.manifest" to x64 configuration. The error message is as below.
1> .\vista32.manifest : manifest authoring error c1010001: Values of attribute "processorArchitecture"
not euqal in different manifest snippet.
How should I resolve this issue for Win32 and x64 co-existance in one project? And is there any mistake in the manifest content?
Thanks in advance!
Maxwell Chen
modified on Tuesday, February 26, 2008 6:57 AM
|
|
|
|
|
And if just Win32, is my method correct?
Maxwell Chen
|
|
|
|
|
Hello Sir
i project is in VC(MFC)
I have two lan cards in my Server in such a way that Lan Card a1 is connected to internet and holds Public IP infomration and Lan card a2 is meant for private internal network and holds internal IP information and connects to client machines in my internal network.
In my coding want to develop a module that can enable me to find realtime IP addresses and/or computer name of the Client machines that are using internet via server in my internal network.
Plz help me.....I want source code or tips or Link..
|
|
|
|
|
Are you looking for WinPcap- the packet monitoring driver with API? You need to design an APP with winpcap and run that on server. You can monitor anything.
|
|
|
|
|
mirtu wrote: In my coding want to develop a module that can enable me to find realtime IP addresses and/or computer name of the Client machines that are using internet via server in my internal network.
what about RAW Sockets (SOCK_RAW), eventhough there are controversy using RAW Socket, i think with administrative priviledge, your application can use RAW Socket, through RAW Sockets you can get the IP packets header to find the IP addresses.
|
|
|
|
|
I try to define some map that will hold tree item and its data.
But when i define this strut ( below ) i getting almost million of warning.
What is my mistake ?
<br />
std::map<HTREEITEM, StaticStructer::iterator> m_ContainerMap;<br />
|
|
|
|
|
What are the warnings ? What version of VC are you using ? VC6 standard STL sucks.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Yes ... its VC6
I have here so much warnings ... i cant add them all to here.
|
|
|
|
|
std::map<HTREEITEM, StaticStructer::iterator> m_ContainerMap;
doesnot seems to have compilation problem, provided StaticStructer is declared well to use it here.
and a side note: IMHO, storing iterator is not a good choice.
Yanshof wrote: I have here so much warnings ... i cant add them all to here.
how do you determined all these warning are due to the above code statement. u can post some messages, in most cases we cannot fix the warning, if we are strictly saying that, we can fix only if all the warnings are addressed simultaneously.
|
|
|
|
|
I suppose that there is only one single warning type (about long variable names or something like that) ?
If that's the case, it's a known problem and you can safely ignore the warnings. You can disable them by going into the project properties and specify a specific warning to be disabled (sorry, don't have VC6 here so I can't point you to the exact location).
To be sure, just post the warning number here.
|
|
|
|
|
i am using the freeimage library to display 32 bit bitamp with alpha
channel . I am using the following code
//--------------------------------------------
::SetDIBitsToDevice(
pDC->m_hDC, // handle to DC
xDst, yDst, // x-y-coord of destination upper-left corner
dxSrc, dySrc, // width-height of source rectangle
xSrc, ySrc, // x-y-coord of source upper-left corner
0,//uStartScan,// first scan line in array
FreeImage_GetHeight(pFIBitmap), // number of scan lines
FreeImage_GetBits(pFIBitmap), // array of DIB bits
FreeImage_GetInfo(pFIBitmap), // bitmap information
DIB_RGB_COLORS); // RGB or palette indexes
//-----------------------------------------------------------
In my 32 bit bitmap alpha channel value is 0 i.e must be transparent
on rendering device context. but is it not happening it is not
transparent (FULL BLACK). same problem occuring with 32 bit targa files
can any one suggest me the solution ????
Trioum
|
|
|
|
|
AFAIK, there's no alpha channel support in GDI. There's no BITMAPINFO type that represents 32-bit ARGB
format.
GDI+ will work though.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
But GDI+ is not displaying 32 bit bitmap and targa files.
I try a lot (googling MSDN)
how can I do it ????????.
Trioum
|
|
|
|