Click here to Skip to main content
16,005,162 members
Home / Discussions / C#
   

C#

 
QuestionComClass in C# Pin
Saranya B26-Aug-08 23:37
Saranya B26-Aug-08 23:37 
Questionhow can i change machain date Pin
Mohammed Elkholy26-Aug-08 23:30
Mohammed Elkholy26-Aug-08 23:30 
JokeRe: how can i change machain date Pin
Manas Bhardwaj27-Aug-08 0:07
professionalManas Bhardwaj27-Aug-08 0:07 
GeneralRe: how can i change machain date Pin
Mohammed Elkholy27-Aug-08 5:14
Mohammed Elkholy27-Aug-08 5:14 
AnswerRe: how can i change machain date Pin
varun_mca_ju27-Aug-08 0:39
varun_mca_ju27-Aug-08 0:39 
AnswerRe: how can i change machain date Pin
lisan_al_ghaib27-Aug-08 0:49
lisan_al_ghaib27-Aug-08 0:49 
GeneralRe: how can i change machain date Pin
Mohammed Elkholy27-Aug-08 5:16
Mohammed Elkholy27-Aug-08 5:16 
GeneralRe: how can i change machain date Pin
lisan_al_ghaib27-Aug-08 5:49
lisan_al_ghaib27-Aug-08 5:49 
There is a little fix :
correct solution

public class Win32
    {
        private Win32()
        {
        }

        [StructLayout(LayoutKind.Sequential)]
        public struct SystemTime
        {
            [MarshalAs(UnmanagedType.U2)]
            public short Year;
            [MarshalAs(UnmanagedType.U2)]
            public short Month;
            [MarshalAs(UnmanagedType.U2)]
            public short DayOfWeek;
            [MarshalAs(UnmanagedType.U2)]
            public short Day;
            [MarshalAs(UnmanagedType.U2)]
            public short Hour;
            [MarshalAs(UnmanagedType.U2)]
            public short Minute;
            [MarshalAs(UnmanagedType.U2)]
            public short Second;
            [MarshalAs(UnmanagedType.U2)]
            public short Milliseconds;
        }

        [DllImport("kernel32.dll")]
        public static extern void GetLocalTime(
        out SystemTime systemTime);

        [DllImport("kernel32.dll")]
        public static extern void GetSystemTime(
        out SystemTime systemTime);

        [DllImport("kernel32.dll")]
        public static extern bool SetSystemTime(
        ref SystemTime systemTime);

        [DllImport("kernel32.dll")]
        public static extern bool SetLocalTime(
        ref SystemTime systemTime);
    }

....
in you method  do this : 
            Win32.SystemTime sysTime;
           
            sysTime.Day = 13;
           // do all needed modification on date and time...
           //....

            Win32.SetSystemTime(ref sysTime);




Make sure that you got admin rights.
QuestionClass inheritance question Pin
Mc_Topaz26-Aug-08 23:17
Mc_Topaz26-Aug-08 23:17 
AnswerRe: Class inheritance question Pin
Manas Bhardwaj26-Aug-08 23:19
professionalManas Bhardwaj26-Aug-08 23:19 
AnswerRe: Class inheritance question Pin
lisan_al_ghaib26-Aug-08 23:35
lisan_al_ghaib26-Aug-08 23:35 
AnswerRe: Class inheritance question Pin
Saranya B26-Aug-08 23:46
Saranya B26-Aug-08 23:46 
AnswerRe: Class inheritance question Pin
Pete O'Hanlon27-Aug-08 0:41
mvePete O'Hanlon27-Aug-08 0:41 
QuestionRe: Class inheritance question, new explanation Pin
Mc_Topaz27-Aug-08 1:19
Mc_Topaz27-Aug-08 1:19 
AnswerRe: Class inheritance question, new explanation Pin
lisan_al_ghaib27-Aug-08 1:36
lisan_al_ghaib27-Aug-08 1:36 
GeneralRe: Class inheritance question, new explanation Pin
Mc_Topaz27-Aug-08 3:52
Mc_Topaz27-Aug-08 3:52 
AnswerRe: Class inheritance question, new explanation Pin
Colin Angus Mackay27-Aug-08 1:46
Colin Angus Mackay27-Aug-08 1:46 
AnswerRe: Class inheritance question, new explanation Pin
Pete O'Hanlon27-Aug-08 2:08
mvePete O'Hanlon27-Aug-08 2:08 
AnswerRe: Class inheritance question Pin
#realJSOP27-Aug-08 2:55
professional#realJSOP27-Aug-08 2:55 
GeneralRe: Class inheritance question Pin
Pete O'Hanlon27-Aug-08 3:26
mvePete O'Hanlon27-Aug-08 3:26 
Question8-O fixing C# class in unsafe code block??? Pin
Chesnokov Yuriy26-Aug-08 22:55
professionalChesnokov Yuriy26-Aug-08 22:55 
AnswerRe: 8-O fixing C# class in unsafe code block??? Pin
lisan_al_ghaib26-Aug-08 23:32
lisan_al_ghaib26-Aug-08 23:32 
AnswerRe: 8-O fixing C# class in unsafe code block??? Pin
Chesnokov Yuriy27-Aug-08 0:50
professionalChesnokov Yuriy27-Aug-08 0:50 
AnswerRe: 8-O fixing C# class in unsafe code block??? Pin
Nicholas Butler27-Aug-08 0:27
sitebuilderNicholas Butler27-Aug-08 0:27 
AnswerRe: 8-O fixing C# class in unsafe code block??? Pin
Chesnokov Yuriy27-Aug-08 0:56
professionalChesnokov Yuriy27-Aug-08 0:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.