#AutoIt3Wrapper_Res_HiDpi=Y #include #include #include #include #include #include #include #include #include #include #include _Example() Func _Example() ;MsgBox(0, '', _GetDPI()) _Data_OD_DO('test') EndFunc Func _GetDPI() Local $hDC = _WinAPI_GetDC(0) Local $DPI = _WinAPI_GetDeviceCaps($hDC, $LOGPIXELSY) _WinAPI_ReleaseDC(0, $hDC) ;MsgBox(0, '$DPI', $DPI) Return Round($DPI, 2) EndFunc Func _Data_OD_DO($s_info, $data_od = Default, $data_do = Default, $bSQLDateFormat = False, $h_parent_windows = -1) ; Wynik to tablica IDX_0=OD DNIA 'YYYYMMDD 00:00:00.001' IDX_1=DO DNIA 'YYYYMMDD 23:59:59.990' #forceref $h_parent_windows If $data_od = Default Then $data_od = _Now() If $data_do = Default Then $data_do = _Now() $s_info &= @CRLF & @CRLF & 'UWAGA:' & @CRLF & 'Klawisz ESC lub zamknięcie okna jest równoznaczne z naciśnięciem przycisku [ANULUJ]' Local $v_GUIOnEventMode = AutoItSetOption("GUIOnEventMode", 0) #Region ### START Koda GUI section ### Form=L:\TOOLs\Macro\------FORMULARZE_KODA\Data od do.kxf Local $Form_date_from_to = GUICreate("Data od ... do ....", 630, 392, 254, 114) GUISetFont(8.5) GUISetBkColor(0xA6CAF0) Local $MonthCal_FROM = GUICtrlCreateMonthCal($data_od, 10, 144, 300, 190) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) _WinAPI_SetWindowTheme(GUICtrlGetHandle($MonthCal_FROM), "", "") Local $MonthCal_TO = GUICtrlCreateMonthCal($data_do, 320, 144, 300, 190) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) Local $idButton_Wybierz = GUICtrlCreateButton("&Wybierz wskazny zakres dat", 70, 352, 190, 25, $BS_DEFPUSHBUTTON) GUICtrlSetBkColor(-1, 0x00FF00) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) Local $idButton_Anuluj = GUICtrlCreateButton("&Anuluj", 380, 352, 190, 25) GUICtrlSetBkColor(-1, 0xFF0000) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) Local $Label_DATA_OD = GUICtrlCreateLabel("OD DNIA :", 10, 126, 64, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetResizing(-1, $GUI_DOCKAUTO) Local $Label_DATA_DO = GUICtrlCreateLabel("DO DNIA :", 320, 126, 64, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetResizing(-1, $GUI_DOCKAUTO) ;~ Local $Label_INFO = GUICtrlCreateLabel($s_info, 10, 10, 390, 110, $WS_BORDER, $WS_EX_CLIENTEDGE) ; nie potrzeba deklarować zmiennej GUICtrlCreateLabel($s_info, 10, 10, 610, 110, $WS_BORDER, $WS_EX_CLIENTEDGE) GUICtrlSetBkColor(-1, 0xFFFBF0) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Local $nMsg Local $vReturnValue = '' WinSetOnTop("Data od ... do ....", $s_info, $WINDOWS_ONTOP) Local $Days_between WinSetOnTop($Form_date_from_to, '', $WINDOWS_ONTOP) While 1 ;_Check_Tray_State() $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE $vReturnValue = False ExitLoop Case $idButton_Wybierz $Days_between = _DateDiff('D', GUICtrlRead($MonthCal_FROM), GUICtrlRead($MonthCal_TO)) If $Days_between < 0 Then GUICtrlSetData($Label_DATA_OD, '!!! DO DNIA :') GUICtrlSetBkColor($Label_DATA_OD, 0xFF0000) GUICtrlSetData($Label_DATA_DO, '!!! DO DNIA :') GUICtrlSetBkColor($Label_DATA_DO, 0xFF0000) Else GUICtrlSetData($Label_DATA_OD, 'DO DNIA :') GUICtrlSetBkColor($Label_DATA_OD, 0x000000) GUICtrlSetData($Label_DATA_DO, 'DO DNIA :') GUICtrlSetBkColor($Label_DATA_DO, 0x000000) Local $a_wynik[2] = [GUICtrlRead($MonthCal_FROM), GUICtrlRead($MonthCal_TO)] If $bSQLDateFormat Then $a_wynik[0] = StringReplace($a_wynik[0], '/', '') & ' 00:00:00.001' $a_wynik[1] = StringReplace($a_wynik[1], '/', '') & ' 23:59:59.990' EndIf $vReturnValue = $a_wynik ExitLoop EndIf Case $idButton_Anuluj $vReturnValue = False ExitLoop EndSwitch WEnd GUIDelete($Form_date_from_to) AutoItSetOption("GUIOnEventMode", $v_GUIOnEventMode) If $vReturnValue = False Then _ Return SetError(1, 0, $vReturnValue) Return $vReturnValue EndFunc ;==>_Data_OD_DO