Jump to content

Mulitple Date Selection with GUICtrlCreateMonthCal


Recommended Posts

I want to be able to choose a date range in a calendar. I am able to choose it in the GUI but I need help reading it from the GUI. Here is my script:

#include <GUIConstants.au3>

#include <date.au3>

#include <GuiMonthCal.au3>

opt('MustDeclareVars', 1)

Dim $Date, $Date2, $Btn_Dates, $Combo, $msg, $Status

GUICreate( "Set Max Sel Count", 450, 254)

$Date2 = GUICtrlCreateMonthCal (_NowCalcDate(), 10, 10, 190, 155,$MCS_MULTISELECT)

_GUICtrlMonthCalSetMaxSelCount ($Date2, 100)

$Status = GUICtrlCreateLabel("", 0, 234, 450, 20, BitOR($SS_SUNKEN, $SS_CENTER))

$Btn_Dates = GUICtrlCreateButton("Dates", 180, 180, 90, 30)

GUISetState()

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case $msg = $Btn_Dates

Msgbox(0,"Date",GUICtrlRead($Date2))

EndSelect

WEnd

Link to comment
Share on other sites

a regular guictrlread won't work, don't have time to figure this out myself at the moment but here's a link to the info

http://msdn.microsoft.com/library/en-us/sh...getselrange.asp

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

lResult = SendMessage( // returns LRESULT in lResult

(HWND) hWndControl, // handle to destination control

(UINT) MCM_GETSELRANGE, // message ID

(WPARAM) wParam, // = 0; not used, must be zero

(LPARAM) lParam // = (LPARAM) (LPSYSTEMTIME) lprgSysTimeArray;

);

Here is what I have so far. Please advise.

Func _GUICtrlMonthCalGetRange($h_monthcal)

If IsHWnd($h_monthcal) Then

Local $a_ret = DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_monthcal, "int", $MCS_MULTISELECT, "int", 0, "int", 0)

Return $a_ret[0][0]

Else

Return GUICtrlSendMsg($h_monthcal, $MCS_MULTISELECT, 0, 0)

EndIf

EndFunc

Link to comment
Share on other sites

don't forget:

lprgSysTimeArray

Pointer to a two-element array of SYSTEMTIME structures that will receive the lower and upper limits of the user's selection. The lower and upper limits are placed in lprgSysTimeArray[0] and lprgSysTimeArray[1], respectively. This parameter must be a valid address and cannot be NULL.

1st off you need to be using MCM_GETSELRANGE not MCS_MULTISELECT

I played around with this a little yesterday, haven't had time to keep at it.

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

don't forget:

lprgSysTimeArray

Pointer to a two-element array of SYSTEMTIME structures that will receive the lower and upper limits of the user's selection. The lower and upper limits are placed in lprgSysTimeArray[0] and lprgSysTimeArray[1], respectively. This parameter must be a valid address and cannot be NULL.

1st off you need to be using MCM_GETSELRANGE not MCS_MULTISELECT

I played around with this a little yesterday, haven't had time to keep at it.

Not sure how you got the value for Global Const $MCS_MULTISELECT = 0x2. What will be the value for $MCM_GETSELRANGE?

Sorry for all the questions. This is my first time making a UDF. If possible if you can show me how to do this then I might not have to bug anyone in the future.

Thanx in advance.

Link to comment
Share on other sites

  • 4 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...