Variable MRU Projects Count

Started by drizz, June 26, 2007, 04:33:00 PM

Previous topic - Next topic

drizz

Hi Ketil

i was traversing through dozen of my old projects and i had to manually open those that weren't on the MRU list
when i looked at your code i saw that MRU count can be made variable with just a few modifications.


Source
------
first thing is adding a variable for mru projets count
Pro\Project.asm

UpdateMRU proc uses ebx esi
LOCAL buffer[256]:BYTE
LOCAL nInx:DWORD
LOCAL MRUProCount;; local variable added

mov dword ptr buffer,'nuoc'
mov dword ptr buffer[4],'t' ;; i used your way for mini strings
mov MRUProCount,4           ;; current default
;;;;;;;;;;;;;;;;; read from ini file
;;[MRU-Projects]
;;count=8
;;
invoke GetPrivateProfileInt,addr iniMRUPro,addr MRUProCount,4,addr iniFile
;;; must use a register against variables in .while
; use esi as index
mov esi,1
.while esi<=MRUProCount


the second thing that has to be changed is the iniMenu proc that a accepts max count of entries
it is basically a copied iniMenu proc with iMnuMax parameter added and used in loop as condition
Ini\IniFile.asm

iniMenuEx proc uses edi,lpIniKey:DWORD,lpIni:DWORD,iMnuMax:DWORD,mid:DWORD,lpnAccel:DWORD,lpAccel:DWORD
:::
  @@:
mov eax,iMnu
cmp eax,iMnuMax
jg @ret ;; go to ret
invoke BinToDec,iMnu,addr buffer
:::

   
iniMenuEx is then used instead of iniMenu at load
Ini\IniFile.asm - iniAddMenu proc
mov dword ptr buffer,'nuoc'
mov dword ptr buffer[4],'t'
mov MRUProCount,4
invoke GetPrivateProfileInt,addr iniMRUPro,addr buffer,4,addr iniFile
mov MRUProCount,eax
invoke iniMenuEx,addr iniMRUPro,addr iniFile,MRUProCount,MENUFILE,addr nAccel,hMem
   

What do think?
The truth cannot be learned ... it can only be recognized.

KetilO