locked
Where is the Windows.System.Threading namespace?

    Question

  • I am trying to implement a simulation and need some Threads/Timers etc. According to the windows runtime reference (http://msdn.microsoft.com/en-us/library/windows/apps/windows.system.threading.aspx) there should be a Windows.System.Threading namespace. I probably could use the ThreadPoolTimer class.

    If I am trying to use that namespace in Visual Studio 2012 Express Developer Preview compiling failes.

    I know that the Win32 API can not be used for that. Do I have to look in the .NET classes (I am familiar with that framework)?

    Thanks for your time. - Martin



    Monday, January 02, 2012 3:44 AM

Answers

All replies

  • Hi Martin,

     

    Add this reference:

    #using "Windows.System.Threading.winmd"
    
    using namespace Windows::System::Threading;
    

    For an example of how to use the namespace in C++, you can reference this thread to get you started:

    http://social.msdn.microsoft.com/Forums/en-US/winappswithnativecode/thread/5a6b98b5-f8f1-4b8b-9191-2f17c7d18e6e

     

    Thanks,

    -David

    Tuesday, January 03, 2012 10:09 PM
    Moderator
  • The Windows.System.Threading namespace should not be causing any problems.

    It is used very often in the sample projects, especially in the SuspensionManager class.  Take a look at the Basic Tiles Sample.

    Tuesday, January 03, 2012 10:26 PM
  • The Basic Tiles Samples is only available in C# and JavaScript.

    The problem is that 'using namespace Windows::System::Threading' gives an compile error: "C2039: 'Threading' : is not a member of 'Windows::System'.

    Wednesday, January 04, 2012 1:47 PM
  • Yes this does solve the problem indeed.

    This needs to be documented. As for a beginner this is impossible to discover. I did the following:

    [1] Create an empty Metro Style application in C++ in Visual Studio 2011 Ultimate

    [2] Added one line 'using namespace Windows::System::Threading'.

    [3] That resulted in a compile error that the 'Threading' namesspace is not part of Windows::System namespace.

    What other #using directives are available?

     

    Thanks for your time.

    - Martin

    Wednesday, January 04, 2012 1:54 PM
  • Hi... I have a similar issue.  Im trying to move an old VB program over to the new VS 2012 RC.  What a pain in the behind.   (looking for the threading  Imports statement) 

    So far... the references don't work for

        colors,   Key  (enumeration for keypresses), threading, string functions like trim,  and more

    I have locate some in Windows.UI 

    What makes it even more irritating is that people put out code snippits, but rarely add the imports or using statements. 

    Yes, its an RC version, but he Doco is not helpful at all, or I just don't know how to get to the 2012 things.

    So, If you find the reference, post it.  I can usually translate it from C# to VB.

    Wednesday, July 18, 2012 10:50 PM