mondofan
13th August 2005 19:38 UTC
two questions
hi, it's me again
i have two questions which i haven't found answers to here
1) about the ExecShell command, i want to print a document (*.txt or *.doc), "open" works fine for viewing it, and "print" prints it. however, it immediately sends it to default printer, is there any way to display print dialog (the one where you can choose printer, settings, etc) first?
2) i have tried to do "log" textarea (similar to the one used in install dialog). i am using custom page made with installoptions and "text" item. i process list of files and i want to write some message about every single one of them upon their completion. if i do it "get whole content, add a new line and display it sending WM_SETTEXT message", it works only for small lists of files (since size of string in nsis is very limited). there must me another way - just adding a new line on bottom of the content. i remember the trick i used to do this when i played with winapi - select whole content (EM_SETSEL "0" "-1"), get selection boundaries (EM_GETSEL lower upper), select the EMPTY end of the content (EM_SETSEL upper upper) and then replace it with the text i want to add (EM_REPLACESEL "0" "new text"). the question: both setsel and replacesel messages seem to work fine in nsis, but how to tame getsel message? i cannot find a way to pass parameters to it (it should return the boundaries in it), does anyone know how can i do it?
thanks in advance
Afrow UK
13th August 2005 20:26 UTC
1. I think print calls notepad with the /P switch. There's also a /PT switch:
/PT <filename> <printername> <driverdll> <port>
But I don't think that'll do what you want.
2. Use the special build NSIS which has an 8192 character string length.
-Stu
mondofan
14th August 2005 00:01 UTC
thanks for reply
ad 1) you are right, but i'd still prefer the print dialog variant (i will continue to search)
ad 2) that might help, but there is still a limit, btw does it mean that nsis cannot handle sending messages that return some data?
Afrow UK
14th August 2005 11:33 UTC
If data returned with SendMessage is greater than the 8192 buffer, you'll just end up getting the rest of it cut off.
-Stu
mondofan
15th August 2005 07:05 UTC
this shouldn't be a problem, EM_GETSEL should return two numbers (ie selection range), but i don't know how to pass those parameters (SendMessage $0 ${EM_GETSEL} $1 $2 doesn't work, both $1 and $2 return without value ($0 contains HWND, that isn't problem))
Afrow UK
15th August 2005 10:38 UTC
I don't know why it's not working, but why not use a ListBox control instead?
-Stu
deguix
15th August 2005 12:50 UTC
SendMessage cannot return values in the parameters of the function. Use the System plug-in to call the SendMessageA function from user32.dll.
It should be something like this:
System::Call "user32::SendMessage(i,i,i,i)i (r0,${EM_GETSEL},.r1,.r2)"
mondofan
16th August 2005 06:34 UTC
works perfectly, thanks deguix