Link to home
Start Free TrialLog in
Avatar of PeterdeB
PeterdeBFlag for Netherlands

asked on

'Could not convert variant of type (Dispatch) into type (Boolean)' >..pops up after splash has splashed > how to get rid of it?

Hi all Experts!! In my applications popupmenu clicking the menuitem 'About' splashes my splashscreen > so far it works perfect > only right after (at least I pressume the 'splash1.free' frees the splash) it's freed (or perhaps before or while or in an attempt to > I'm not sure...;( it pops up the above messagedialog and it's fellow errormessage. I haven't got a clue as to where I should begin in order to trace down this 'feature' of my application but could do without the message ofcourse > IMHO > when all goes well I shouldn't be bothered by this visual pollution of my application > and since 1+1=2 I think > 'when' doesn't go all too well;)

But how do I 'free' my application from that message? (or simply have it stashed somewhere invisible for all I care > in case solving the problem which causes this message seems too illusive I might as well 'carry' it with me but then preferrably somewhere deep down in my pocket 'stead of on top of my application or the like...)

Tnx in advance I hope I described the problem accurate enough > if not then  JustSaySo; ok?

Regards and max respect to this forum!!

Peter
Avatar of shaneholmes
shaneholmes

do you have something like this?


 frmSPlash:= TfrmSplash.Create(Application);
 frmSplash.Update;
 if frmSplash.ShowModal = mrOK then
  frmSplash.free;


SHane
As for the error message, it could be from many things...

"Could not convert variant of type (Dispatch) into type (Boolean)' >..pops up after"

do you use any type of Type Lybrary in your application? OCX? ActiveX?

How about any type of Interface?

Shane
Avatar of PeterdeB

ASKER

Hi Shane! (again you astonish me with your rapid response;)

Yes I do use any type of Type Library > ActiveSplashLib_TLB > resulting from the import of activesplash.ocx > I only ran into this message after implementing a procedure which doesn't seem related to the d*mn thing at all, from there it got me worrying;(
Then your next Q > type of Interface > must confess I'm not sure about that one although I guess using OCX or the like involves using 'any type of Interface'?

Peter
OK, you are not using the standard about splash screen, therefore the code I posted above is not valid.

1.) you should have mentioned you were using this type of control, that way experts aren't wasting their time coding unneccessary code for you. How is anyone to know you were using that control unless you tell them. I surmised you were using something out of the ordinary, thats why i asked about the type library.

2.) anyway, the only way we could help, is if you were to post your code on how you are calling this control  and displaying it the the user...

3.) What is it about this control that you need to use it versus creating your own splash (simple task) in delphi.


I can send you an example on how to create your own splash screen

Shane
And once again EE tricked me with it's stubborn and persistent 'attitude' regarding the refreshing of pages cause your first message only came bubbling up after I answered your (apparently >) second.....nevertheless here's my code > (bear in mind that it probably is messed up to the max cause whenever I run into error message I can't seem to circumvent 1-2-3 > me tampers nearly the entire project prior to sending my error message in a bottle to EE > apart from that it should be obvious it isn't 'Rocket Science' or the like but hey it (used to;) work(s);)

procedure TfrmMain.About1Click(Sender: TObject);
var spl: string;
begin  try
spl:= 'mysplash2.spl';
if not FileExists(spl) then
MessageDlg('Het bestand '+spl+' kon niet '+#13+#10+'worden geladen omdat het niet '+#13+#10+'werd gevonden.', mtError, [mbOK], 0)
else
Splash1.LoadSplash(spl);
Splash1.Visible:= True;
Splash1.ShowModal(1000);
Splash1.Hide(False);
finally
Splash1.FreeMemory(splash1.oleobject); // < this dude I added after catching a glimp of the activesplashlib_tlb and it seems
                  //it brought the ugly message along > but prior to that my splash only splashed once and every second about1.click crashed my entire app thus removing this piece of code results in crashing rather than errormessaging > out of
//which I chose the second......
Splash1.Free;
end;

//end of fun;(

Regards Peter
3.) What is it about this control that you need to use it versus creating your own splash (simple task) in delphi.
ASKER CERTIFIED SOLUTION
Avatar of shaneholmes
shaneholmes

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Oh ok > you made a (good) point there > it wasn't my intention to provide 'sloppy' information or incomplete details > but uptil now I didn't consider this to be the case, so my appreciation for your remark Shane;)
Then regarding the custom made splash screen > I already have a custom made splash screen (which pops up after launching my app) but creating a splash isn't exactly right up my alley > I can't seem to satisfy myself when it comes to the graphics > so I have to use others ideas and the like......(but reading this does ring a bell as to whether I'd choose for custom and considered-not-to-be-satisfactory OR invented-and-causing-severe-problems > so you got me thinking.......)

Peter
Oh ok I see;( > it should check whether the spl is present prior to splashing > and apart from that it should ofcourse 'splash' > but you may be right in what you stated regarding my own splash.......(so I might even rid my app from the imported type lib > although I made my own splash > would you please send your demo splash app addressed Holland a s a p??)

Peter
Yes,   - EMAIL?


The best part of your own splash, is the fact that you dont have to ditribute an OCX, with your app

Shane
Hi Shane > I followed up to your advice regarding 'it seems a little much...' and cut away several lines of code and now guess what? > it WORRRUKSSS!!!

I changed the above into:
//
else
Splash1.LoadSplash(spl);
Splash1.Visible:= True;
Splash1.ShowModal(1000);

finally
Splash1.Free;
end;
//

And voila! So you get the points but hopefully I still get the demo splash app??

Regards Peter ( using this control also involves distribution of the ocx so I still might alter the app and use the technique  you advised......for your information)
I must resemble a Parrot right? (regarding the comment on the ocx;)

f.vanbommel1@chello.nl or pdbiel@hotmail.com

Tnx in advance!!

Peter from Holland
<I emailed it to you> <both addresses>

SHane
Hi Shane tnx for the demo you mailed > unlike many demos it just does what it should > like the other app you sent me recently. I often bump into so called demos that require modifications prior to being successfully compiled and perhaps that may seem challenge to some > it may be obvious that it seems a waste of time to me or even worse;)

One Q however > you simply 'cooked' this app in like a blink of an eye just to support the problem I posted? (and if so the other app you sent would originate from the same 'circumstances' right?;)

Geeeez.....that's pretty fast........perhaps you are entitled to claim you write rocket-science-code then;)

Regards and 'bedankt' ........Peter
What was so rocket science about it.

1.) Creat a new application

2.) Save it as Project1.dpr, & Unit1.pas

3.) Drop a TMainMenu on the main form

4.)  create Two new menu items (file, help) then under help, a sub menu item - about

5.) create new form

6.)Set its caption property to  'About' - save it as Unit2 - Change form name property to frmAbout

7.) set its border style to bsDialog

8.) drop a TPanel on the form - set its align property to alBottom

9.) drop a button on that pane1, set its caption to OK, its modalresult property  to mrOK

10.) save it as frmABout

11.) go back to the first forms unit

12.) choose from delphi main menu - Use unit

 make unit1 uses unit 2

13.) now in the MainMenu component of the main form, set the about menu items OnCLick event to say

frmAbout.ShowModal;


Now that is all beginner level delphi stuff - nothing advanced or intermediate for that matter involved here.

ANd yes, i created right after I mentioned to you i would send and example....\


Shane