|
Hi Buddys,
i can able to get tue document date using api, but i want to display it in international format/ 24 hours format, when i change reginal setting it will displays, but i dont want to change the setting, how can i access this w/o make any changes. revert me with feasible solutions
|
|
|
|
|
kirankatta wrote: ...but i want to display it in international format/ 24 hours format...
So what's the problem? Are you using GetDateFormat() ?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
I'm implementing a class to manage an array of objects created on the heap.. Something like:
class Manager {
public:
Manager(void);
~Manager(void);
Populate(LPVOID data);
Retreive(int index);
private:
myObject * objects;
int count;
} myObject needs to contain a char array and a BYTE array, both also on the heap. My first inclination was to use a STRUCT :
struct myObject {
char * szName;
byte * lpbData;
}; As I thought about it, though, it seemed memory clean-up would be easier if I made myObject a class with public members, initialize the values with a constructor, and let the destructor handle memory clean-up:
class myObject {
public:
myObject(char * name, BYTE * data, DWORD size) {
this->szName = new char[strlen(name)+1]; strcpy(this->szName, name, strlen(name);
this->lpbData = new BYTE[size]; memcpy(this->lpbData, data, size);
this->dwSize = size;
}
~myObject(void) { delete this->szName; delete this->lpbData; }
public:
char * szName;
BYTE * lpbData;
DWORD dwSize;
}; Performance is critical in this particular application, and I'm thinking there's probably more to consider in the class vs. struct than just what makes memory cleanup easiest for me in the other classes.
Can anybody offer some help, here, or point me in the direction of a reference that might help?
Thanks,
MZR
|
|
|
|
|
classes and structs are basically the same in C++. The only difference is that structs have default member accessibility public , while classes have private .
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]
|
|
|
|
|
Also, inheritance is public by default for structs and private by default for classes.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
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]
|
|
|
|
|
...this is the down-side to being self-taught.
MZR
|
|
|
|
|
One could argue that they have "semantic" differences.
struct could be used to hold only data and class could be used to hold data and "behavior".
This signature was proudly tested on animals.
|
|
|
|
|
Yes, but this is left to the developer. In other words, C++ doesn't need struct s at all, it still has for compatibility with C .
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]
|
|
|
|
|
C++ neither needs macros (amongst other things), but for the sake of 'C' perverts like you, it had to be included.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
On the other hand C needs none of the C++ sissy features.
And Klingons programmers needs no postfix increment operator on their third variable.
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]
|
|
|
|
|
You're wrong. Klingons keep C as their, not third, but umm... something like 18th variable to confuse the enemies.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Good point. Anyway you're wrong as well, since Klingons never use more than five variables.
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]
|
|
|
|
|
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Hi Experts,
I am new to VC++ win32 projects.I would like to create Virtual Drive a have my UserControl in one Window when i Open that Drive.U can take the example of M-files.
please help me...
|
|
|
|
|
To mount a folder as a virtual drive you can use SetVolumeMountPoint[^]
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Hi sir,
When i Explore it or i go to the Drive thru Open File dilog or double click on the Drive(Virtual Drive) i want mine own window with mine own Properties . Just as M-Files.
Help me Sir...
|
|
|
|
|
|
|
Is there any rule decided for it ? how to decide the use of each one..?
|
|
|
|
|
If there's a very large number of cases, you'd go for switch case. Otherwise, if-else should be good enough.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
A switch statement is generally best to use when you have more than two conditional expressions based on a single variable of numeric type. For instance, rather than the code
if (x == 1)
printf("x is equal to one.\n");
else if (x == 2)
printf("x is equal to two.\n");
else if (x == 3)
printf("x is equal to three.\n");
else
printf("x is not equal to one, two, or three.\n");
the following code is easier to read and maintain
switch (x)
{
case 1: printf("x is equal to one.\n");
break;
case 2: printf("x is equal to two.\n");
break;
case 3: printf("x is equal to three.\n");
break;
default: printf("x is not equal to one, two, or three.\n");
break;
}
Hope it gives you an answer
|
|
|
|
|
There is no such rule.
but only comfort and ease of coding matters.
functionally, both are same if they are used as per their exact syntax.
but in switch, you can program in such a way that, multiple cases carry the same body.
it all depends on the situation to decide which one would be better.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
One rule is of course the fact that switch-case needs to compare with constant values; you cannot put a variable in a case statement.
If you have constant values to compare with, and the range is rather small, the compiler is often able to generate a jump table which is faster in comparison.
However, if you have a large range of values and/or if they are widely spread, many compilers would generate the code as if you would have used the if-else solution. To create a jump table in such case would be far too complex to be built with a generic algorithm as a compiler would provide.
If you opt for the if-else solution, put the condition most likely to happen at the top, otherwise multiple conditions have to be evaluated before the right one is found for the major part of the calls.
There's some interesting notes here[^] as well.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
if there are only two state for a condition you can use ternary operator or if-else
For more than two and something that can be handled in a few if-else blocks you can use if-else
if there are a huge number of cases use switch-case
But if you are operating on strings if-else would be the choice as switch-case won't work
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|