CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2001
    Location
    kerala
    Posts
    6

    want to get the system date format

    can any one pls give the api code for
    getting the system date format.
    ie. dd/mm/yyyy or mm/dd/yyyy etc...
    thanking u.
    harish.



  2. #2
    Join Date
    May 2001
    Posts
    36

    Solution


    Hi harishKS
    Use this to get the short date format of ur system.The format will be on strformattype variable

    on Error GoTo dataerror1
    Dim strformattype As String
    ret = RegOpenKey(HKEY_CURRENT_USER, "Control Panel\International", RETVAL)
    ret = RegQueryValueEx(RETVAL, "sShortDate", 0, 0, ByVal 0, lDataBufSize)
    strformattype = String(lDataBufSize, Chr$(0))
    ret = RegQueryValueEx(RETVAL, "sShortDate", 0, 0, ByVal strformattype, lDataBufSize)


    dataerror1:



  3. #3
    Join Date
    Jun 2001
    Location
    kerala
    Posts
    6

    sorry

    sorry icouldnt run it..
    as it was showing the error
    saying that no sub or funtion defined.
    harish.


  4. #4
    Join Date
    May 2001
    Posts
    36

    Include the declaration

    Const HKEY_CURRENT_USER = &H80000001
    Private Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long ' Note that if you declare the lpData parameter as String, you must pass it By Value.
    Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long


  5. #5
    Join Date
    Jun 2001
    Location
    kerala
    Posts
    6

    Great , it worked v.well

    it worked well.
    thnaku


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured