Chris86 Posted February 13, 2009 Share Posted February 13, 2009 Can someone help me convert a C# DLLcall into Autoit DLLcall? dllfile - winmm.DLL Dllcall1 - timeBeginPeriod(1) timeEndPeriod(1) This is a C# script for Age of Conan which will throttle up the FPS and allow AoC to use more CPU expandcollapse popupusing System; using System.IO; using System.Diagnostics; using System.ComponentModel; namespace AoCFPSBoostLauncher { class Program { // Mediaplayer DLL Interop Call [System.Runtime.InteropServices.DllImport("winmm.DLL")]//This is the Dllopen private static extern int timeBeginPeriod(int uPeriod); [System.Runtime.InteropServices.DllImport("winmm.DLL")] private static extern int timeEndPeriod(int uPeriod); // End Interop static void Main(string[] args) { // Sets und Header string Executable = "ConanPatcher.exe"; string AoCPath = ""; Console.WriteLine("Age of Conan FPS Boost launcher by Marco 'sOLARiZ' Goetze (www.solariz.de) v1.0\n--"); // Prüfen ob Kommandozeilenparameter angegeben wurden try { // Nutze foreach um vergessene " zu kompensieren foreach (string arg in args) { if (AoCPath != "") AoCPath = AoCPath + " "; AoCPath = AoCPath + arg; } } catch { // Error behandlung später da noch die lönge geprüft wird. } // Prüfen ob Path Lenght realistisch ist if (AoCPath.Length > 4) { // Trailing Slash ergänzen wenn notwendig if (AoCPath.Substring(AoCPath.Length - 1, 1) != "\\") AoCPath = AoCPath + "\\"; // Weitere Prüfungen, siehe console.write Console.Write("Using Path:\t" + AoCPath + "\n"); Console.Write("-\tChecking for " + Executable + ":\t"); if (File.Exists(AoCPath + Executable)) { Console.Write("OK\n"); Console.WriteLine("-\tCalling winmm.dll timeBeginPeriod(1);"); timeBeginPeriod(1); Console.WriteLine("-\tLaunching Age of Conan..."); try { Process newProcess = new Process(); newProcess = new Process(); newProcess.StartInfo.UseShellExecute = false; newProcess.StartInfo.FileName = AoCPath + Executable; newProcess.StartInfo.WorkingDirectory = AoCPath; newProcess.Start(); } catch (Win32Exception ex) { Console.WriteLine(ex.Message); } Console.Write("Press RETURN to exit\n"); Console.ReadLine(); Console.WriteLine("-\tCalling winmm.dll timeEndPeriod(1);"); timeEndPeriod(1); } else { Console.Write("NOT FOUND!\n"); } } else { // Keine Parameter übergeben also hilfetext anzeigen Console.Write("ERROR: You did not specify a AOC Directory !\n"); Console.Write("Usage: AOCFPSBootLauncher.exe \n"); Console.Write("\n\nPress RETURN to exit\n"); Console.ReadLine(); } } } } Link to comment Share on other sites More sharing options...
ProgAndy Posted February 13, 2009 Share Posted February 13, 2009 this should be $result = DLLCall("winmm.DLL", "int", "timeBeginPeriod", "int", $uPeriod) $result = DLLCall("winmm.DLL", "int", "timeEndPeriod", "int", $uPeriod) *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
BinaryBrother Posted February 13, 2009 Share Posted February 13, 2009 (edited) I am truly anxious to see the answer... I've played with this a bit myself, and agree with Chris... Looks like the answer lies here.. // Mediaplayer DLL Interop Call [system.Runtime.InteropServices.DllImport("winmm.DLL")]//This is the Dllopen private static extern int timeBeginPeriod(int uPeriod); [system.Runtime.InteropServices.DllImport("winmm.DLL")] private static extern int timeEndPeriod(int uPeriod); // End Interop Edit: Oops... ProgAndy beat me... That just turned a Semi-pointless post to... Well... Completely useless... Sorries... Maybe I can make up for it? (Or just look like a newb trying...) #RequireAdmin $Game = FileOpenDialog("Game EXE",@ProgramFilesDir,"EXE (*.exe)") If Not FileExists($Game) Then MsgBox(0,"ERROR","File does not exist...") Exit EndIf $uPeriod = 1 $BeginTimerEnh = DLLCall("winmm.DLL", "int", "timeBeginPeriod", "int", $uPeriod) If @error = 1 Then MsgBox(0,"ERROR","Unable to use the DLL file.") If @error = 2 Then MsgBox(0,"ERROR","Unknown return type.") If @error = 3 Then MsgBox(0,"ERROR","Function not found in the DLL file.") TrayTip("Notification","Launching Game...",5) $Launch = Run($Game) While ProcessExists($Launch) Sleep(2000) WEnd Func OnAutoItExit() $EndTimerEnh = DLLCall("winmm.DLL", "int", "timeEndPeriod", "int", $uPeriod) DllClose($BeginTimerEnh) DllClose($EndTimerEnh) TrayTip("Notification","GoodBye....",5) Sleep(3000) EndFunc Edited February 13, 2009 by BinaryBrother SIGNATURE_0X800007D NOT FOUND Link to comment Share on other sites More sharing options...
Chris86 Posted February 13, 2009 Author Share Posted February 13, 2009 GR8!!! THANKS!! Link to comment Share on other sites More sharing options...
BinaryBrother Posted February 13, 2009 Share Posted February 13, 2009 I know this may be a little off topic, but do you think anyone could explain what that DLL does exactly? When I use the above code in conjunction with IE... It opens INSTANTLY... where as IE takes several seconds to load on my machine normally... SIGNATURE_0X800007D NOT FOUND Link to comment Share on other sites More sharing options...
wraithdu Posted February 16, 2009 Share Posted February 16, 2009 For what it's worth, from MSDN - The timeBeginPeriod function sets the minimum timer resolution for an application or device driver. Link to comment Share on other sites More sharing options...
BinaryBrother Posted February 17, 2009 Share Posted February 17, 2009 (edited) For what it's worth, from MSDN - The timeBeginPeriod function sets the minimum timer resolution for an application or device driver. I wonder why that the "minimum timer resolution" isn't set by default for ALL apps? I'm now running that code above for ALL my programs because it makes most run faster! This kinda blows my mind... Could just be my machine I guess, but all Microsoft products are like 80% faster using this method, and a few friends, including Chris above, said it improves in-game framerates... Edited February 21, 2009 by BinaryBrother SIGNATURE_0X800007D NOT FOUND Link to comment Share on other sites More sharing options...
Richard Robertson Posted February 17, 2009 Share Posted February 17, 2009 By running a bunch of processes using this, you will actually degrade system performance because the task scheduler will have to work harder. Link to comment Share on other sites More sharing options...
Chris86 Posted February 27, 2009 Author Share Posted February 27, 2009 By running a bunch of processes using this, you will actually degrade system performance because the task scheduler will have to work harder.Is it possible to make it speed up one app than speeding up all the programs that are running? Link to comment Share on other sites More sharing options...
Richard Robertson Posted February 27, 2009 Share Posted February 27, 2009 Yes, you can modify one program. I'm just warning against running several programs like this. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now