Hi I know now where the problem was. DTM_SETFORMAT should be &H1005. I looked it up at commctrl.h. My mistake. I just copied the previous value somewhere in the internet. :laugh:
genie13
Posts
-
How to customize date format in DTPicker created through CreateWindowEx -
How to customize date format in DTPicker created through CreateWindowExThe Date Picker control was hard coded using CreateWindowEx(), using the class SysDateTimePick32 and I can only set its properties using SendMessageSTRING(). So I cannot perform your suggestion.
-
How to customize date format in DTPicker created through CreateWindowExI have a DTPicker which I created through CreateWindowEx. I want to show the date format in my DTPicker as date (space) time. For example, "4/22/2009 13:00:00" I used DTM_SETFORMAT but either it doesn't work, or I was doing something wrong. :confused: There are no compile/run-time errors. It's just that garbage characters are displayed on the DTPicker. Hope you could help me out. Thanks in advance!
Private Declare Function GetSystemDefaultLCID Lib "kernel32" () As Long
Private Declare Function GetLocaleInfo Lib "kernel32" _
Alias "GetLocaleInfoA" _
(ByVal Locale As Long, _
ByVal LCType As Long, _
ByVal lpLCData As String, _
ByVal cchData As Long) As LongPrivate mlnghwndDate As Long
Private Const LOCALE_STIMEFORMAT As Long = &H1003 'time format string
Private Const LOCALE_SSHORTDATE As Long = &H1F 'short date format stringPrivate Const DTM_SETFORMAT = &H1032
Private Const WS_CHILD = &H40000000
Private Const WS_VISIBLE = &H10000000Private Sub CreateDTPicker
' assuming that lnghWnd\_Sub and lnghInstance were previously set mlnghwndDate = CreateWindowEx(0, "SysDateTimePick32", vbNullString, \_ WS\_CHILD + WS\_VISIBLE, 0, 0, 85, 20, lnghWnd\_Sub, 0, lnghInstance, Null) Dim lcid As Long lcid = GetSystemDefaultLCID() Dim sFormat As String Dim sTemp As String Dim bufLen As Long bufLen = 256 sTemp = String(bufLen, vbNullChar) bufLen = GetLocaleInfo(lcid, LOCALE\_SSHORTDATE, sTemp, bufLen) sFormat = Left(sTemp, bufLen - 1) bufLen = 256 sTemp = String(bufLen, vbNullChar) bufLen = GetLocaleInfo(lcid, LOCALE\_STIMEFORMAT, sTemp, bufLen) sFormat = sFormat & " " & Left(sTemp, bufLen - 1) If SendMessageSTRING(mlnghwndDate, DTM\_SETFORMAT, 0, sFormat) <> 1 Then 'Display Error Message End If
End Sub
-
Problem Starting a Windows Service Automaticallythe OS is japanese, but from what i can understand from the event log, access is denied or some permission error. i was wondering why, because i log in using the Administrator account.
-
Problem Starting a Windows Service Automaticallyhi all! this is my first post here, so please bare with me. do you know what could possibly cause a windows service not to start automatically at windows startup? here are my settings: 1. Startup type: "Automatic" 2. Log on as: "Local System account" 3. When I install it under the "C:\Program Files folder", it works just fine. It starts automatically. But when I install it in a different folder (for example, under "C:\") it does not start automatically. 4. OS: Windows XP Professional 2002 Service Pack 2 5. User Account type: Administrator i hope you can help a newbie like me. thanks in advance! :)