Plugin with a Dialog at Run Time?

Interested in developing new plug-ins? Got one to share? Post here!
andyhore
Posts: 20
Joined: Fri Jun 06, 2008 2:10 pm

Plugin with a Dialog at Run Time?

Postby andyhore » Thu Jul 24, 2008 7:28 am

Has anybody tried (and succeeded!!) to create a plug-in that shows a dialog at Run time, not just IDE time? If so, how did you do it? I'm trying to do it because I need to do some fairly complex processing at run-time and I have to ask the user questions and have them make selections.

I know there is only pure win32, so I'm trying using ATL (so far, so good!). But, that's where the fun begins! My test case is the following:
1) Display the Welcome Dialog, user clicks Next
2) This welcome dialog is closed and my Dialog is called
3) It has next/cancel and a single field that displays a Variable value.

Well, the Welcome screen does not get closed (I tried Hide Dialog and that did not work), the variable value does not go into the edit field and than non of the buttons actually events seam to get fired!!!!

Anybody got any suggestions? I'd be most appreciative:)

Thanks,
Andy.

linksys
Posts: 5
Joined: Tue Sep 16, 2008 3:40 pm

hide welcome dialog

Postby linksys » Wed Sep 17, 2008 12:57 am

Hi did you get solution how to hide dialog.

I'm doing the same thing.

1. First calling Welcome dialog.
2. the next in welcome dialog calls another setup with its own dialogs to display
3. Before calling this new set of dialogs I want to hide or remove the welcome dialog

how can i do this ?

Thanks in advance.

rcaspers
Posts: 29
Joined: Tue Jul 22, 2008 1:13 pm

Hope this workes for you both

Postby rcaspers » Wed Sep 17, 2008 11:53 am

Hi there, i had a simular problem and used the next trick to solve it
see the code below
Last edited by rcaspers on Wed Sep 17, 2008 11:55 am, edited 1 time in total.

rcaspers
Posts: 29
Joined: Tue Jul 22, 2008 1:13 pm

this is better reading

Postby rcaspers » Wed Sep 17, 2008 11:55 am

Hi there, i had a simular problem and used the next trick to solve it

Code: Select all



function RunTimeExecute(Window: THandle; Variables, State: PChar; Progress: TPlugProgressIndicator;
  var Return: Integer; NewVariables: PChar): Integer; stdcall; export;
begin
  Return := 0;
  if NewVariables = nil then
  begin
    Plugin.State := State;
    Plugin.Variables := Variables;
    MyDialog(Window);
    Result := Length(Plugin.Variables);
  end
  else
  begin
    Result := 0;
    StrCopy(NewVariables, PChar(Plugin.Variables));
  end;
end;


procedure MyDialog(_Parent: THandle);
var
  Form1: TForm1;
  SetupCaption: String;
  ModalResult: integer;
begin
  // do NOT use Hide Dialog in you IA project
  // Create a form whitout a border
  // u can use the same design as the original setupwindow
  // including three buttons Back, Next and Cancel
  // make the align property alClient
  // make the handle of the original setupwindow the parent of your dialog

  Form1 := TForm1.Create(nil);


  // The parameter _Parent is given to you when calling the plugin
  // However its is alway 0 (see my own topic a while ago)
  // i believe it is a small bug in IA and hope it will be solved
  // i used the findwindow function. this only works while IA does not change their classnames

  SetupCaption := Plugin.GetVariable('$TITLE$') + ' - InstallAware Wizard';
  Form1.ParentWindow := FindWindow('TPoolTemplate',PChar(SetupCaption));


  ModalResult := Form1.ShowModal;
 
  case ModalResult of
    Cancel: Plugin.SetVariable('WIZARD', 'CANCEL');
    Ok:     Plugin.SetVariable('WIZARD', 'NEXT');
    Next :  Plugin.SetVariable('WIZARD', 'BACK');
  end;
  Form1.Free;

  //plugin is a object of a small class i wrote
  //getvariable and setvariabele are two functions whitin that class
  //they get and set the values from the property Plugin.Variables

end;



rcaspers
Posts: 29
Joined: Tue Jul 22, 2008 1:13 pm

Postby rcaspers » Wed Sep 17, 2008 5:20 pm

Code: Select all


TPlugin = class(TObject)
  private
    FVariableList: TStringList;
    FStateList: TStringList;
    FStateCount: Integer;
    function  GetState: String;
    function  GetVariables: String;
    procedure SetState(Value: String);
    procedure SetVariables(const Value: String);
  protected
    function  GetDesigntimeText: String; virtual;
  public
    constructor Create; virtual;
    destructor  Destroy; override;
    function    GetVariable(VarName: String): String;
    function    SubstituteVariable(Variable: String): String;
    property    DesigntimeText: String read GetDesigntimeText;
    procedure   SetVariable(Varname, Value: String);
    property    State: String read GetState write SetState;
    property    Variables: String read GetVariables write SetVariables;
  end;





linksys
Posts: 5
Joined: Tue Sep 16, 2008 3:40 pm

Postby linksys » Wed Sep 17, 2008 6:05 pm

thanks a lot..!

This is the first time i'm seeing this code that is custom to what installaware offers.

Where should I add this code too..! I mean how can I create custom funtions or code like the one you have shown me. I'm using installaware admin studio.

I will try to use what you have shown in above the code...let you know pretty sonn.

Thanks again.

Gunter
Posts: 13
Joined: Wed Nov 22, 2006 7:36 am

Postby Gunter » Wed Mar 03, 2010 11:00 am

Until now (we're using IA6.6) I used the trick to show a non-modal dialog of 1x1 pixel, and hide dialog right after it, this was working perfectly to get rid of the IA dialog before showing my own plugin-dialog.
Now, I'm testing with (a demo version of) IA 9.06, and this trick is resulting in a window saying "Unspecified Error" :cry:
I tried to enlarge the non-modal dialog to 100x100 but the same problem. Anybody an idea? I need to get this fixed before I can buy IA9 and migrate my application to IA9.

Thanx


Return to “Plug-In Development”

Who is online

Users browsing this forum: No registered users and 39 guests