|
What is the use of the function SystemTimeToFileTime?
Why should we convert a SystemTime to Filetime?
What for it is used?
|
|
|
|
|
A FILETIME is easier to serialize than a SYSTEMTIME struct. FILETIME s are a lot easier to compare too.
|
|
|
|
|
First your user name is very sweet.
The basic use of SystemTimeToFileTime function is to just convert the current system time to the file time i.e
File time is the time related to some specific file i.e the creation time, the Last Access time etc..
you can get more help of the file timing in MSDN in follwoing articles:
1. GetFileTime
2. FILETIME
3. SYSTEMTIME
if you still have any doubt about this pls feel free to ask
Pankaj Sachdeva
|
|
|
|
|
In a game i'm making, i have a projectile which moves in a direction for a limited distance. What i want to do is create the projectile dynamicaly, and then have it control itslef, rather than adding in extra code to check if there is a projectile, how many there are, and then move them all.
Now, if this where C#, i'd just create a new thread for the method. But im not sure what to do here.
|
|
|
|
|
You can create threads in C++. Remember that adding a thread won't make your code any faster.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Of course not, its still the same amount of logic. But it is more convenient.
I'll go look up threading in c++ then.
|
|
|
|
|
The Undefeated wrote: . But it is more convenient.
I'll go look up threading in c++ then.
do you need thread help in c++??
|
|
|
|
|
No i found out about it, much easier than i thought actually
But anyway, it didn't go so well, since i realised the only time the thread could draw the objects, was before everything else. Meaning it would be behind everything, and if there was a background, you wouldn't see it at all. In the end i just made a new class with functions to add / remove the objects and control them. So quite a bit more code. Although it only added 3 lines to the main loop. Projectile.Add(), Projectile.Move() and Projectile.Draw()
|
|
|
|
|
Hello Jason Henderson !
I have seen your article :"WallpaperQ :A Wallpaper Management Tool " .I wrote a program by Win32(in VC++6).My simple program include: a button "OK" and a button "Exit"(in dialog "Test Wallpaper").In button "OK",i wrote code as follows :
//at WM_INITDIALOG event
pIActiveDesktop = NULL;
HRESULT hr = CoCreateInstance(CLSID_ActiveDesktop,
NULL, CLSCTX_INPROC_SERVER, IID_IActiveDesktop,
(void**) &pIActiveDesktop);
if (FAILED(hr)) pIActiveDesktop = NULL;
//in button "OK"
if(pIActiveDesktop == NULL)
{.......
SystemParametersInfo(...,"image.bmp",..);
.......
}
else
{..............
pIActiveDesktop->SetDesktopItemOptions
(&compOptions, 0);
............
pIActiveDesktop->SetWallpaperOptions
(&wpOptions, 0);
// Set the wallpaper image.
pIActiveDesktop->SetWallpaper(T2CW
("image.jpg") , 0);
// Apply all changes.
pIActiveDesktop->ApplyChanges(AD_APPLY_ALL);
}
My program only run the first case(pIActiveDesktop=NULL)(i.e it only set to Desktop Wallpapers ".bmp").I (very)want to try the second case but not succeed (i hide the first case,when i click "OK", a error occur"memory can't read ").
Please help me how to "IActiveDesktop is available"
Thanks !
|
|
|
|
|
If you read an article, you should post your question there.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
You must ask directly of him on his article.
|
|
|
|
|
I have no knowledge in openGL, can anyone tell me how to write a getpixel function?
|
|
|
|
|
I've got a problem with a C++ class template representing a matrix object. The template parameter will be one of a number of things - a double, complex<double>, or a vector<double>, all of which have the * operator overloaded so that they can be multiplied by both themselves and a double.
My code at the moment is:
<code>
template < class T >
Matrix<T> Matrix<T>::operator*(const T val)
{
int ne=NumEl();
Matrix<T> tmp(Rows(), Cols());
for(int i=0; i< ne; i++)
{
tmp[i]=dat[i]*val;
}
return tmp;
}
template < class T >
Matrix<T> Matrix<T>::operator*(const double val)
{
int ne=NumEl();
Matrix<T> tmp(Rows(), Cols());
for(int i=0; i< ne; i++)
{
tmp[i]=dat[i]*val;
}
return tmp;
}
</code>
This won't compile when I declare a Matrix <double>, since the first function implementation with T=double is identical to the second one. Any ideas on how I can fix this?
I'm using gcc version 4.1.2 20060928, if that makes a difference.
Cheers
-Chris
-- modified at 20:10 Friday 16th March, 2007
|
|
|
|
|
I remember researching a similar question a while back, and there is no solution. What you're asking for is a template operator* that only works with certain types (or more precisely, doesn't work on certain types), and C++ doesn't let you do that. You can't restrict template type parameters like you can in C#.
|
|
|
|
|
Why do you need to have a different declaration in that case?
If the code is just an example:
One way would be to specialize Matrix<T> for doubles, to include only one of the "operator*":
<br />
template<><br />
struct Matrix<double><br />
{<br />
Matrix<double> operator*(const double v) { ... }<br />
};<br />
But that might involve lot of typing for a full-fledged matrix class. You might move all implementations to distinctly-named base class functions, but that helps only so much.
Another option (but with slightly different semantics) is to make the first operator weaker by making it a template:
<br />
template <typename T><br />
struct Matrix<br />
{<br />
template <typename T2><br />
Matrix<T> operator*(const T2 v) { ... }<br />
<br />
Matrix<T> operator*(const double v) { ... }<br />
};<br />
Developers, Developers, Developers, Developers, Developers, Developers, Velopers, Develprs, Developers! We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP Linkify!|Fold With Us!
|
|
|
|
|
Thanks for your help - the second bit of code looks like what I want to do.
-Chris
|
|
|
|
|
|
test < 1 && test > 2
[edit] ahh, now I remember, it's fixed! [/edit]
Developers, Developers, Developers, Developers, Developers, Developers, Velopers, Develprs, Developers! We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP Linkify!|Fold With Us!
|
|
|
|
|
hi iam samo
i need help in this question
how i convert all this if statement in c++ to for loop and i want from user to determine how many level he wants and analysis to stage i try it please help me this is the codejust convert if statment to for loop and please send it to my e-mail : samo_jack2000@yahoo.com it's important for me)
#include
#include
int size;
void main(){
char symbol[10 ];
int level;
int i;
//******************************************************************//
cout<<"ENTER SIZE OF YOUR CHARACTER :";
cin>>size;
cout<<"*ENTER CHARACTER/ALAPHBET : ";
for( i=0;i
{
cin>>symbol[i];
}
//******************************************************************//
cout<<"*ENTER HOW MANY LEVEL YOU WANT : ";
cin>>level;
cout<<endl;
if(level>8)
cout<<"PLEASE ENTER NUMBER BETWEEN 1 TO 8"<
|
|
|
|
|
Why change the code when it looks so cool when you scroll it real fast
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
for (i = 0; i < 8; i++)
{
if (level == i)
{
for (j = 0; j < level; j++)
{
if ((j+1) mode 2 <> 0)
cout<<"STAGE ", j," :"<<symbol[0]<<endl;
else="" (j+1)mod2="=0
" cout<<"stage="" ",="" j,"="" :"<<symbol[1]<<endl;
="" }
="" }
}=""
<div="" class="ForumSig">Papais
|
|
|
|
|
hi iam samo
i need help in this question
how i convert all this if statement in c++ to for loop and i want from user to determine how many level he wants and analysis to stage i try it please help me this is the codejust convert if statment to for loop and please send it to my e-mail : samo_jack2000@yahoo.com it's important for me)
#include
#include
int size;
void main(){
char symbol[10 ];
int level;
int i;
//******************************************************************//
cout<<"ENTER SIZE OF YOUR CHARACTER :";
cin>>size;
cout<<"*ENTER CHARACTER/ALAPHBET : ";
for( i=0;i
{
cin>>symbol[i];
}
//******************************************************************//
cout<<"*ENTER HOW MANY LEVEL YOU WANT : ";
cin>>level;
cout<<endl;
if(level>8)
cout<<"PLEASE ENTER NUMBER BETWEEN 1 TO 8"<
|
|
|
|
|
Sorry for blowing off steam like this but...
Why is it when I use a MFC GUI control it just does not do what a normal naive programmer would think it would do !!!
I pop in a static text control, humm lets see lets change the text color...what? Not there...Ok lets change this windows background color what? what? what? I have to code all of this !!
I can understand if you want to do something out of the ordinary but I think colors and fonts are not all that special... It's 2007
I would think that the base classes would have been updated by now!
Am I missing something ? I am spending more time coding stuff like color, font, button effects than what the application is supposed to be doing ! Are you guys using a library or something for GUI controls?
I know codeproject has a couple of nice ones that work great but I feel I need to reinvent the wheel every time !
Could codeproject start an official GUI library, pick out the best controls from it's project bank and integrate them into the library ????
Just a though.
Sorry for the steam blowing...
Chris
|
|
|
|
|
Feel better now?
You can blame MFC for many things but windows and controls (which are windows) are part of the
operating system. MFC wraps the handles to these OS objects in an object-oriented way. There
may seem to be more functionality with all the MFC methods but most of the methods end up
calling OS APIs or combining calls to several APIs.
Depending on one's UI needs, this could be practically useless or very useful.
If you don't need an OO wrapper for the GUI APIs then MFC is useless.
If you do choose to use MFC you have a couple advantages right off the bat:
1) Windows are already subclassed for you.
2) Because it's implemented in C++, it's easy to derive classes and create your own library
which better suits your needs.
They could have added all kinds of functionality...then many of us would be blowing off steam
about how overbloated MFC with wasted code we never use.
If you find that you are using customized controls and windows alot in your projects then take
advantage of OO C++ and create your own library of code that can be reused.
I think that's the main spirit of MFC. Any claims that MFC is supposed to make Windows progamming
easier or less complex I've always thought were BS. Not only does one still need to know and
understand Windows programming, MFC adds the complexity of understanding C++ as well.
There's nothing wrong with not using MFC1 All the same functionality can be implemented a
different way (within the limits imposed by the OS).
Just my 2 cents...
Cheers!
Mark
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
Yeah I doo feel better.
I can understand that MFC did this to be light weight and all, but it seems every new programmer starting off with MFC has to create their own library of code ! Effectively reinventing the wheel, while cursing the gods
Should they not have a repository or something ? I mean the old VB 6.0 GUI controls had more options than MFC, limited but basic stuff was there.
As for the bloated code doesn't the compiler remove code that is not being used at compile time ?
Anyway I think an opensource / free library of OO C++ classes that people have come up with would be a very useful resource to have.
Thanks for the comment.
Chris
|
|
|
|