Windows 10: Announcing Rust for Windows v0.9

Discus and support Announcing Rust for Windows v0.9 in Windows 10 News to solve the problem; Rust for Windows v0.9 has recently been released and includes full consumption support, along with several other updates! With completed consumption... Discussion in 'Windows 10 News' started by Brink, May 6, 2021.

  1. Brink Win User

    Announcing Rust for Windows v0.9


    Rust for Windows v0.9 has recently been released and includes full consumption support, along with several other updates! With completed consumption support, you can now call any Windows APIs (past, present, and future) using the Rust language projection. Rust developers have access to the entire Windows API surface in a language-idiomatic way, allowing them to easily take advantage of the power and breadth of Windows development.

    Along with this latest release, we have added new content to Microsoft Docs on developing with Rust on Windows. There is also a new https://youtu.be/-oZrsCPKsn4 video for those who want to dive in! For more information on the project, check out the Rust for Windows Github repo.

    Updates and Improvements

    We have made great progress since last year’s Rust/WinRT public preview announcement, with continued improvements and investment in the project. Some of the changes and updates since this last announcement include:

    • Added support for Win32 and COM APIs, unifying the Windows APIs available for consumption via the windows crate. The addition of these APIs is enabled by the win32metadata project. With this increased coverage and unification of Windows APIs, we changed the name of the project from “Rust/WinRT” to “Rust for Windows”.
    • Added several examples to the Rust for Windows repo, demonstrating how to call a wide range of Windows APIs (includes Win32, COM, and WinRT APIs).
    • The windows crate is published on crates.io and is now dual-licensed under MIT or Apache.
    • The windows crate now uses generated bindings rather than hand-written bindings internally.
    • The windows crate now builds on Linux.
    • Many improvements and fixes for Win32 APIs, such as support for array types, a variety of string types, and updated metadata.
    • Added more natural and idiomatic support for COM interfaces such as with return values, and support for additional APIs involving things like C-style unions and nested types.
    • Improved build times and error handling.
    • Original API case is now preserved, which will affect existing code using the windows crate.
    • Transformed QueryInterface-like functions into generic functions, making it safer and more convenient to call many COM-related functions.

    For more details and a more comprehensive list of updates, look at the changelog on the Rust for Windows repo.

    A simple example: Win32 APIs in Rust

    We have recently added support for calling Win32 APIs in Rust, so I will walk through a simple example calling the MessageBox function. First make sure you have your Rust development environment set up, which you can do by following these docs. The code for this example can also be found here.

    To begin, I created a new Rust project by running the following command in a command prompt:

    Code:
    This creates a new directory with the starter files for my Rust project. Navigate to this new directory, and create a nested bindings crate using the command below to house the generated bindings. By doing this, the build can cache the results of any imported bindings.

    Code:
    Now opening my project in Visual Studio Code, the directory structure looks like this.

    Announcing Rust for Windows v0.9 rust1.png

    In the outer Cargo.toml file directly under the message_box directory, add the following dependency which tells Cargo that it now depends on the newly created bindings library.

    Code:
    Now in the Cargo.toml file underneath the bindings folder, add the following dependencies to add the windows crate. This will allow Cargo to download, build, and cache Windows support as a package.

    Code:
    Next, in Visual Studio Code I created a new file directly under the bindings folder named build.rs. In this file, use the windows::build macro to specify the types that you want to use as shown below. You can list any additional APIs you want to use in this build script. The windows crate will then generate the necessary bindings directly from metadata.

    Code:
    Next in the lib.rs file under bindings/src, remove the default code and add the following line, which includes the source code generated by build.rs.

    Code:
    In the main.rs file, you can now make use of any of the specified Windows APIs. Paste the following code, which creates a message box with a “Hello World” message. Note that any Win32 functions and COM interface methods should be marked unsafe.

    use bindings::Windows::Win32::WindowsAndMessaging::{MessageBoxA, MESSAGEBOX_STYLE};

    Code:
    Run cargo build and then cargo run on a command prompt from the root directory of the sample, and you will see the following output!

    Announcing Rust for Windows v0.9 messagebox.png

    Get started today

    We are excited about all the new improvements and capabilities with the latest Rust for Windows update. Get started today with developing Rust applications on Windows (and for Windows) with the latest documentation on Microsoft Docs. For a hands-on tutorial check out this Getting Started video created by Kenny Kerr.




    Closing

    We have made great progress with Rust for Windows over the last year, and we are continuing to invest in the project to make building Windows apps easy for Rust developers. Up next, we are working on Rust authoring support both for COM interfaces and WinRT components, so stay tuned. We encourage you to reach out with any issues, feedback, or questions on the Rust for Windows Github repo!


    Source: https://blogs.windows.com/windowsdev...-windows-v0-9/

    :)
     
    Brink, May 6, 2021
    #1
  2. Joe Men Win User

    called announce

    I have provided the steps on how you can enable the Use Speech to announce caller ID in my initial response.

    For your convenience, here the detailed steps:

    • Launch the Settings app.
    • Tap Ease of Access.
    • Tap More options.
    • Tap the On/Off slider under the Use Speech to announce caller ID to set it on or off.
    Feel free to post back if you need further assistance.
     
    Joe Men, May 6, 2021
    #2
  3. windows xp installation and dual core am

    could someone please list the steps they follow to install windows with a dual core processor and windows xp service pack to. I'm reletively new to amd dual core and i feel i'm missing a step. All help will be appreciated. thanx
     
    exodusprime1337, May 6, 2021
    #3
  4. miahallen Win User

    Announcing Rust for Windows v0.9

    miahallen, May 6, 2021
    #4
