On Sat, 2012-05-05 at 02:45 +0200, Benoît Minisini wrote:
> Le 04/05/2012 23:34, Benoît Minisini a écrit :
> >
> > I don't like any of those solution at the moment.
> >
> > And if I define a compilation constant that will tell the compiler if we
> > are making an executable or not? That way, you will just have to add a
> > "#If Executable" (or something like that) to compile or not compile the
> > startup function ?
> >
> 
> This is the solution I implemented in revision #4715. Tell me if it fits 
> your needs.
> 
> Regards,
> 
Benoît,

I'm trying it but I need a bit of help on usage.  (I'm using a library
that has a startup form not a module.  Is this a bad idea?)

Public Sub Form_Open()

#If Executable
  Me.Center
  LoadInfos
#Else
  Error "This is a library.\nPlease do not run it directly"
  Message.Title = "Don't do that!"
  Message.Error("This is a library.\nPlease do not run it directly",
"OK")
  Quit
#Endif

End

If I compile the project and run it via gbx3, I get the expected "Don't
do that" messages, but if I run it in the IDE I get the same thing.

Bruce


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to