Old 3rd October 2011, 15:58   #1
hphantom
Junior Member
 
Join Date: Apr 2011
Posts: 15
Endless Marquee in nsWindows popup

Hi everyone,

Am using the nsWindows plugin to create popups, and almost have the marquee working. My intention was to generate the marquee whenever some work is being done (function being called, etc), just so the user had some some that something was moving.

I managed to get the popup to show just fine, but the marquee itself is not - it's just blank.

This is the main page:
code:
Function OnClickLookup
EnableWindow $HWNDPARENT 1
${NSW_CreateWindow} $WINDOW "Look up your key" 1044
;set window size
${NSW_SetWindowSize} $WINDOW 400 200
${NSW_CenterWindow} $WINDOW $hwndparent

${NSW_CreateLabel} 40 90 80 20 "Email Address:"
Pop $0

${NSW_CreateText} 140 90 200 20 $email
Pop $emailTextBox

${NSW_CreateButton} 100 130 85 30 "&Find my key"
Pop $GETKEY
${NSW_OnClick} $GETKEY onClickGetKey

${NSW_Show}
FunctionEnd



This is the leave code (onClickGetKey):
code:
Function onClickGetKey
${NSW_GetText} $fullNameTextBox $fullName
${NSW_GetText} $emailTextBox $email

; We require a valid email address to verify the activation, for all users
push "^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$"
push $email
SFNSIUtil::regMatch
pop $R1 ;true/false
${IF} $R1 == "false"
${ORIF} $R1 == ""
Messagebox MB_OK|MB_ICONEXCLAMATION "Your email is invalid." IDOK errors
${ELSE}

call Timer

push $email
push $productcode
S:GetKey
pop $0
Push " " ;divider char
Push $0 ;input string
Call SplitFirstStrPart
Pop $R0 ;1st part ["string1"]

${IF} $R0 == "ERROR"
${ORIF} $R0 == "RPC"
call destroyTimerWindow
Messagebox MB_OK|MB_ICONEXCLAMATION "$0"
${ELSE}
call destroyTimerWindow
MessageBox MB_OK|MB_SETFOREGROUND "Your License Key has been sent to your email."
${ENDIF}
${ENDIF}

errors:
StrCpy $R9 "0"
Call RelGotoPage
FunctionEnd



And this is my timer code:
code:

Function Timer
${NSW_CreateWindow} $TIMER "Submitting" 1044
${NSW_SetWindowSize} $TIMER 250 50
${NSW_CenterWindow} $TIMER $WINDOW

${NSW_CreateProgressBar} 0 0 100% 100% "Submitting"
Pop $hwnd
${NSW_AddStyle} $hwnd ${PBS_MARQUEE}

${NSW_CreateTimer} NSW_Timer.Callback 10
${NSW_Show}
FunctionEnd

Function NSW_Timer.Callback
${NSW_KillTimer} NSW_Timer.Callback ; Kill the timer
SendMessage $hwnd ${PBM_SETMARQUEE} 1 50 ; start=1|stop=0 interval(ms)=+N
${NSW_Show}
FunctionEnd

Function destroyTimerWindow
${NSW_DestroyWindow} $TIMER
FunctionEnd



I've also attached a screencap of what am seeing. Am thinking I have the wrong Window?
Attached Thumbnails
Click image for larger version

Name:	popup.jpg
Views:	183
Size:	26.8 KB
ID:	49192  
hphantom is offline   Reply With Quote
Old 3rd October 2011, 18:41   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
This probably isn't working because the window is running in the same thread as your process and therefore the window cannot repaint (the window message loop is blocked). Also a progress bar is either in marque mode or it isn't. You don't need to send PBM_SETMARQUEE every so often; only once.

Stu
Afrow UK is offline   Reply With Quote
Old 3rd October 2011, 19:07   #3
hphantom
Junior Member
 
Join Date: Apr 2011
Posts: 15
Ok, I fixed that part with the marquee mode, but am still stumped on the same thread/process. How can I find what thread/process the code is running in so I don't overlap them?
hphantom is offline   Reply With Quote
Old 4th October 2011, 06:14   #4
T.Slappy
Major Dude
 
T.Slappy's Avatar
 
Join Date: Jan 2006
Location: Slovakia
Posts: 549
Send a message via ICQ to T.Slappy
I think problem is in NSW. I did not looked into sources but if it is similar to nsDialogs all components [also the timer] are created in one thread = GUI thread which is bad.

Quote:
Originally Posted by hphantom View Post
How can I find what thread/process the code is running in so I don't overlap them?
Normally when you start new thread you get its ID so every thread is unique. try using this ID to recognize correct thread.
Use my ThreadTimer plugin as reference: http://nsis.sourceforge.net/ThreadTimer_plug-in

By the way I am developing new plug-in specially with this purpose - it creates new separated thread which shows window with Please wait... message and gif animation

Cool looking installers with custom design: www.graphical-installer.com
Create Setup Pages easily: www.install-designer.com
Build installers in Visual Studio 2005-2019: www.visual-installer.com
or RAD Studio 2009, 2010, XE-10.4 Sydney: www.rad-installer.com
T.Slappy is offline   Reply With Quote
Old 4th October 2011, 13:32   #5
hphantom
Junior Member
 
Join Date: Apr 2011
Posts: 15
I will definitely try your plug-in, Slappy.

It's strange, I got it to work within 2 pop-ups, not 3. (So if I have a button to click and pops up a window, that gives me the marquee, but if I have a button to click, which pops up a window with another button to click, that doesn't pop up.)

Edit: I tried the ThreadTimer, Slappy, but not sure why it's not working either. I dropped in the DLL into my plugins folder and linked it to my installer. I compiled/built the C code; and I copied your test code but it says that ThreadTimer is invalid. Am I missing something? Should there be an NSH/I header somewhere?
hphantom is offline   Reply With Quote
Old 5th October 2011, 07:17   #6
T.Slappy
Major Dude
 
T.Slappy's Avatar
 
Join Date: Jan 2006
Location: Slovakia
Posts: 549
Send a message via ICQ to T.Slappy
Quote:
Originally Posted by hphantom View Post
Edit: I tried the ThreadTimer, Slappy, but not sure why it's not working either. I dropped in the DLL into my plugins folder and linked it to my installer. I compiled/built the C code; and I copied your test code but it says that ThreadTimer is invalid. Am I missing something? Should there be an NSH/I header somewhere?
Maybe you have problem with decorating functions? Try: http://forums.winamp.com/showthread....92#post2807692

Anyway you can take an idea from that plug-in - creating new thread using _beginthreadex

Cool looking installers with custom design: www.graphical-installer.com
Create Setup Pages easily: www.install-designer.com
Build installers in Visual Studio 2005-2019: www.visual-installer.com
or RAD Studio 2009, 2010, XE-10.4 Sydney: www.rad-installer.com
T.Slappy is offline   Reply With Quote
Old 5th October 2011, 14:19   #7
hphantom
Junior Member
 
Join Date: Apr 2011
Posts: 15
Quote:
Originally Posted by T.Slappy View Post
Maybe you have problem with decorating functions? Try: http://forums.winamp.com/showthread....92#post2807692

Anyway you can take an idea from that plug-in - creating new thread using _beginthreadex
That's exactly the issue am having, all that extra fluff shows up.
code:
Start@@YAXPAUHWND__@@HPADPAPAU_stack_t@@PAUextra_parameters@@@Z



Is there any way to fix this (or any idea how to)?
hphantom is offline   Reply With Quote
Old 5th October 2011, 14:35   #8
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
http://forums.winamp.com/showpost.ph...9&postcount=16

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