Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to get the information on current standard/format and region setting

How to get the information on current standard/format and region setting

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorialquestion
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • X Offline
    X Offline
    xanagan
    wrote on last edited by
    #1

    My program designed to be use only on Windows with Thai setting. If the user's windows had a american date/time format It will not work as expected Is there anyway to get the information of current standard/format using MFC or win32API function ? I want to do something like this if(CurrentDateTimeFormat() != thai){ MessageBox("Please set region & format to thai before using","noticed",MB_OK); EndDialog(0); } thank in advance

    M K D 3 Replies Last reply
    0
    • X xanagan

      My program designed to be use only on Windows with Thai setting. If the user's windows had a american date/time format It will not work as expected Is there anyway to get the information of current standard/format using MFC or win32API function ? I want to do something like this if(CurrentDateTimeFormat() != thai){ MessageBox("Please set region & format to thai before using","noticed",MB_OK); EndDialog(0); } thank in advance

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      Maybe GetThreadLocale() will get the info you need. Also, GetLocaleInfo() can be used to get strings showing the proper format for dates and times for the current locale. Mark

      Mark Salsbery Microsoft MVP - Visual C++ :java:

      1 Reply Last reply
      0
      • X xanagan

        My program designed to be use only on Windows with Thai setting. If the user's windows had a american date/time format It will not work as expected Is there anyway to get the information of current standard/format using MFC or win32API function ? I want to do something like this if(CurrentDateTimeFormat() != thai){ MessageBox("Please set region & format to thai before using","noticed",MB_OK); EndDialog(0); } thank in advance

        K Offline
        K Offline
        karle
        wrote on last edited by
        #3

        You can use GetUserDefaultLCID to detect users default Locale ID. With GetLocaleInfo( lcid, LOCALE_ICALENDARTYPE,... ) you can check if you have a thai calendar for example. This function gives you a detailed information about users formating settings.

        1 Reply Last reply
        0
        • X xanagan

          My program designed to be use only on Windows with Thai setting. If the user's windows had a american date/time format It will not work as expected Is there anyway to get the information of current standard/format using MFC or win32API function ? I want to do something like this if(CurrentDateTimeFormat() != thai){ MessageBox("Please set region & format to thai before using","noticed",MB_OK); EndDialog(0); } thank in advance

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          xanagan wrote:

          If the user's windows had a american date/time format It will not work as expected

          This is a bad design, IMO. The user should be allowed to change their date/time format to their liking, and your program should not care one way or the other.


          "A good athlete is the result of a good and worthy opponent." - David Crow

          "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups