|
Hi!
I've to generate .lib file from my project. But only object file is generating. I've set the configuration type as Static Library (.lib). But no lib is generated. How to generate .lib file?
|
|
|
|
|
Take a look at your project properties, there is probably something missing that is preventing it executing the LIB step.
It's time for a new signature.
|
|
|
|
|
hello guys...i did not inted to confuse all of you. I want to show the system time in a messaagebox and im using the following code
SYSTEMTIME st;
GetLocalTime(&st);
now as stated earlier, i want to show it in a messagebox thus need to convert it to string, how can I do that??
modified on Tuesday, September 14, 2010 8:14 AM
|
|
|
|
|
How is the date and time represented?
If using COleDateTime , you can use its Format method.
Otherwise use sprintf_s or swprintf_s to format the date and time into a string.
You can also use CString::Format instead.
|
|
|
|
|
What do you mean by "date and time" exactly ? You have different types of objects that can represent date and time, so what are you using ? Take a look for instance at COLEDateTime[^].
|
|
|
|
|
If you're using ATL/MFC COleDateTime then have a look at Format method.
If you're instead using Win32 then read about strftime function.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
if there are many if's in the replies, maybe you should provide more information to start with.
|
|
|
|
|
overloaded Name wrote: ...thus need to convert it to string, how can I do that??
In addition to the others, there's also asctime() and ctime() .
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
in mfc use COleDateTime class and after that Format method
in win 32 use sprintf function
|
|
|
|
|
Hi All
I need to block or show message when application run as Administrator.Is it possible?
Please help me
|
|
|
|
|
Already tried[^] ?
virtual void BeHappy() = 0;
|
|
|
|
|
Thanks for reply
No i just going through this let you know.
|
|
|
|
|
Hey i use code which is given in MSDN.I use like this
bool CCheckApp::IsUserAdmin(void)
{
BOOL b;
SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY;
PSID AdministratorsGroup;
b = AllocateAndInitializeSid(
&NtAuthority,
2,
SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS,
0, 0, 0, 0, 0, 0,
&AdministratorsGroup);
if(b)
{
if (!CheckTokenMembership( NULL, AdministratorsGroup, &b))
{
AfxMessageBox("Test");
b = FALSE;
}
FreeSid(AdministratorsGroup);
}
return(b);
}
And call in
BOOL CCheckApp::InitInstance()
{
...
..
..
IsUserAdmin();
}
i am wrong or right.Please help me
|
|
|
|
|
Why not ?
You could modify the last line:
return (FALSE != b);
virtual void BeHappy() = 0;
|
|
|
|
|
|
Try it also in the admin mode at the switched-on UAC
virtual void BeHappy() = 0;
|
|
|
|
|
Hi all,
i m using COleDateTime Ctrl to find out dates.
i want to find out 2nd sat of month,
please tell me how can i do this.
thanks in advance.
|
|
|
|
|
0. Set a COleDataTimeSpan object (day) to a day
1. Set a COleDataTime object (date) to the desired month of the desired year
2. Build a loop of the incrementation (date += day)
while (1(sat) != date.GetDayOfWeek()) for two times
3. Now you (date) are at the second sat
virtual void BeHappy() = 0;
|
|
|
|
|
Saturday is 7 .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
OK
virtual void BeHappy() = 0;
|
|
|
|
|
COleDateTime dt(year,month,1,0,0,0);
int add = 14 - dt.GetDayOfWeek();
dt += add;
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I have a class that acts something like the following:
class Foo {
private:
int const (&InitPrimes() const)[3] {
int (*const rval)[3] = new int[1][3];
(*rval)[0] = 2;
(*rval)[1] = 3;
(*rval)[2] = 5;
return *rval;
}
public:
int const (&primes)[3];
explicit Foo() : primes(InitPrimes()) { }
virtual ~Foo() { delete[] ℙ }
}; If I have the following code in a main function, all three of the cout statements print the same value:
Foo a;
cout << a.primes << endl;
cout << &a.primes[0] << endl;
cout << &a.primes << endl; How is this possible? It seems logical that "a.primes" == "&a.primes[0]", but shouldn't "&a.primes" be a distinct value? If they are the same, then shouldn't the following contradiction be true (assume all three return value 0xF0):
Address 0xF0 (&a.primes ) is of type "(int*)[3]" and holds the value 0xF0, the location of a.primes
Address 0xF0 ( a.primes ) is of type " int [3]" and holds the value 0xF0, the address of the first element in the array
Address 0xF0 ( a.primes[0]) is of type " int " and holds the value 2, the first prime number Clearly I am misinterpreting which of these assumptions is false, because I know that address 0xF0 can't be 0xF0 and 2 at the same time (let's not get into a discussion on simultaneity with respect to relativity). If I type
*((int*)0xF0) into the immediate window (VS 2008), it returns 2, but then why is &a.primes == 0xF0? Any clarification on why the above is happening would be greatly appreciated. Thanks,
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
IIRC, the original C idea (almost 40 years ago) was that the "value" of an array symbol was its base address. In other words, array == &array == &(array[0]) . This dates from the days when a pointer was a pointer (to anything), and void was not yet a keyword. Somewhere in a standard or pseudo-standard that I can't find right now, there is a statement to the effect that the address-of operator (&) is optional when referring to an array. I remember some fairly energetic debate when I was working on a very early non-PDP11 implementation of Unix and C.
[OT, sort of] I think this is sufficiently removed from the present message in the time dimension for considerations of simultaneity to be of probability zero. ]
Cheers from an old-timer,
Peter
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
Your problem is that you say that &a.primes is of type (int *)[3] . (Actually I think you mean int (*)[3] - a pointer to an array of three ints, not an array to three pointers to int, but that's another story) It's not - it's type is int * const .
The name of an array is an alias for the address of the first element in that array. This means that:
T t[ N ];
t == &t[ 0 ];
for all T and N.
Likewise the address of an array is an alias for the first element in that array. Again this means that:
T t[ N ];
&t == &t[ 0 ];
for all T and N.
it also means that the type of &t is T * const , not (T *)[3]; as you asserted in your post.
So t , &t and &t[ 0 ] are synonyms for the same thing and *t, *&t and t[ 0 ] all refer to the same location in memory.
Cheers,
Ash
|
|
|
|
|
Alright, I think that I understand what you are saying (although I'm still confused as to why the designers of C decided to do this). The point of my post was to ensure that class Foo is correctly deallocating the member primes in it's destructor. If I understand you correctly, then all of the following should be equivalent statements, all of which result in no memory leaks:
virtual ~Foo() {
delete[] primes;
delete[] ℙ
delete[] &primes[0];
} Is it true that all of these correctly deallocate primes in the example? Thanks,
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|