Loveness Posted November 11, 2015 Report Share Posted November 11, 2015 (edited) Hi! I've read this post: http://www.tg007.net/file-903 and im looking for a DLL that won't let mIRC freeze during an infinite/very large while loop. Is a pitty that WhileFix dont work on mirc v7.43 (ive tested in many ways), maybe is an old version (2005 year). So my question, here exists a dll like this which works perfectly in mirc v7+ ? Edited November 11, 2015 by Loveness Link to comment Share on other sites More sharing options...
err0r Posted November 11, 2015 Report Share Posted November 11, 2015 i'm not aware of another dll that handles this. perhaps you should stagger large while loops allowing for slight breaks in the loop * Update. I just tested this dll with the latest version of mIRC and it worked for me.. Can you provide an example of your code to test to see if it works for us? Link to comment Share on other sites More sharing options...
Loveness Posted November 12, 2015 Author Report Share Posted November 12, 2015 (edited) Yes of course..: dx_servbase { ;... %dx.sbases.total = $getinfo(Win32_BaseService,-1).Name %i = 1 :next.dxsbase if (%i > %dx.sbases.total) goto end.dxsbase dll scripts\WhileFix.dll WhileFix . unset %dx.sbase.* | %dx.sbase.caption = $getinfo(Win32_BaseService,%i).Caption | $iif(%dx.sbase.caption == $null,%dx.sbase.caption = -) write %dx.check.section xdid -a dxdiag 2 0 0 +cb 0 0 0 0 - $chr(9) +cb 0 0 $rgb(38,12,190) 0 %i $+ . Titlu: $chr(9) +cb 0 0 $rgb(20,107,5) 0 %dx.sbase.caption ;... inc %i 1 | goto next.dxsbase :end.dxsbase } I've tried in many ways.. i put the line "dll scripts\WhileFix..." and before :next... and after and so on.. but no results.. maybe whilefix.dll get in trouble with dcx.dll or some other dlls from my script? There're 540 Base Services that make a loop about 10 minutes and in this time my mirc freeze, while whilefix gives no results... Update: I've tried to use "while" instead of using groups.. also no effects Edited November 12, 2015 by Loveness Link to comment Share on other sites More sharing options...
err0r Posted November 12, 2015 Report Share Posted November 12, 2015 try something simple like alias wftest { var %a 1 while (%a <= 5000) { dll $qt($mircdirdlls/WhileFix.dll) WhileFix . echo -a %a This loop can go on forever and mIRC appears to act as normal. inc %a }} try it with and without the dll to see the results Link to comment Share on other sites More sharing options...
westor Posted November 18, 2015 Report Share Posted November 18, 2015 (edited) Hello, I followed the err0r example but when i right click into any window while an while loop running with the dll calling inside the while loop then the while loop paused for some reason and resume when i exit from the right click menu ( same problem if i open the mIRC Options or DCC Send or any other mIRC's related window when the while loop running ). Check the video: https://goo.gl/lvuoMs - Thanks! Edited November 18, 2015 by westor Link to comment Share on other sites More sharing options...
Loveness Posted December 11, 2015 Author Report Share Posted December 11, 2015 (edited) Hello, I followed the err0r example but when i right click into any window while an while loop running with the dll calling inside the while loop then the while loop paused for some reason and resume when i exit from the right click menu ( same problem if i open the mIRC Options or DCC Send or any other mIRC's related window when the while loop running ). Check the video: https://goo.gl/lvuoMs - Thanks! it's all ok! When you create or open a modal dialog, every script pauses.. so everything you click from standart dialogs of mirc that are modals, all scripts pause.. e.g. $dialog(table,table,-2) Edited December 11, 2015 by Loveness Link to comment Share on other sites More sharing options...
Warren Posted May 20, 2016 Report Share Posted May 20, 2016 mIRC 7.42 - versions.txt15.Changed script processing method so that Windows no longer thinks mIRC has stopped responding during long loops.I went to make a whilefix dll of my own, but it turns out, mIRC doesn't reallyneed it as much as it used to. Although mIRC doesn't have any functionalityduring an intensive loop, it at least won't crash mIRC due to unresponsive behavior. whilefix7.cpp #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <stdio.h> #include <assert.h> #include <string> using namespace std; typedef struct { DWORD mVersion; //!< mIRC Version HWND mHwnd; //!< mIRC Hwnd BOOL mKeep; //!< mIRC variable stating to keep DLL in memory } LOADINFO; typedef struct { HANDLE m_hFileMap; //!< Handle to the mIRC DLL File Map LPSTR m_pData; //!< Pointer to a character buffer of size 900 to send mIRC custom commands HWND m_mIRCHWND; //!< mIRC Window Handle } mIRCDLL; mIRCDLL mIRCLink; void WINAPI LoadDll(LOADINFO * load) { mIRCLink.m_hFileMap = CreateFileMapping( INVALID_HANDLE_VALUE, 0, PAGE_READWRITE, 0, 4096, "mIRC" ); mIRCLink.m_pData = (LPSTR) MapViewOfFile( mIRCLink.m_hFileMap, FILE_MAP_ALL_ACCESS, 0, 0, 0 ); mIRCLink.m_mIRCHWND = load->mHwnd; } int WINAPI UnloadDll( int timeout ) { // DLL unloaded because mIRC exits or /dll -u used if ( timeout == 0 ) { UnmapViewOfFile( mIRCLink.m_pData ); CloseHandle( mIRCLink.m_hFileMap ); return 1; } // Keep DLL In Memory else return 0; } int __declspec(dllexport) __stdcall whilefix7(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL show, BOOL nopause) { MSG msg; PeekMessage(&msg,NULL,0,0,PM_REMOVE); TranslateMessage(&msg); DispatchMessage(&msg); return 1; } whilefix7.def LIBRARY whilefix7 EXPORTS whilefix7 LoadDll UnloadDll whilefix7.mrc alias whilefix7 { var %whilefix7.dll $qt(C:\Mirc\whilefix7\whilefix7.dll) var %i 0 while (%i < 12000) { inc %i titlebar %i echo -s : %i if ($rand(1,10) == 0) { noop $dll(%whilefix7.dll,whilefix7,0) } ; Allows mIRC a chance to breathe. } dll -u %whilefix7.dll } the code used was supposedly used in the past whilefix dll, and i had made my own, which worked well... but it looks like it might not be as relevant now with the upgraded mIRC. whilefix7.zip Link to comment Share on other sites More sharing options...
Sophist Posted September 16, 2018 Report Share Posted September 16, 2018 I know this is a little late (LOL - several years late) but the solution does NOT require any DLLs. Suppose you have a loop that iterates 1 million times. You update the code to loop (say) 1,000 times, and when that has completed queue the same loop again on a ".timer 1 0" to run the next 1,000 iterations. What this does is give up control to allow mIRC to process other things every time you queue the next 1,000 iterations on the timer. You should aim IMO for each chunk to take c. 100ms to run - any longer and mIRC will feel laggy, and significantly shorter starts to create significant overhead - and you can even measure how long it took for e.g. the first 1,000 iterations and then adjust the number of iterations for further chunks to be closer to the 100ms target. I have something like this working nicely on a script I am currently writing which loads a large database from a flat file into hash tables in this asynchronous way. (Plus once the data is loaded, it uses hsave to create a cache so that next time it can use hload to populate the hash table which is c. 7x faster - and it uses a similar technique to save and load hashtables asynchronously. Finally if you try to use the data when it is still loading asynchronously, then it switches the chunk size to a huge number and loads the rest of the data synchronously so it can use it and return data to the calling script.) All of this is achieved using standard mSL without any DLLs. err0r 1 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