View Single Post
Old 26th January 2018, 19:13   #3
sfx09
Junior Member
 
Join Date: Jul 2017
Posts: 27
Quote:
Originally Posted by Anders View Post
The steps are unclear to me, please describe in more detail.

Are you eating the WM_COMMAND message in your subclass?
Yes. In my procedure, where creating delphi-form, I wrote this:

PHP Code:
  PluginDialogFirstForm := TPluginDialogFirstForm.CreateParented(g_hwndParent);
  
parentOriginalWndproc := TFNWndProc(SetWindowLongPtr(g_hwndParentSizeOf(LRESULT), Longint(@CurrentParentProc)));
  
SendMessage(g_hwndParentWM_NOTIFY_CUSTOM_READYPluginDialogFirstForm.Handle0);
  
PluginDialogFirstForm.Show

  while 
bStopPlugin FALSE do
  
begin
    GetMessage
(Msg000);
    if (
not IsDialogMessage(PluginDialogFirstForm.HandleMsg)) and (not IsDialogMessage(g_hwndParentMsg))  then
    begin
      TranslateMessage
(Msg);
      
DispatchMessage(Msg);
    
end;
  
end;

  if 
bStopPlugin TRUE then
  begin
    PluginDialogFirstForm
.Close;
    
PluginDialogFirstForm.Free;
    if 
bSkipActivation TRUE then
    begin
      
//NSIS_PushString_Ansi('next');
      
SetWindowLongPtr(g_hwndParentSizeOf(LRESULT), Longint(parentOriginalWndproc));
      
ShowMessage('bSkipActivation!');
      Exit;
    
end;
    if 
bCancelClk TRUE then
    begin
      NSIS_PushString_Ansi
('cancel');
      
Halt(0);
    
end;
    if 
bBackClk TRUE then
    begin
      
//NSIS_PushString_Ansi('back');
      
SetWindowLongPtr(g_hwndParentSizeOf(LRESULT), Longint(parentOriginalWndproc));
      Exit;
    
end;
    if 
bNextClk TRUE then
    begin
        PluginDialogFirstForm
.Hide;
        
PluginDialogSecondForm.Show;
    
end;
  
end
It's CurrentParentProc full code for plugin:

PHP Code:
function CurrentParentProc(hwndHWNDuMsgUINTwParamWPARAMlParamLPARAM): LRESULTstdcall;
var
  
wParLongInt;
begin
    
if (uMsg UINT(WM_NOTIFY_OUTER_NEXT)) then   //1032
    
begin
      wPar 
:= LongInt(wParam);
      
//
      
if (wPar 120then
      begin
        bCancelClk 
:= TRUE;
        
bStopPlugin := TRUE;
        
//MessageBox(hwnd, PChar('exit'), PChar('-'), MB_OK);
      
end;
      if (
wPar = -1then
      begin
        
// MessageBox(hwnd, PChar('back'), PChar('-'), MB_OK);
        
bBackClk := TRUE;
        
bStopPlugin := TRUE;
      
end;
      if (
wPar 1then  //next
      
begin
        bNextClk 
:= TRUE;
        
bStopPlugin := TRUE;
      
end;
    
end
    
else if (uMsg UINT(16)) then   //wm_close (X button)
    
begin
      bExitNow 
:= TRUE;
    
end
    
else if (uMsg WM_COMMANDthen
    begin
      
//esc or skip button
      
if (LOWORD(wParam) = 2) and (HIWORD(wParam) = BN_CLICKED) and (bExitNow FALSEthen
      begin
        
//ShowMessage('here click skip and skip on ESC!!!');
        
bStopPlugin := TRUE;
        
bSkipActivation := TRUE;
        
//SendMessage(g_hWndParent, WM_NOTIFY_OUTER_NEXT, 1, 0);
        
Exit(0);
      
end;
      
bExitNow := FALSE;
    
end;

  
Result := CallWindowProc(parentOriginalWndprochWnduMsgwParamlParam);
end

Quote:
Originally Posted by Anders View Post
Post the WM_NOTIFY_OUTER_NEXT message to hwndParent with wParam=1 to go to the next page.
Yes, i try this: SendMessage(g_hWndParent, WM_NOTIFY_OUTER_NEXT, 1, 0);
But, plugin go to the next Delphi-form (9 forms now in plugin), not next page installer (I need to skip all plugin work).

My code work normal, if I clicked on the 'Next' before clicking on 'Skip' (we go to the next NSIS-page). But, if I clicked on the 'Back' (it need to navigate between Delphi-forms) before clicking on 'Skip' - skipping go to previous NSIS-page.

So, if I send SendMessage(g_hWndParent, WM_NOTIFY_OUTER_NEXT, 1, 0); - I stay on same form (if I click 'Back' before 'Skip').
If I send SendMessage(g_hWndParent, WM_NOTIFY_OUTER_NEXT, 2, 0); - I goto second plugin-form, etc.

IMHO, it's not normal. Sorry, maybe I doing something wrong, but normal Delphi-source for plugin with GUI and more than one form, I can't find. =(

If such a plugin-source exists, maybe someone send me link. =)
sfx09 is offline   Reply With Quote