Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3996822
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:19:34+00:00 2026-05-20T07:19:34+00:00

I am trying to update the dateTimeController in another application using DTM_SETSYSTEMTIME. bool retVal

  • 0

I am trying to update the dateTimeController in another application using DTM_SETSYSTEMTIME.

bool retVal = false;
ushort GDT_VALID = 0;

SYSTEMTIME td = new SYSTEMTIME();
td.wYear = 1990;
td.wMonth = 4;
td.wDay = 2;
td.wDayOfWeek = 0;
td.wHour = 0;
td.wMilliseconds = 0;
td.wMinute = 0;
td.wSecond = 0;

int erc = SendMessage(handle, DTM_SETSYSTEMTIME, GDT_VALID, ref td);

Unfortunately the attempt was failed, the picker is not updated, every time return value is zero.
Important thing is occasionally the application having the dataTimePicker gives an error message that illegal memory access exception after I execute the SendMessage command.

Can anybody help me to fix this up ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T07:19:35+00:00Added an answer on May 20, 2026 at 7:19 am

    Your information is really helpful for me to fix my issue. Following is the code.

    private static bool injectMemory(IntPtr windowHandle, byte[] buffer, out IntPtr hndProc, out IntPtr lpAddress)
        {
            hndProc = IntPtr.Zero;
            lpAddress = IntPtr.Zero;
            //open local process object
            Process mainWindowProcess = FindProcess(windowHandle);
            hndProc = OpenProcess(
                (0x2 | 0x8 | 0x10 | 0x20 | 0x400), //create thread, query info, operation 
                //write, and read 
                1,
                (uint)mainWindowProcess.Id);
            if (hndProc == (IntPtr)0)
            {
                Console.WriteLine("Unable to attach process");
                return false;
            }
            //allocate memory for process object
            lpAddress = VirtualAllocEx(hndProc, (IntPtr)null, (uint)buffer.Length,
                 AllocationType.Commit | AllocationType.Reserve, MemoryProtection.ExecuteReadWrite);
            if (lpAddress == (IntPtr)0)
            {
                Console.WriteLine("Unable to allocate memory to target proces");
                return false;
            }
            //wite data
            uint wrotelen = 0;
            WriteProcessMemory(hndProc, lpAddress, buffer, (uint)buffer.Length, out wrotelen);
            if (Marshal.GetLastWin32Error() != 0)
            {
                Console.WriteLine("Unable to write memory to process.");
                return false;
            }
            return true;
        }
    

    Method is called by,

            int structMemLen =  Marshal.SizeOf(typeof(SYSTEMTIME));
            byte[] buffer = new byte[structMemLen];
            ushort GDT_VALID = 0;
            SYSTEMTIME sysTime = new SYSTEMTIME();
            //Assign the values as you prefer
    
            IntPtr dataPtr = Marshal.AllocHGlobal(structMemLen);
            Marshal.StructureToPtr(sysTime, dataPtr, true);
            Marshal.Copy(dataPtr, buffer, 0, structMemLen);
            Marshal.FreeHGlobal(dataPtr);
    
            IntPtr hndProc = IntPtr.Zero;
            IntPtr lpAddress = IntPtr.Zero;
            injectMemory(mainWindowHandle, buffer, out hndProc, out lpAddress); 
            SendMessage(handle, DTM_SETSYSTEMTIME, (IntPtr)GDT_VALID, lpAddress);
            CloseHandle(hndProc);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im trying to update my news feed on facebook. Im using the new graph
I am trying to update a field in a table with data from another
So I'm trying to update an object in my MS SQL 2005 database using
I'm trying update a ListView with an entirely new ArrayList. For API 11 it
I'm trying to update an old Access database using SQL scripts, but I can't
I am trying to update some object properties by calling UpdateModel(myObject, new[] { "stringprop1",
UPDATE - New code at the bottom I'm trying to figure out how to
I'm trying to update a table based upon the user id from another table.
I'm trying to update one textfield from another class: I have two classes: @interface
I am trying to update some rows in an oracle Database, using an OLEDB

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.