Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

C++ Project

  • 20-01-2011 6:25pm
    #1
    Registered Users, Registered Users 2 Posts: 1,686 ✭✭✭


    Hi

    I am working on a vc++ project and I am having problem coding for a ticking clock.
    #include <time.h>
    
    String^ getClock()
    	{
    		SYSTEMTIME date;//@SYSTEMTIME: Specifies a date and time, using individual members for the month, day, year, weekday, hour, minute, second, and millisecond. 
                    GetSystemTime(&date);//@GetSystemTime: Function that retrieves the current system date and time.
    		String^ clock;
    
    		int theSec(date.wSecond);
    		int theMin(date.wMinute);
    		int theHour(date.wHour);
    
    		
    		clock = Convert::ToString(theHour+":"+theMin+":"+theSec);
    
    		return clock;
    	}
    

    I tried using the timer->tick but I got tones of error.


Comments

  • Registered Users, Registered Users 2 Posts: 1,686 ✭✭✭RealistSpy


    I can't get the clock to tick


  • Registered Users, Registered Users 2 Posts: 1,686 ✭✭✭RealistSpy


    Mark this as solved very silly fix.


  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    What's the fix? Somebody is going to come here looking for an answer.


  • Registered Users, Registered Users 2 Posts: 1,686 ✭✭✭RealistSpy


    //timer-tick event handler
    private: System::Void timer_Tick(System::Object^  sender, System::EventArgs^  e) {
    
                    //needs to be called in a timer-tick event handler
    		SYSTEMTIME date;//@SYSTEMTIME: Specifies a date and time, using individual members for the month, day, year, weekday, hour, minute, second, and millisecond. 
    		GetSystemTime(&date);//@GetSystemTime: Function that retrieves the current system date and time.
    
    		String^ clock;
    
    		int theSec(date.wSecond);
    		int theMin(date.wMinute);
    		int theHour(date.wHour);
    
    		clock = Convert::ToString(theHour+":"+theMin+":"+theSec);
    
    	        clockToolStripStatusLabel->Text = Convert::ToString(clock);
    		 }
    


Advertisement