|
|
AFAIK, VS doesn't have a built-in utility to make a project from a makefile.
That means you'd have to parse it yourself (open in a text editor and see
what files and compiler/linker settings are used).
If you don't want to go through that trouble, you can build them from the
command line...
Open a DOS box, go to the visual c/bin folder and run vcvars32.bat (for 32-bit builds):
Setting the Path and Environment Variables for Command-Line Builds[^]
Then, without closing the command window, go to the folder with the makefile and run nmake.
That should build the samples
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi Experts,
How can I change the file attribute?
for e.g. a file is read only, How can I change this?
Thanks in advance.
|
|
|
|
|
|
Just adding to Steve's reply:
The Win32 way: (Simplest)
::SetFileAttributes(_T("E:\\myfile.txt"), FILE_ATTRIBUTE_NORMAL));
The MFC Way:
CFileStatus Cfs;
CFile::GetStatus(_T("E:\\myfile.txt"), Cfs);
Cfs.m_attribute = 0;
CFile::SetStatus(_T("E:\\myfile.txt"), Cfs);
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
what's the order of evaluation here ?
int res = fn(ar[i++] | ar[i++]);
should it be:
1. temp1 = ar[i]
2. inc i
3. temp2 = ar[i]
4. inc i
5. return fn(temp1 | temp2)
or:
1. temp1 = ar[i]
2. temp2 = ar[i]
3. inc i
4. inc i
5. return fn(temp1 | temp2)
this is the code i'm actually, using
res = fn((fn2(ar[i++]) << 4) | (fn2(ar[i++]) & 0x0f));
... but that's essentially the same, right ?
i get the first behavior from VC6 debug and release and from VS05, debug. in VS05 release, i get the second behavior. unfortunately, i haven't been able to duplicate it in a small test app - in my test apps, i get the behavior in all debug builds, and the second for all release builds.
which is right? or is this one of those undefined situations ?
modified on Monday, January 21, 2008 9:21:00 PM
|
|
|
|
|
Have you looked at the .asm code to see what that reveals?
"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
|
|
|
|
|
From section 5.4 of the C++ standard:
"Except where noted, the order of evaluation of operands of individual operators and subexpressions of individual expressions, and the order in which side effects take place, is unspecified."
In section 1.3.13 you'll find the definition of unspecified behaviour:
"behavior, for a well-formed program construct and correct data, that depends on the implementation. The implementation is not required to document which behavior occurs. [Note: usually, the range of possible behaviors is delineated by this International Standard. ]"
Steve
|
|
|
|
|
I dont think both things are same.
in first case 'i' will be incremented after the entire statement.
in second case i will be incremented after first fn2() call.
Is this right??
Have you tried
only int res = fn(ar[i++] | ar[i++]); this scenario in all VS environments??
modified on Tuesday, January 22, 2008 5:37:49 AM
|
|
|
|
|
Hi, I was wondering how I may go about reading in a raw AVI file, as I have one and would like to convert it to another format such as WMV3. Are there any recommended libraries for this sort of work?
Thanks
|
|
|
|
|
the simplest way to read an AVI is with AVIFileOpen (and its many friends). if you need more than simple frame extraction, you'll need to take a look at DirectShow (or whatever MS calls it these days).
|
|
|
|
|
Hello, I have tried to use the following code in order to get the caret position from another applications windows
dwCaretID = GetWindowThreadProcessId(hCaret,NULL);
if (AttachThreadInput(dwCurrentID,dwCaretID,TRUE))
{
GUITHREADINFO lpgui;
lpgui.cbSize = sizeof(GUITHREADINFO);
GetGUIThreadInfo(dwCaretID,&pgui);
RECT caret_rect = lpgui.rcCaret;
}
The caret position is being retrieved successfully in some of the applications I tested, but in Internet Explorer although I get the caret window, the caret rect is (0,0,0,0).
Does somebody have an idea how can I get the right position?
Thank you very much.
T.R.
|
|
|
|
|
I thought IE used "windowless controls". Can you see the controls window using SPY++ ?
|
|
|
|
|
|
|
I had the code somewhere for fiquiring when a year was a Leap Year, but I can't find it anywhere(C++). Could someone please show me how to figuire it(MFC)?
Thanks in advance.
A C++ programming language novice, but striving to learn
|
|
|
|
|
not code but this is how to calculate leap years:
A year will be a leap year if it is divisible by 4 but not by 100. If a year is divisible by 4 and by 100, it is not a leap year unless it is also divisible by 400.
Thus years such as 1996, 1992, 1988 and so on are leap years because they are divisible by 4 but not by 100. For century years, the 400 rule is important. Thus, century years 1900, 1800 and 1700 while all still divisible by 4 are also exactly divisible by 100. As they are not further divisible by 400, they are not leap years.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
|
|
|
|
|
Do you need to calculate leap year or do you need to determine if leap year to perform other calculations (Age, difference, etc...)?
If yes to first, www.wikipedia.org has all the mathematical and historical details.
If yes to the latter, use COleDateTime as it will do all the calculations for you. It can be used to validate a date as well.
|
|
|
|
|
In the program I'm writing I complete several editboxes with dates according to the need. I need to know before I fill-in the dates if it is a leap year; otherwise the key element in the program will fail. I must know exactly(programmatically) whether the user is in a leap year or not;
A C++ programming language novice, but striving to learn
|
|
|
|
|
Larry Mills Sr wrote: ...if it is a leap year;
What is it? Regardless, if "it" is a valid year, just mod it with 4, and 100 (and 400 if necessary) to determine its leapness.
"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 know I can trigger (from C++) the current user to be logged out of Windows (XP/Vista). Is it possible to SWITCH users either by triggering a logout/login or by triggering a fast user switch without the user having to do anything like enter their password, etc.?
I would like to have a UI where a user can choose to switch to another user in one step (assuming they know the target password) without going through the Windows login screen.
Any ideas?
Thanks,
Barry Etter
Barry Etter
|
|
|
|
|
|
Hi,
I want a very fast and optimized, yet, open source quicksort implementation.
We have a real-time system and the bottle-neck is qsort, STL qsort is even far worse than ours, maybe because of the "compare" function calls that take place.
BTW, our qsort algorithm is written by an average programmer so it is not likely to be optimum.
Thanks,
Mohammad
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
Is the bottleneck the quicksort itself or the comparison or swap operations ?
If your data is already nearly sorted, quicksort will be slow(er); it will will get to a complexity of N instead ( N log N )
Slightly off-topic without knowing the details, but do you need to do a quicksort at all ? do you have that much information that you need
to sort in "real-time" ? is your data unsorted that you always need to re-sort it ?
|
|
|
|
|
Yes, the bottle-neck is qsort itself, the comparison is done for floating-point data, and swapping is just some part of qsort.
My data aren't sorted at all, almost random..and I do need to sort my data before I can process them.
Thanks,
Mohammad
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|