Archive: two questions


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


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


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?


If data returned with SendMessage is greater than the 8192 buffer, you'll just end up getting the rest of it cut off.

-Stu


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))


I don't know why it's not working, but why not use a ListBox control instead?

-Stu


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)"

works perfectly, thanks deguix