|
Mark Salsbery wrote: Another alternative in this case, is to use one resource and show or hide the two
buttons depending on if the dialog is used modal or modeless.
Kaboom! That's why you're the MVP... and I'm just glad we're on the same team.
Thanks Mark, I will implement that.
|
|
|
|
|
@largeinsd wrote: I'm just glad we're on the same team.
What team?
Maxwell Chen
|
|
|
|
|
Team MFC/C++!
Of course
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: Team MFC/C++!
I thought that you and largeinsd were co-woring on some specific project.
Maxwell Chen
|
|
|
|
|
Heh - nah....I took it more as an expression -
same thing as "I'm glad we aren't enemies" or "glad we're
not working against each other"
Cheers,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
thanks
|
|
|
|
|
Just kidding
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.
[my articles]
|
|
|
|
|
But why you dont want to use of wmi?
|
|
|
|
|
Hi,
There is a site with a page containing an HTML form for accessing private areas. This form requests an username and password to login.
I need to programmatically send username and password to the destination page of the form using POST method (to download an automatically generated file contained into the site reserved area).
This is not very hard to do I think, but my question is:
whenever login succeeded (the destination page of the form has accepted and verified username/password sent and probably that page redirects to another page, which should be the reserved area, on successfull login), is there a way to request a page from the reserved area ? The 'user' is still logged in for the server between a WinInet request and the next one ? (who manages the session and cookies to mantain the user logged?)
Thanks
|
|
|
|
|
I'm having a problem with date controls. Basically, I want the 2nd control(finalize date) to default to the date value in the first control(business date). And, the 2nd control should allow the date to be changed to a date that is within one day of the 1st control.
OnDatetimechangeDtcBusiness(NMHDR* pNMHDR, LRESULT* pResult) <br />
{<br />
COleDateTime dtMinRange;<br />
COleDateTime dtMaxRange;<br />
<br />
CString csBusDate;<br />
GetDlgItem(IDC_DTC_BUSINESS)->GetWindowText(csBusDate);<br />
<br />
COleDateTime dtBusDate;<br />
dtBusDate.ParseDateTime(csBusDate);<br />
<br />
dtMinRange.SetDate(dtBusDate.GetYear(), dtBusDate.GetMonth(), dtBusDate.GetDay() - 1);<br />
dtMaxRange.SetDate(dtBusDate.GetYear(), dtBusDate.GetMonth(), dtBusDate.GetDay() + 1);<br />
<br />
((CDateTimeCtrl*)GetDlgItem(IDC_DTC_FINALIZE_DATE))->SetRange(&dtMinRange, &dtMaxRange);<br />
m_dtFinalizeOnDate = dtBusDate;<br />
<br />
*pResult = 0;<br />
}
The 2nd date is not defaulting to the 1st date. The 2nd date is defaulting to one day after the 1st date.
Any and all comments are greatly appreciated. If you see something that could be done a better way, please let me know.
Thank you.
|
|
|
|
|
So what's the problem? Why are you using GetDlgItem() rather than an actual control variable?
"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
|
|
|
|
|
Sorry about that, I edited my message post. The problem is that the 2nd control date is defaulting to one day after the 1st control date(business date).
|
|
|
|
|
littleGreenDude wrote: The problem is that the 2nd control date is defaulting to one day after the 1st control date(business date).
Isn't that what you told it to do?
dtMaxRange.SetDate(dtBusDate.GetYear(), dtBusDate.GetMonth(), dtBusDate.GetDay() + 1);
"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
|
|
|
|
|
No. That sets the allowable range for the 2nd date control. The minimum can be one day before the date of the 1st date control, and the maximum can be up to one day after the date of the 1st control.
((CDateTimeCtrl*)GetDlgItem(IDC_DTC_FINALIZE_DATE))->SetRange(&dtMinRange, &dtMaxRange);
The user should be allowed to change the 2nd date to any value within the 3 day range. But, when they change the date in the 1st control, the range should reset and the new default date of the 2nd date control should be the value of the 1st date control.
|
|
|
|
|
littleGreenDude wrote: ...the new default date of the 2nd date control should be the value of the 1st date control.
So where/what is your code to do this?
"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
|
|
|
|
|
Right after the range is set.
m_dtFinalizeOnDate = dtBusDate;
|
|
|
|
|
Ok, is m_dtFinalizeOnDate a CDateTimeCtrl or CTime object? If the former, shouldn't you be using the SetTime() method?
"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
|
|
|
|
|
m_dtFinalizeOnDate is a COleDateTime object that is set by a CDateTimeCtrl.
|
|
|
|
|
littleGreenDude wrote: ...is set by a CDateTimeCtrl.
I'm not exactly sure what you mean by this, but your code snippet worked fine for me by making one small change.
"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
|
|
|
|
|
"is set by a CDateTimeCtrl" means the control object on the screen is the date time picker control included with the IDE.
DDX_DateTimeCtrl(pDX, IDC_DTC_FINALIZE_DATE, m_dtFinalizeOnDate);
When using ClassWizard to add a member var to the control you are given 2 options one is by control (CDateTimeCtrl), and the other is by value (COleDateTime).
I chose the latter.
COleDateTime m_dtFinalizeOnDate;
What was the one change you made?
|
|
|
|
|
littleGreenDude wrote: DDX_DateTimeCtrl(pDX, IDC_DTC_FINALIZE_DATE, m_dtFinalizeOnDate);
Did you forget to call UpdateData(FALSE) ?
littleGreenDude wrote: What was the one change you made?
Using CDateTimeCtrl .
"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
|
|
|
|
|
Why would I want to use SetTime()?
|
|
|
|
|
Can't remember off the top of my head but, this looks potentially dangerous.
dtMinRange.SetDate(dtBusDate.GetYear(), dtBusDate.GetMonth(), dtBusDate.GetDay() - 1);
What if dtBusDate.GetDay() returns a 1?
Maybe using COleDateTimeSpan would be safer?
|
|
|
|
|
You are correct. If I choose Jan 1st, it bombs. I defined COleDateTimeSpan, and it seems to work fine. Except the 2nd date is not defaulting to the same date as the 1st control.
const COleDateTimeSpan dtOneDay(1, 0, 0, 0);<br />
<br />
dtMinRange = dtBusDate - dtOneDay;<br />
dtMaxRange = dtBusDate + dtOneDay;
|
|
|
|
|
Left click on the selected item will highlite it but next right click anywhere in control will remove this highlite.
What function does this on / off highlite and can it be contolled?
I basically need to keep the highlite on untill my right click pop-up is done executing not before.
Thanks for your help.
Cheers
Vaclav
|
|
|
|