tolong dong saya ingin merubah datetime picker di aplikasi lain melalui vb Anyone knows why a SendMessage/DTM_SETSYSTEMTIME fails across processes?[when the message is send from one process to the Date Time picker control in a different process, SendMessage returns 0 - indicating an error - and the picker remains unaffected] Following is the code I had used to send Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Long) As Long Private Declare Function GetLastError Lib "kernel32" () As Long Private Const DTM_GETSYSTEMTIME = &H1001 Private Const DTM_SETSYSTEMTIME = &H1002 Private Const DTM_SETFORMAT = &H1032 Private Const GDT_VALID = 0 Private Type SYSTEMTIME wYear As Integer wMonth As Integer wDayOfWeek As Integer wDay As Integer wHour As Integer wMinute As Integer wSecond As Integer wMilliseconds As Integer End Type Private Sub Command1_Click() Dim lngwhnd As Long Dim lngwhnd_DTPick As Long Dim lngErr As Long Dim objSYS1 As SYSTEMTIME Dim objSYS As SYSTEMTIME Dim lngptr As Long Dim str As String objSYS.wYear = Year(Now) - 1 objSYS.wMonth = Month(Now) - 1 objSYS.wDay = Day(Now) - 1 lngwhnd = FindWindow(vbNullString, "DTPick") lngwhnd_DTPick = FindWindowEx(lngwhnd, 0, "DTPicker20WndClass", vbNullString) lngErr = SendMessage(lngwhnd_DTPick, DTM_GETSYSTEMTIME, GDT_VALID, objSYS) lngErr = GetLastError End Sub I was able to set the date in the same process using the above code. Also tried sending the LPARAM as pointer to the system date structure using the VarPtr function !! it didt work __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
