|
its actually this.
CString from_date,to_date;
GetDlgItemText(IDC_DATETIMEPICKER1,from_date);
GetDlgItemText(IDC_DATETIMEPICKER2,to_date);
cdt1.ParseDateTime(from_date,0,LANG_USER_DEFAULT);
cdt2.ParseDateTime(to_date,0,LANG_USER_DEFAULT);
CString chk_dt1=cdt1.Format(_T("%d %b, %Y %I:%M:%S %p"));
CString chk_dt2=cdt2.Format(_T("%d %b, %Y %I:%M:%S %p"));
cdt1.ParseDateTime(chk_dt1,0,LANG_USER_DEFAULT);
cdt2.ParseDateTime(chk_dt2,0,LANG_USER_DEFAULT);
|
|
|
|
|
A datetime picker holds a date/time value, not a string. Why on earth are you calling GetDlgItemText() on it and then parsing the outcome? Have a look here[^].
Don't use strings when there is a more appropriate type around.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
i just dont need to set text in edit control,
i have two date time picker and on button click event get date and time from these date time control and want to assign in other COleDateTime type variable.
please tell me how can i do this without ParseDateTime?
|
|
|
|
|
I just did tell you.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
please explain me with example,how can i put the selected date time control value in other COleDateTime type variable?
i have a dialog based Class A that is have ListCtrl,in ListCtrl i have some data and in this listctrl 3rd column of list have date and time details.
on button click of this dialog open a other dialog of Class B,that is have 2 DateTime Picker Control.
here i select different date and time in both date time control,than press ok and want to use these date time controls value to filter Class A list ctrl records.
please tell me how can i do this that is work for all regional language?
thanks in advance.
modified on Monday, March 14, 2011 7:30 AM
|
|
|
|
|
I provided a link to an example based on GetTime(). If you don't like it, google for some more examples. I don't have any myself.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
|
Le@rner wrote: i have two date time picker and on button click event get date and time from
these date time control and want to assign in other COleDateTime type
variable.
please tell me how can i do this without ParseDateTime?
Have you tried:
COleDateTime DateTime;
((CDateTimeCtrl *) GetDlgItem(IDC_DATETIMEPICKER1))->GetTime(DateTime);
"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
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
modified on Wednesday, March 16, 2011 8:32 AM
|
|
|
|
|
DavidCrow wrote: COleDateTime DateTime; GetDlgItem(IDC_DATETIMEPICKER1)->GetTime(DateTime);
ite return error C2039: 'GetTime' : is not a member of 'CWnd'
|
|
|
|
|
So use the appropriate cast, or better yet, a member variable. GetDlgItem() is to be used sparingly.
"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
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
Hi All
Appology for asking non programming question
I want to buy data structure library written in C ,if you know any vendor please provide me any link/name.
I googled unsuccuessfuly for searching the names of data structure library vendors.
Thanks
|
|
|
|
|
I already gave you some links in answer to this question here[^].
I must get a clever new signature for 2011.
|
|
|
|
|
Google returned 16,500,000 hits when I searched for 'data structure library'. Why don't you list the ones you looked at, so we don't duplicate your efforts.
|
|
|
|
|
Hello
I would like to disable the outomatic turning off the screen,
i.e. I want that the screen will always be on.
I need that the project will be suitable also to windows xp accordingly,
I can't use the function "RegisterPowerSettingNotification " .
If anyone know another way to do it I would be glad if he can write it to me.
thanks
|
|
|
|
|
You can use SystemParametersInfo() with the SPI_SETSCREENSAVEACTIVE parameter to control the screensaver. You may also need to use the same API with the SPI_SETPOWEROFFACTIVE parameter.
|
|
|
|
|
aangerma wrote: I would like to disable the outomatic turning off the screen, i.e. I want that the screen will always be on.
Sounds like you need to notify someone of something important? I'm not always looking at a screen, and sometimes we even turn off the physical monitor.
Now, if something is amiss, the machine starts beeping, and will keep beeping until someone goes check on it - beep was chosen because it's hooked to the internal speaker, and doesn't rely on the availability of a sound-card
I are Troll
|
|
|
|
|
thank you for the reply,
I need to desply on the monitor the calls from ills to nurse,
I also uses sounds but I would prefere that the screen will be always on.
thanks
|
|
|
|
|
In general, messing up the user settings of a system from an application is not a good idea.
If the system is not used for that sole purpose, the user may have good reasons you cannot even imagine to keep the screen off (sometimes I even switch off the physical monitor!). By forcing it to be always on you're forcing a user system-requirement.
Try thinking a user that uses your application and another one that -for reasons opposite to yours- want to force it off. What a mess!
If the system is instead dedicated to your application (it will be in use for that only purpose ...) why not just configure it to have th screen always on, independently on your code?
2 bugs found.
> recompile ...
65534 bugs found.
|
|
|
|
|
The purpose of the system is that the nurse will be able to see the calls from distance, on screen that places on central place, if some one will change the settings of the computer the screen might turn off .
thanks again.
|
|
|
|
|
Ok, the context is now known.
In such environment, hardware/software are regulated (by hospital authority) , and you should not have to deal with that, if a monitor needs to always be turned-on, then the admin will change the "power settings" to no go into power-saving mode (and probably the screen saver will be disabled for normal users).
IMO, there should also be other means of communicating to the nurses (pagers, ... ).
M.
Watched code never compiles.
|
|
|
|
|
the test result on my computer:
2153
16
15
32
2668
14976
Press any key to continue . . .
main.cpp
#include <process.h>
#include "test.h"
int wmain()
{
test0(10000);
test1(10000);
test2(10000);
test3(10000);
test4(10000);
test5(10000);
system("pause");
return 0;
}
test.h
#pragma once
void test0(int loops);
void test1(int loops);
void test2(int loops);
void test3(int loops);
void test4(int loops);
void test5(int loops);
test.cpp
#include <iostream>
#include <vector>
#include <boost/pool/pool.hpp>
#include <boost/pool/object_pool.hpp>
#include <boost/pool/pool_alloc.hpp>
#include <windows.h>
#include "test.h"
using namespace std;
class AAA
{
public:
AAA()
{
}
~AAA()
{
}
public:
int a;
char b;
short int c;
vector<int> d;
};
void test0(int loops)
{
char ** p = new char*[loops];
DWORD tick = GetTickCount();
for (int i=0; i<loops; ++i)
p[i] = new char[32];
for (int i=0; i<loops; ++i)
delete []p[i];
long n = GetTickCount() - tick;
cout << n << endl;
delete []p;
};
void test1(int loops)
{
char ** p = new char*[loops];
DWORD tick = GetTickCount();
boost::pool<> memory_pool(32);
for (int i=0; i<loops; ++i)
p[i] = (char*)memory_pool.malloc();
for (int i=0; i<loops; ++i)
memory_pool.free(p[i]);
long n = GetTickCount() - tick;
cout << n << endl;
delete []p;
};
void test2(int loops)
{
DWORD tick = GetTickCount();
std::vector<int> v;
for (int i=0; i<loops; ++i)
v.push_back(i);
long n = GetTickCount() - tick;
cout << n << endl;
}
void test3(int loops)
{
DWORD tick = GetTickCount();
std::vector<int, boost::pool_allocator<int> > v;
for (int i=0; i<loops; ++i)
v.push_back(i);
long n = GetTickCount() - tick;
cout << n << endl;
}
void test4(int loops)
{
AAA ** aa = new AAA*[loops];
DWORD tick = GetTickCount();
for (int i=0; i<loops; ++i)
aa[i] = new AAA;
for (int i=0; i<loops; ++i)
delete aa[i];
long n = GetTickCount() - tick;
cout << n << endl;
delete []aa;
}
void test5(int loops)
{
AAA ** aa = new AAA*[loops];
DWORD tick = GetTickCount();
boost::object_pool<AAA> obj_pool;
for (int i=0; i<loops; ++i)
aa[i] = obj_pool.construct();
for (int i=0; i<loops; ++i)
obj_pool.destroy(aa[i]);
long n = GetTickCount() - tick;
cout << n << endl;
delete []aa;
}
|
|
|
|
|
Is there supposed to be a question here?
I must get a clever new signature for 2011.
|
|
|
|
|
Richard MacCutchan wrote: Is there supposed to be a question here?
I see a question mark there.
Pardon the silly humour, it's a rainy Sunday, here...
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]
|
|
|
|
|
CPallini wrote: Pardon the silly humour, it's a rainy Sunday, here.
I didn't think you would notice the rain after yesterday's brilliance by your team.
I must get a clever new signature for 2011.
|
|
|
|
|
Well, beating France is always a great satisfaction for all. Anyway, I know, you're more used to.
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]
|
|
|
|