Shoutbox

About Initialize() - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Forum: Plug-Ins (/forumdisplay.php?fid=28)
+------ Thread: About Initialize() (/showthread.php?tid=12929)

About Initialize() by Whacko on 07-13-2003 at 07:33 PM

Patchou... i hope you're reading this.

in v2.20.51 you changed the plugin support a little bit by using a different thread for them. I Quote:

There are two modifications: first, Initialize() is called in a different thread. It is synchronised with the main thread, you shouldn't have to worry about it but well, you never know...  the second modification is a protection: if you messed with the header file distributed with the API package and your function is not compiled with __stdcall anymore, Plus! will block your plugin so no function after Initialize() will be called.


ok I understand why you did it... but doesnt it make the Initialize() function useless?? i cant initialize in that function anymore cos all get destroyed when the thread is closed.
So.. wouldn't it be a better idea to run the ENTIRE plugin in the other thread? Cos if something is wrong in another function it could still mess up. :)

To initialize my values now.. i have to do it when one of my other functions are called. which is kinda messy IMHO.

hope you understand what i mean :) furthermore.... keep up the fgood work :bow:


RE: About Initialize() by Derusc on 07-21-2003 at 04:48 PM

I'm agree too


RE: About Initialize() by Patchou on 07-21-2003 at 10:50 PM

Well, I have to say I don't understand what you problem is. When you initialize yoru variables, it maybe in a different thread but it's in the same process. Nothing will be destroyed when the thread exits. Can you give me more explanation about the problems your experiencing? (with a code snippet maybe).

Thanks,
Patchou


RE: About Initialize() by Derusc on 07-22-2003 at 07:09 AM

Sorry i thought  thread wasn't in the same process. and thread will be destroyed.


Sorry


RE: About Initialize() by Whacko on 07-22-2003 at 09:54 AM

Well, Im using delphi for my plugins btw. if i create a form in the Initialize() function, after the function is finished, the form is destroyed. So i cant show it after that anymore, i'd have to create it again. Maybe just a Delphi thing... or me coding really noobish :P but thats the problem :P


RE: About Initialize() by mrhuge on 07-22-2003 at 10:02 AM

Hmm, it seems like you're coding it like this:

code:
function Initialize([params]): boolean
var frmForm : TfrmForm;
begin
frmForm = TfrmForm.Create(nil);
end;

This way the form will be deleted after Initialize finishes. When you declare frmForm as a global variable, it won't be deleted.
RE: About Initialize() by Whacko on 07-22-2003 at 01:14 PM

no :P

code:
var frmmanager : TFrmmanager;

function initialize(params):boolean;
begin
  Application.CreateForm(TfrmManager, frmManager);
  result := true;
end;



RE: About Initialize() by mrhuge on 07-22-2003 at 01:21 PM

Have you tried doing

code:
frmmanager := TFrmmanager.Create(nil);
in stead of
code:
Application.CreateForm(TfrmManager, frmManager);
Maybe that helps.
RE: About Initialize() by Whacko on 07-22-2003 at 03:21 PM

no i use Application.Createform() cos i want Msgplus to be its creator... else it doesnt show when i use Form.show.


RE: About Initialize() by Patchou on 07-22-2003 at 03:33 PM

ok I see... well, I'll have to think about a way to go around the problem. Thanks.


RE: About Initialize() by Derusc on 07-24-2003 at 07:40 AM

Patchou  u are great !!!!   :D