Guru3D.com Forums

Go Back   Guru3D.com Forums > Affiliates > MSI AfterBurner Overclock Application Discussion forum
MSI AfterBurner Overclock Application Discussion forum This forum is intended for MSI customers for questions on the AfterBurner Overclock Utility based off Rivatuner. In this section the users help each other out with answers as well as support staff from MSI.



Reply
 
Thread Tools Display Modes
MSI Afterburner .NET Class Library
Old
  (#1)
stangowner
Master Guru
 
stangowner's Avatar
 
Videocard: 2xMSI N550GTX-Ti Cy II OC
Processor: Intel Core i7-3960X
Mainboard: MSI X79A-GD45
Memory: 16GB Corsair Vengence
Soundcard: X-Fi Plat Fatal1ty Champ
PSU: Antec 850w
Default MSI Afterburner .NET Class Library - 02-27-2011, 23:42 | posts: 586 | Location: MA

Current Version: 1.1.0.0
Download Library: MSIAfterburner.NET.dll
Documentation: Compiled HTML Help (.chm) or View Online
Last Updated: May 2, 2012

_________________________________________________
original post:

Hi guys,

I'm finishing up a class library to expose the new Control API in MSI Afterburner 2.1 to .NET languages. This will allow you to communicate with Afterburner from any .NET language (C++/CLI, C#, VB.net) without having to deal with the shared memory aspects of the process. You can just add a reference to this library and access the data via standard class properties and methods.

I'll post it here shortly, I just have to do some further testing. In the meantime, take a look what's available and let me know if I missed anything. I'll post more details (like which properties are read-only vs read/write, what raises the exceptions, example code, etc) when I post the library.

Thanks!
Nick


Last edited by stangowner; 05-02-2012 at 10:10. Reason: updated from 1.0.2 to 1.1.0
   
Reply With Quote
 
Old
  (#2)
Unwinder
Moderator
 
Videocard:
Processor:
Mainboard:
Memory:
Soundcard:
PSU:
Default 02-28-2011, 06:59 | posts: 12,997 | Location: Taganrog, Russia

Good job, Nick.


Alexey Nicolaychuk aka Unwinder, RivaTuner creator
   
Reply With Quote
Old
  (#3)
Garu
Newbie
 
Videocard: nvidia 8200M G
Processor: Intel Core 2 Duo
Mainboard:
Memory:
Soundcard:
PSU: portable psu
Default 03-01-2011, 19:58 | posts: 4

Very good job , i try to use this in some application
   
Reply With Quote
Old
  (#4)
Zaph0d_B
Newbie
 
Videocard:
Processor:
Mainboard:
Memory:
Soundcard:
PSU:
Default 03-03-2011, 22:03 | posts: 9

Quote:
Originally Posted by stangowner View Post
Hi guys,

I'm finishing up a class library to expose the new Control API in MSI Afterburner 2.1 to .NET languages. This will allow you to communicate with Afterburner from any .NET language (C++/CLI, C#, VB.net) without having to deal with the shared memory aspects of the process. You can just add a reference to this library and access the data via standard class properties and methods.

I'll post it here shortly, I just have to do some further testing. In the meantime, take a look what's available and let me know if I missed anything. I'll post more details (like which properties are read-only vs read/write, what raises the exceptions, example code, etc) when I post the library.

Thanks!
Nick

look great where to download ? pls ! i need it
   
Reply With Quote
 
Old
  (#5)
stangowner
Master Guru
 
stangowner's Avatar
 
Videocard: 2xMSI N550GTX-Ti Cy II OC
Processor: Intel Core i7-3960X
Mainboard: MSI X79A-GD45
Memory: 16GB Corsair Vengence
Soundcard: X-Fi Plat Fatal1ty Champ
PSU: Antec 850w
Default 03-03-2011, 23:27 | posts: 586 | Location: MA

I have not posted it yet.....was just asking for feedback before posting. I'm finishing up the documentation and doing some final testing now.

I may make 2 changes to it first though:

1 - I wrote this using the new MemoryMappedFile in .NET 4. I think I'm going to change this to import the functions from the kernel instead so it will work with older versions of .NET. I don't like the idea of having .NET 4 and Visual Studio 2010 a requirement.

2 - I'm also going to add classes for accessing the hardware monitoring memory that was exposed in Afterburner 1.5/2.1. Not sure if I will add this now or in the next release. If now, it will delay release a few weeks.

Did the library seem complete from what you can tell so far? Anything in particular you are planning on using it for?
   
Reply With Quote
Old
  (#6)
Garu
Newbie
 
Videocard: nvidia 8200M G
Processor: Intel Core 2 Duo
Mainboard:
Memory:
Soundcard:
PSU: portable psu
Default 03-05-2011, 22:25 | posts: 4

i wanna use for a simple auto-overclock tool in vb.net , using this library and opengl. with integrated bechmark and stress for gpu and cpu.

sorry for bad english
   
Reply With Quote
Old
  (#7)
stangowner
Master Guru
 
stangowner's Avatar
 
Videocard: 2xMSI N550GTX-Ti Cy II OC
Processor: Intel Core i7-3960X
Mainboard: MSI X79A-GD45
Memory: 16GB Corsair Vengence
Soundcard: X-Fi Plat Fatal1ty Champ
PSU: Antec 850w
Default 03-10-2011, 11:54 | posts: 586 | Location: MA

I have finished creating an internal memory management class, so I am no longer using the MemoryMappedFile class in .NET 4. This library was compiled against version 2.0.50727 so it only requires .NET v2 or later.

I released this as a 0.9.0.0, because I have not yet added the hardware monitoring classes. Currently, it only contains classes for the new Control Memory access. However, I did add binary and XML serialization capabilities. Once I complete the other classes, I'll release it as version 1.

I just posted the class library and documentation in the first post.

The documentation includes a C# console application example that demonstrates:
  • printing the header and GPU entry information
  • saving profiles using serialization
  • reading and changing the fan speed - including capturing the exception if the fan is set to auto
  • reading and changing the core clock speed
  • undoing the changes by deserializing the previously saved profile and applying it
Feel free to start using it and let me know if you find any issues with the library or documentation.

Thanks,
Nick

Last edited by stangowner; 03-10-2011 at 11:56.
   
Reply With Quote
Old
  (#8)
Garu
Newbie
 
Videocard: nvidia 8200M G
Processor: Intel Core 2 Duo
Mainboard:
Memory:
Soundcard:
PSU: portable psu
Default 03-15-2011, 19:07 | posts: 4

Sorry strangowner but i have a problem with the library, i'm using vb.net with visual basic 2010.

this is the code:
Quote:
Dim ControlMemory = New ControlMemory
Dim i = ControlMemory.GpuEntries(0).CoreClockCur
Me.Text = i
but the error is: "Could not connect to MSI Afterburner 2.1 or later."

i have wrong something ?
   
Reply With Quote
Old
  (#9)
stangowner
Master Guru
 
stangowner's Avatar
 
Videocard: 2xMSI N550GTX-Ti Cy II OC
Processor: Intel Core i7-3960X
Mainboard: MSI X79A-GD45
Memory: 16GB Corsair Vengence
Soundcard: X-Fi Plat Fatal1ty Champ
PSU: Antec 850w
Default 03-15-2011, 19:11 | posts: 586 | Location: MA

I'll try VB 2010 later tonight and let you know.
   
Reply With Quote
Old
  (#10)
stangowner
Master Guru
 
stangowner's Avatar
 
Videocard: 2xMSI N550GTX-Ti Cy II OC
Processor: Intel Core i7-3960X
Mainboard: MSI X79A-GD45
Memory: 16GB Corsair Vengence
Soundcard: X-Fi Plat Fatal1ty Champ
PSU: Antec 850w
Default 03-15-2011, 23:44 | posts: 586 | Location: MA

That error is stating that it can't connect to Afterburner's shared memory. You do have Afterburner running, right? I raise that exception if it isn't.

I'm not having any issues with it. I created a new console app in Visual Basic 2010 Express. Then I added the reference to the MSIAfterburner.NET.dll library.

Here is the complete code for the program
Code:
Imports MSI.Afterburner
Module Module1

    Sub Main()
        Dim ControlMemory = New ControlMemory
        Dim i = ControlMemory.GpuEntries(0).CoreClockCur
        Console.WriteLine("Current clock speed for GPU 0 is: " + i.ToString)
        Console.ReadKey()
    End Sub

End Module
And here is the result:
Code:
Current clock speed for GPU 0 is: 650000
Let me know how you make out. If you still have a problem, I need more info. I'm passing the original exception as the inner exception. Can you check that and see if it is: "The system cannot find the file specified" ? Or something else?

EDIT:
BTW, you should not use class names as variable names. Although that worked, I would change it to:
Dim macm = New ControlMemory
Dim i = macm.GpuEntries(0).CoreClockCur

Last edited by stangowner; 03-15-2011 at 23:49.
   
Reply With Quote
Old
  (#11)
Garu
Newbie
 
Videocard: nvidia 8200M G
Processor: Intel Core 2 Duo
Mainboard:
Memory:
Soundcard:
PSU: portable psu
Default 03-16-2011, 15:24 | posts: 4

sorry for the inconvenience, but I did not know it worked only with afterburner open, I thought it was 'independent'.
the library now works.

Last edited by Garu; 03-16-2011 at 15:27.
   
Reply With Quote
Old
  (#12)
stangowner
Master Guru
 
stangowner's Avatar
 
Videocard: 2xMSI N550GTX-Ti Cy II OC
Processor: Intel Core i7-3960X
Mainboard: MSI X79A-GD45
Memory: 16GB Corsair Vengence
Soundcard: X-Fi Plat Fatal1ty Champ
PSU: Antec 850w
Default 03-16-2011, 16:12 | posts: 586 | Location: MA

Quote:
Originally Posted by Garu View Post
sorry for the inconvenience, but I did not know it worked only with afterburner open, I thought it was 'independent'.
de library now works.
i'm looking for a way to make them independent.
No, its not independent. It reads and writes to Afterburner's shared memory. Without Afterburner running, the shared memory files do not exist.

There is no way to split these. To have something independent would require that it be part of the Afterburner's core (an API Unwinder would have to provide). He exposed this functionality using shared memory as an IPC, and this library is a .NET wrapper for it so you don't have to worry about the memory management aspects of the process.
   
Reply With Quote
Old
  (#13)
Zaph0d_B
Newbie
 
Videocard:
Processor:
Mainboard:
Memory:
Soundcard:
PSU:
Default 03-19-2011, 17:12 | posts: 9

hi,

is it possible to read GPU temp and GPU usage ???

/inteks


BTW. here the code i use start MSI Afterburner , x86/x64 , init ControlMemory .....

maybe it helps

Code:
 private static string _afterburnerInstallPath;
        public static string AfterburnerInstallPath
        {
            get
            {
                if(string.IsNullOrEmpty(_afterburnerInstallPath))
                {
                    try
                    {
                        RegistryKey aKey;
                        if (IntPtr.Size == 8)
                        {
                             aKey = Registry.LocalMachine.CreateSubKey("Software").CreateSubKey("Wow6432Node").CreateSubKey("MSI").CreateSubKey("Afterburner");
                        }else
                        {
                            aKey = Registry.LocalMachine.CreateSubKey("Software").CreateSubKey("MSI").CreateSubKey("Afterburner");
                        }


                        _afterburnerInstallPath = aKey.GetValue("InstallPath").ToString();
                    }catch
                    {
                    }
                }
                return _afterburnerInstallPath;
            }
            set { _afterburnerInstallPath = value; }
        }



public static bool SetOverclock(int coreFsb, int memoryFsb)
        {
            if (Process.GetProcessesByName("MSIAfterburner").Length == 0)
            {
                Execute(AfterburnerInstallPath, "");
            }
            DateTime start = DateTime.Now;
            ControlMemory macm = null;

            do
            {
                Thread.Sleep(150);
                try
                {
                    macm = new ControlMemory();
                }
                catch
                {
                }
                if ((DateTime.Now - start).TotalSeconds > 5)
                {
                    IO.AddLog("cant connect afterburner");
                    return false;
                }
            } while (macm == null);


            try
            {
                macm.Connect();
                macm.GpuEntries[0].CoreClockCur = (uint) (coreFsb*1000);
                macm.GpuEntries[0].MemoryClockCur = (uint) (memoryFsb*1000);
                macm.CommitChanges();
                macm.Disconnect();
            }
            catch
            {
                IO.AddLog("cant apply afterburnner setting");
            }
            return true;
        }

Last edited by Zaph0d_B; 03-19-2011 at 17:16.
   
Reply With Quote
Old
  (#14)
stangowner
Master Guru
 
stangowner's Avatar
 
Videocard: 2xMSI N550GTX-Ti Cy II OC
Processor: Intel Core i7-3960X
Mainboard: MSI X79A-GD45
Memory: 16GB Corsair Vengence
Soundcard: X-Fi Plat Fatal1ty Champ
PSU: Antec 850w
Default 03-19-2011, 18:16 | posts: 586 | Location: MA

Quote:
Originally Posted by Zaph0d_B View Post
hi,

is it possible to read GPU temp and GPU usage ???
.....
Not yet. This is the first half of the library which is just for the Control Memory. This lets you programatically interact with the left side of the Afterburner interface (read and set voltages, clocks and fan).

I'll be adding the second half of the library in the upcoming weeks. This will include the classes for reading the hardware monitoring information - the right half of the Afterburner interface (temps, speeds, FPS, usage, etc).

I'll mention here when I post the update. I just need to finish another project first before I can get to this.

Quote:
Originally Posted by Zaph0d_B View Post
BTW. here the code i use start MSI Afterburner , x86/x64 , init ControlMemory .....
Thanks for posting the code. Maybe I'll add some additional capabilities in the future. But for instance, the "SetOverclock" method you posted would need to be overloaded to deal with the shader clock in case it is not linked to the core, have an additional argument for gpu index for SLI/CrossFire modes (and deal with Sync setting for Master/slave scenarios), etc, etc. There are a lot of possibilities. I don't have the time ATM to code them all. So for now - you get access to all these properties for all GPUs, and just change the properties you want before telling it to commit (as you are doing).

Let me know if you have any other question, comments or issues.

Thanks,
Nick
   
Reply With Quote
Old
  (#15)
stangowner
Master Guru
 
stangowner's Avatar
 
Videocard: 2xMSI N550GTX-Ti Cy II OC
Processor: Intel Core i7-3960X
Mainboard: MSI X79A-GD45
Memory: 16GB Corsair Vengence
Soundcard: X-Fi Plat Fatal1ty Champ
PSU: Antec 850w
Default 04-30-2011, 04:03 | posts: 586 | Location: MA

The 2nd half of the library is now complete. This update includes the new classes for hardware monitoring. No notable changes were made to the Control Memory classes since 0.9.

The links in the first post have been updated.

Here is the help file TOC with the additions in this release highlighted.



Let me know if you have any questions.

- Nick
   
Reply With Quote
Old
  (#16)
Unwinder
Moderator
 
Videocard:
Processor:
Mainboard:
Memory:
Soundcard:
PSU:
Default 04-30-2011, 10:06 | posts: 12,997 | Location: Taganrog, Russia

Well done, Nick. Making the thread sticky.


Alexey Nicolaychuk aka Unwinder, RivaTuner creator
   
Reply With Quote
Old
  (#17)
stangowner
Master Guru
 
stangowner's Avatar
 
Videocard: 2xMSI N550GTX-Ti Cy II OC
Processor: Intel Core i7-3960X
Mainboard: MSI X79A-GD45
Memory: 16GB Corsair Vengence
Soundcard: X-Fi Plat Fatal1ty Champ
PSU: Antec 850w
Default 05-08-2011, 10:47 | posts: 586 | Location: MA

DLL was updated to 1.0.1 to resolve an issue where auxVoltageBoostMax was not correct when serializing ControlMemoryGpuEntry objects.
   
Reply With Quote
Old
  (#18)
rewt
Maha Guru
 
Videocard: √
Processor: √
Mainboard: √
Memory: √
Soundcard: √
PSU: √
Default 06-25-2011, 09:50 | posts: 1,245 | Location: Americas

Wow Nick, this is truly impressive work! Even the documentation is pretty

Were you planning on implementing "RTSSSharedMemoryV2"?
   
Reply With Quote
Old
  (#19)
stangowner
Master Guru
 
stangowner's Avatar
 
Videocard: 2xMSI N550GTX-Ti Cy II OC
Processor: Intel Core i7-3960X
Mainboard: MSI X79A-GD45
Memory: 16GB Corsair Vengence
Soundcard: X-Fi Plat Fatal1ty Champ
PSU: Antec 850w
Default 06-25-2011, 12:45 | posts: 586 | Location: MA

Quote:
Originally Posted by rewt View Post
Wow Nick, this is truly impressive work! Even the documentation is pretty

Were you planning on implementing "RTSSSharedMemoryV2"?
Thanks. Have you used it, or just reviewed the information?

I was not planning on adding that, but could. You want to be able to contribute to the OSD from .NET languages?

I'll be honest though. I have my hands full with other projects at the moment. It will be a couple months before I can even look at implementing this.
   
Reply With Quote
Old
  (#20)
timiman
Newbie
 
Videocard: 2xR9-290 Asus DCU-II
Processor: AMD FX-8320@4.1GHz
Mainboard: Asus M5A99X EVO R2.0
Memory: 16GB/DDR3-1866
Soundcard:
PSU: Corsair 1KW
Default 06-25-2011, 14:06 | posts: 37 | Location: Greece

I have made an application (G15/G19 Smart Process) that was using the logging functionality of both Rivatuner/MSI Afterburner to read the values of the sensors, which was causing a lot of problems and finally the "silently" stopping of the logging (access errors etc).

Now, I've just finished the implementation of this .dll to my application, to read the sensors' values without the usage of the logging.

Great job and many thanks to the "maker"!!!

PS1. Using it in .Net VB
PS2. Now I wish for "Speedfan" to have a .dll like this!!!
   
Reply With Quote
Old
  (#21)
rewt
Maha Guru
 
Videocard: √
Processor: √
Mainboard: √
Memory: √
Soundcard: √
PSU: √
Default 06-25-2011, 14:27 | posts: 1,245 | Location: Americas

Quote:
Originally Posted by stangowner View Post
Thanks. Have you used it, or just reviewed the information?
Both

I added references to a VS 2010 C# project of mine and it worked like a charm. However at this time my project only relates to the RTSS and OSD shared memory, so I am still having to do quite a bit of work porting over Unwinder's C++ code (but overall it's much less work than rewriting my application in C++).
   
Reply With Quote
Old
  (#22)
Haldi
Master Guru
 
Videocard: R9-290 CF
Processor: I7-3930k
Mainboard: Asus P7X79 Pro
Memory: 40gb Kingston
Soundcard:
PSU: Enermax MaxRevo 1500W
Default 02-14-2012, 17:39 | posts: 227

Hei, I have a question.
I'm don't realy have the knowledge on .NET Basis... but:
Is it somehow possible to change the FPS Limiter directly ? Activate / Set Max FPS an such? That's not part of MSI Afterburner but from the rtss right?

If no, would it be possible with the MSI Remote server to set FPS limit ?
   
Reply With Quote
Old
  (#23)
Unwinder
Moderator
 
Videocard:
Processor:
Mainboard:
Memory:
Soundcard:
PSU:
Default 02-14-2012, 17:41 | posts: 12,997 | Location: Taganrog, Russia

No, it is impossible


Alexey Nicolaychuk aka Unwinder, RivaTuner creator
   
Reply With Quote
Old
  (#24)
stangowner
Master Guru
 
stangowner's Avatar
 
Videocard: 2xMSI N550GTX-Ti Cy II OC
Processor: Intel Core i7-3960X
Mainboard: MSI X79A-GD45
Memory: 16GB Corsair Vengence
Soundcard: X-Fi Plat Fatal1ty Champ
PSU: Antec 850w
Default 03-26-2012, 11:26 | posts: 586 | Location: MA

This library was updated to resolve an issue preventing changes to ControlMemory from being applied to subsequent gpus in multi-gpu systems using MSI Afterburner 2.2.0 beta 14 or later.

Links in the first post have been updated.
   
Reply With Quote
Old
  (#25)
adibe
Newbie
 
Videocard: nVidia GTX 680
Processor: Intel Core 2 i7 2600k
Mainboard:
Memory:
Soundcard:
PSU: 600W
Default 04-07-2012, 15:46 | posts: 1

Hello,

Could you please implement the frequency boost options present in the MSI Afterburner 2.2.0 beta 15?

I want to use your library with the nVidia GeForce GTX 680, but it's frequencies are modified via dwCoreClockBoostCur and dwMemoryClockBoostCur and not dwCoreClockCur and dwMemoryClockCur.

The actual values in MACMSharedMemory.h:
Code:
	//clock boost control

	LONG dwCoreClockBoostCur;
		//current core clock boost in KHz
	LONG dwCoreClockBoostMin;
		//minimum core clock boost in KHz
	LONG dwCoreClockBoostMax;
		//maximum core clock boost in KHz
	LONG dwCoreClockBoostDef;
		//default core clock boost in KHz

	LONG dwMemoryClockBoostCur;
		//current memory clock boost in KHz
	LONG dwMemoryClockBoostMin;
		//minimum memory clock boost in KHz
	LONG dwMemoryClockBoostMax;
		//maximum memory clock boost in KHz
	LONG dwMemoryClockBoostDef;
		//default memory clock boost in KHz
Thank you.

Last edited by adibe; 04-07-2012 at 15:55.
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com
Copyright (c) 1995-2014, All Rights Reserved. The Guru of 3D, the Hardware Guru, and 3D Guru are trademarks owned by Hilbert Hagedoorn.