Old 16th February 2006, 16:54   #1
Programmer
Junior Member
 
Join Date: Feb 2006
Posts: 4
Possible bug

Using the following INI file (lines marked by >):

>; Title
>;
>; Header block.
>
>[Settings]
>NumFields=1
>
>; Description.
>
>[Field 1]
>Type=Checkbox
>Text=Use it
>Flags=NOTIFY
>State=1
>Left=10
>Right=100
>Top=20
>Bottom=30
>
>; Terminal text, for whatever purpose.
>
>

If the above INI file is used, examination of the working copy during processing shows that the HWND keyword shows up as so:

>Right=100
>Top=20
>Bottom=30
>
>; Terminal text, for whatever purpose.
>
>HWND=14681514

However, subsequent reads via:

ReadINIStr ${hWND} "${Temp}" "Field 1" "HWND"

will not find it, as far as I can tell. I used:

MessageBox MB_ICONEXCLAMATION|MB_OK \
"hWND = ${hWND}"

to try to see the results, but I got nothing.

Changing the end of the INI file to:

>Right=100
>Top=20
>Bottom=30
>
>[End]
>; Terminal text, for whatever purpose.
>
>

results in the HWND keyword showing in the correct location, but I'm still seeing nothing with my MessageBox.
Programmer is offline   Reply With Quote
Old 16th February 2006, 17:58   #2
Comm@nder21
Major Dude
 
Join Date: Jul 2003
Location: germany, b-w
Posts: 734
Send a message via ICQ to Comm@nder21
Quote:
However, subsequent reads via:

ReadINIStr ${hWND} "${Temp}" "Field 1" "HWND"

will not find it, as far as I can tell. I used:

MessageBox MB_ICONEXCLAMATION|MB_OK \
"hWND = ${hWND}"
this will never work.

this one will:
code:

ReadINIStr $hWND "$PLUGINSDIR\yourini.ini" "Field 1" "HWND"
MessageBox MB_ICONEXCLAMATION|MB_OK \
"hWND = $hWND"



you mixed up runtime ($variable) with compile time (${define}).

also, you set the wrong path to your ini file. (you should always extract your installer related files, like installoption files, plugins, pictures and other stuff just needed in the installer, not in the installed application, to $PLUGINSDIR, not to $TEMP!!!)
Comm@nder21 is offline   Reply With Quote
Old 16th February 2006, 20:33   #3
Programmer
Junior Member
 
Join Date: Feb 2006
Posts: 4
!define hWND $0
!define TempA "$PLUGINSDIR\TempA.ini"

ReadINIStr ${hWND} "${TempA}" "Field 1" "HWND"
MessageBox MB_ICONEXCLAMATION|MB_OK \
"hWND = ${hWND}"

These are the original lines from the code in question. The two defines I removed while chopping down to the relevant lines. The TempA I reduced to Temp figuring that it would be clearer.

I found the actual reason the Read/Msg was failing while I was chopping the above out for you; I had TempB where I should have had TempA. I was reading from the wrong INI file.

The possible bug as described still exists; the HWND keyword is being misplaced if there are blank or comment lines following the last keyword in the last section of the INI file.

Interestingly, if there are blank and comment lines between sections, it gets it right; it steps back to the last line of the previous section and puts the HWND in the correct spot.
Programmer is offline   Reply With Quote
Old 17th February 2006, 08:15   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
As far as I know WriteINIStr (and ReadINIStr) just call a Windows API to do the job. If this is the case (I'm pretty sure it is because the programmers would have wanted to cut down on as much overhead as possible) then you shouldn't have comments in between section key values. I for one have never seen an INI file like this. Comments have always appeared above section tags. Then again I could be wrong

What happens if you call the Windows API's (whatever they are!)?

-Stu
Afrow UK is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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