Thema:

Announcing Rust for Windows v0.9

Loading...
  1. Announcing Rust for Windows v0.9 - Similar Threads - Announcing Rust

  2. parsons technology announcements 7.1 cannot un on WIN 11

    in Windows 10 Gaming
    parsons technology announcements 7.1 cannot un on WIN 11: Parsons Technology Announcements 7.1 cannot run on WIN 11. It has ran on all windows versions I have ever owned. What can be done to make it compact. I never had it on win 10...
  3. parsons technology announcements 7.1 cannot un on WIN 11

    in Windows 10 Software and Apps
    parsons technology announcements 7.1 cannot un on WIN 11: Parsons Technology Announcements 7.1 cannot run on WIN 11. It has ran on all windows versions I have ever owned. What can be done to make it compact. I never had it on win 10...
  4. Dell's Windows 11 version 24H1 announcement causes confusion

    in Windows 10 News
    Dell's Windows 11 version 24H1 announcement causes confusion: Microsoft is already making it difficult to keep up with the different Windows builds and versions that the company releases. There are feature updates, Moment updates, cumulative updates, optional updates and even accidental updates. It does not help that Microsoft is tight...
  5. How to make IAccessibility announce custom string on a certain event?

    in Windows 10 Gaming
    How to make IAccessibility announce custom string on a certain event?: Need to know if there is a way to post a string to IAccessibilty at my convenience.I need some kind of similar functionality of NSAccessibilityPostNotification on Mac....
  6. How to make IAccessibility announce custom string on a certain event?

    in Windows 10 Software and Apps
    How to make IAccessibility announce custom string on a certain event?: Need to know if there is a way to post a string to IAccessibilty at my convenience.I need some kind of similar functionality of NSAccessibilityPostNotification on Mac....
  7. Windows 12 Announcement Date

    in Windows 10 Gaming
    Windows 12 Announcement Date: Hello Please to Announce Windows 12 in the Future. Please Help Someone ? https://answers.microsoft.com/en-us/windows/forum/all/windows-12-announcement-date/fc9da492-de5f-46aa-b429-d3a157aea0d9
  8. Windows 12 Announcement Date

    in Windows 10 Software and Apps
    Windows 12 Announcement Date: Hello Please to Announce Windows 12 in the Future. Please Help Someone ? https://answers.microsoft.com/en-us/windows/forum/all/windows-12-announcement-date/fc9da492-de5f-46aa-b429-d3a157aea0d9
  9. Windows 12 Announcement Betas

    in Windows 10 Gaming
    Windows 12 Announcement Betas: Hello Please Windows 12 to Announcement betas in Windows 11 End of Support in January, 13 2032 put of by Bill Gates. Please Help Someone ? https://answers.microsoft.com/en-us/windows/forum/all/windows-12-announcement-betas/96364401-d58c-4f81-9904-326f1a5763c1
  10. Windows 12 Announcement Betas

    in Windows 10 Software and Apps
    Windows 12 Announcement Betas: Hello Please Windows 12 to Announcement betas in Windows 11 End of Support in January, 13 2032 put of by Bill Gates. Please Help Someone ? https://answers.microsoft.com/en-us/windows/forum/all/windows-12-announcement-betas/96364401-d58c-4f81-9904-326f1a5763c1