Archive: Billboarding images


Billboarding images
Newbie question #2:

I am interested in placing marketing images during program installation. As of now, to simply display images, I am making use of
http://nsis.sourceforge.net/ModernUI...stalling_files

And the process by which I am billboarding is as follows:

!insertmacro DisplayImage 'c:\Bilboard0.bmp'
CopyFiles /SILENT 'C:\Users\david.DOMAIN\Desktop\COMPANY\Main\Build\Sound\01\*' "$INSTDIR\Sound"

!insertmacro DisplayImage 'c:\Bilboard1.bmp'
CopyFiles /SILENT 'C:\Users\david.DOMAIN\Desktop\COMPANY\Main\Build\Sound\02\*' "$INSTDIR\Sound"

So my question is related to the process by which these files should be split apart. As far as I understand, the function CopyFiles makes use of os functionality to literally copy files from location A to location B. If I am wrong in this respect, is it possible for me to register some sort of callback for notification on events ( FunctionCallOnTenPercentComplete() ), or maybe even a callback that gets called on some sort of interval( FunctionCallOncePerFrame() or FunctionCallOnceEveryTenSeconds() )?
Ideally, I would like to examine the copy progress of an entire directory, and display a billboard based on a percentage completed.

Option number 2, is to dynamically figure out how to subdivide our assets into temp folders of specified size, and somehow automate the setup in NSIS. I really need some advice on how to best accomplish this if anyone would be so kind, because I'm willing to bet I'm missing the practical option here.


I know no available solution but to manually split.


Alrighty, thanks.


I noticed that you are able to make win32 dll calls. I'm looking at solving this issue by making use of CopyFilesEx.

CopyFileEx Function:
Copies an existing file to a new file, notifying the application of its progress through a callback function.

But first I'm having some issues figuring out how to manually call functions in general. I'm starting out with duplicating the functionality of MessageBox, but I've run into a few quirks.

Here's the function definition:
int MessageBox( HWND hWnd, // handle to owner window

LPCTSTR lpText, // text in message box

LPCTSTR lpCaption, // message box title

UINT uType // message box style );


And here's my attempt to invoke it from NSIS:

strcpy $R0 "title"
strcpy $R1 "text"
System::Call "user32::MessageBoxA(i, t, t, i) (0, $R0, $R1, 1)"

The message box pops up, however both the title and the text are empty. I'm not sure if "" automatically appends '\0'. On the same note, I'm not sure what NSIS uses for NULL.

Looking through the tutorial, I find myself very confused about:
System::Call 'YourDllName::YourDllFunction(i, *i, t) i(.r0, r1, .r2) .r3'

I haven't seen anything in the documentation that says what '.r0' means. (I know what $r0 is...)

I'm doubly confused when later, we see the example:
(function definition)
int CmGetHotSyncExecPath(TCHAR *pPath, int *piSize);
(nsis declaration)
CmGetHotSyncExecPath(t, *i) i
(nsis invocation)
System::Call 'CondMgr::CmGetHotSyncExecPath(t, *i) i(.r0, r1r1).r2'

What is r1r1??? And once again, what is '.r0'?


Here's the link for the above example:
http://nsis.sourceforge.net/Calling_...stem.dll::Call


If anyone is interested, I found a way to display images based on a %copy complete (of single files). This is just sandbox code, but here's the entire script:


!include 'MUI.nsh'
!include 'Image.nsh'

!define AppName `Sand`
Name '${AppName}'
OutFile 'Sandbox.exe'
InstallDir '$PROGRAMFILES\${AppName}'

!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE "English"

#Dumpstate::debug
# Fix the rukus vista has been causing with shortcut removals.
RequestExecutionLevel admin

Section 'CD_ONE'

strcpy $9 'ladeda'
SetPluginUnload alwaysoff
System::Get "(l,l.R1,l,l,i,i,i,i,i)isr1"
pop $0
System::Call 'kernel32::CopyFileEx(t "c:\from\test.txt", t "c:\to\test.txt",k r0,i,i,i)i.r9'

loop:
StrCmp $1 "callback1" 0 done

IntCmp $R1 40000000 0 lessthan40mb morethan40mb
lessthan40mb:
strcmp $9 '0' doneCmp +1
!insertmacro DisplayImage 'c:\Bilboard0.bmp'
strcpy $9 '0'
Goto doneCmp

morethan40mb:
strcmp $9 '1' doneCmp +1
!insertmacro DisplayImage 'c:\Bilboard1.bmp'
strcpy $9 '1'
Goto doneCmp
doneCmp:

Push 0 # return value of the callback
StrCpy $1 "" # clear $R0 in case there are no more callback calls
System::Call $0 # tell system to return from the callback

Goto loop
done:
SetPluginUnload manual
System::Free $0

SectionEnd