|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
redplug How do I cheat? Reputation: 0
Joined: 20 Jun 2012 Posts: 9
|
Posted: Thu Jun 21, 2012 5:27 am Post subject: Access Violation on calling ce.closeCE() from dll |
|
|
Hi,
I am writing a Plugin and want to close the CE Window if you close my created form. So i created an OnClose event.
But if i close the form i get an Access Violation error from CE.
Any idea why?
Code: | unit WoWBotFormUnit;
{$mode objfpc}{$H+}
interface
uses
Windows, Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
StdCtrls, Grids, ExtCtrls, CEPluginSDK, WoWApi;
type
{ TWoWBotForm }
TWoWBotForm = class(TForm)
ButtonSend: TButton;
ButtonHideCEMAinWindow: TButton;
ButtonShowCEMainWindow: TButton;
EditCommand: TEdit;
MemoStatus: TMemo;
procedure ButtonHideCEMAinWindowClick(Sender: TObject);
procedure ButtonShowCEMainWindowClick(Sender: TObject);
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
private
{ private declarations }
public
{ public declarations }
end;
function GetVersion(var PluginVersion: TPluginVersion; SizeOfPluginVersion: Integer): BOOL; stdcall;
function InitializePlugin(ExportedFunctions: PExportedFunctions; PluginId: DWord): BOOL; stdcall;
function DisablePlugin: BOOL; stdcall;
var
CEExported: TExportedFunctions;
WoWBotForm: TWoWBotForm;
implementation
{$R *.lfm}
{ TWoWBotForm }
procedure TWoWBotForm.FormClose(Sender: TObject; var CloseAction: TCloseAction);
begin
CEExported.closeCE();
end;
procedure TWoWBotForm.ButtonShowCEMainWindowClick(Sender: TObject);
begin
CEExported.unhideMainCEwindow();
end;
procedure TWoWBotForm.ButtonHideCEMAinWindowClick(Sender: TObject);
begin
CEExported.hideAllCEWindows();
end;
function GetVersion(var PluginVersion: TPluginVersion; SizeOfPluginVersion: Integer): BOOL; stdcall;
begin
Result := false;
if SizeOfPluginVersion <> SizeOf(TPluginVersion) then exit;
PluginVersion.version := 1;
PluginVersion.pluginname := 'WoW Bot';
Result := true;
end;
function InitializePlugin(ExportedFunctions: PExportedFunctions; PluginId: DWord): BOOL; stdcall;
begin
Application.Initialize;
CEExported := ExportedFunctions^;
CEExported.hideAllCEWindows();
WoWBotForm := TWoWBotForm.Create(Application);
WoWBotForm.Show();
Result := true;
end;
function DisablePlugin:BOOL; stdcall;
begin
Result := true;
end;
end.
|
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25291 Location: The netherlands
|
Posted: Thu Jun 21, 2012 6:59 am Post subject: |
|
|
Not sure, I think because your application.initialize is called inside the same thread as Cheat engine's gui thread
And when ce closes, it disables the plugins, so might be responsible for a crash as well (when it returns it has nothing to return to)
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|