loo30fer
شنبه 25 تیر 1390, 15:01 عصر
با سلام
من چند روزه دارم با Borland سی ++ کار میکنم و میخوام یک پلاگین رو باهاش پیاده کنم که با دلفی براحتی اینکار رو میکنم و SDK رو به دلخواهم تعریف کردم ولی الان میخوام این SDK رو تو ++C پیاده کنم معادلش رو نوشتم ولی نمیدونم چرا وقتی این SDK رو کمپایل میکنم هیچ کدوم از توابع کار نمیکنن؟
من کد SDK ای رو که تو دلفی و ++C رو پیاده کردم رو گذاشتم ممنون میشم کمک کنید و بگین اشکالات من تو کدوم قسمتها هست و به چی باید تغییرش بدم. با تشکر
unit PluginInterface;
interface
uses
Windows;
procedure SetParentWindow (hwnd: HWND); cdecl;
procedure SetFile(sFile: PChar); cdecl;
procedure SetData(sData: Integer); cdecl;
function GetFile(): PChar; cdecl;
function GetData(): Integer; cdecl;
function Copyright(): PChar; cdecl;
function GetInfo(): PChar; cdecl;
function GetShortInfo(): PChar; cdecl;
var
TextInput,TextOutput: String;
NumInput,NumOutput: Integer;
hMMBWindow: HWND;
implementation
procedure SetParentWindow (hwnd: HWND); cdecl;
begin
hMMBWindow := hwnd;
end;
procedure SetFile(sFile: PChar); cdecl;
begin
TextInput:= sFile;
end;
procedure SetData(sData: Integer); cdecl;
begin
NumInput := sData;
end;
function GetFile(): PChar; cdecl;
begin
result := PChar(TextOutput);
end;
function GetData(): Integer; cdecl;
begin
result := NumOutput;
end;
function Copyright(): PChar; cdecl;
begin
result := 'Copyright © 2011 Loo30fer';
end;
function GetInfo(): PChar; cdecl;
begin
result := 'Loo30fer';
end;
function GetShortInfo(): PChar; cdecl;
begin
result := 'http://Loo30fer.com';
end;
exports
SetFile,
SetData,
SetParentWindow,
GetFile,
GetData,
Copyright,
GetInfo,
GetShortInfo;
end.
//---------------------------------------------------------------------------
#include <windows.h>
#pragma hdrstop
#pragma argsused
#define to_char(n) (n)+'0'
//---------------------------------------------------------------------------
HWND hMMBWindow;
char TextInput, TextOutput;
int NumInput, NumOutput;
//---------------------------------------------------------------------------
extern "C" __declspec(dllexport) void SetParentWindow(HWND hwnd)
{
hMMBWindow = hwnd;
}
//---------------------------------------------------------------------------
extern "C" __declspec(dllexport) void SetFile(char sPath)
{
TextInput=sPath;
}
//---------------------------------------------------------------------------
extern "C" __declspec(dllexport) void SetData(int sData)
{
NumInput=sData;
}
//---------------------------------------------------------------------------
extern "C" __declspec(dllexport) char GetFile()
{
return TextOutput;
}
//---------------------------------------------------------------------------
extern "C" __declspec(dllexport) int GetData()
{
return NumOutput;
}
//---------------------------------------------------------------------------
extern "C" __declspec(dllexport) char* Copyright()
{
return "Copyright © 2011 Loo30fer";
}
//---------------------------------------------------------------------------
extern "C" __declspec(dllexport) char* GetInfo()
{
return "Loo30fer";
}
//---------------------------------------------------------------------------
extern "C" __declspec(dllexport) char* GetShortInfo()
{
return "http://Loo30fer.com";
}
//---------------------------------------------------------------------------
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
return 1;
}
//---------------------------------------------------------------------------
من چند روزه دارم با Borland سی ++ کار میکنم و میخوام یک پلاگین رو باهاش پیاده کنم که با دلفی براحتی اینکار رو میکنم و SDK رو به دلخواهم تعریف کردم ولی الان میخوام این SDK رو تو ++C پیاده کنم معادلش رو نوشتم ولی نمیدونم چرا وقتی این SDK رو کمپایل میکنم هیچ کدوم از توابع کار نمیکنن؟
من کد SDK ای رو که تو دلفی و ++C رو پیاده کردم رو گذاشتم ممنون میشم کمک کنید و بگین اشکالات من تو کدوم قسمتها هست و به چی باید تغییرش بدم. با تشکر
unit PluginInterface;
interface
uses
Windows;
procedure SetParentWindow (hwnd: HWND); cdecl;
procedure SetFile(sFile: PChar); cdecl;
procedure SetData(sData: Integer); cdecl;
function GetFile(): PChar; cdecl;
function GetData(): Integer; cdecl;
function Copyright(): PChar; cdecl;
function GetInfo(): PChar; cdecl;
function GetShortInfo(): PChar; cdecl;
var
TextInput,TextOutput: String;
NumInput,NumOutput: Integer;
hMMBWindow: HWND;
implementation
procedure SetParentWindow (hwnd: HWND); cdecl;
begin
hMMBWindow := hwnd;
end;
procedure SetFile(sFile: PChar); cdecl;
begin
TextInput:= sFile;
end;
procedure SetData(sData: Integer); cdecl;
begin
NumInput := sData;
end;
function GetFile(): PChar; cdecl;
begin
result := PChar(TextOutput);
end;
function GetData(): Integer; cdecl;
begin
result := NumOutput;
end;
function Copyright(): PChar; cdecl;
begin
result := 'Copyright © 2011 Loo30fer';
end;
function GetInfo(): PChar; cdecl;
begin
result := 'Loo30fer';
end;
function GetShortInfo(): PChar; cdecl;
begin
result := 'http://Loo30fer.com';
end;
exports
SetFile,
SetData,
SetParentWindow,
GetFile,
GetData,
Copyright,
GetInfo,
GetShortInfo;
end.
//---------------------------------------------------------------------------
#include <windows.h>
#pragma hdrstop
#pragma argsused
#define to_char(n) (n)+'0'
//---------------------------------------------------------------------------
HWND hMMBWindow;
char TextInput, TextOutput;
int NumInput, NumOutput;
//---------------------------------------------------------------------------
extern "C" __declspec(dllexport) void SetParentWindow(HWND hwnd)
{
hMMBWindow = hwnd;
}
//---------------------------------------------------------------------------
extern "C" __declspec(dllexport) void SetFile(char sPath)
{
TextInput=sPath;
}
//---------------------------------------------------------------------------
extern "C" __declspec(dllexport) void SetData(int sData)
{
NumInput=sData;
}
//---------------------------------------------------------------------------
extern "C" __declspec(dllexport) char GetFile()
{
return TextOutput;
}
//---------------------------------------------------------------------------
extern "C" __declspec(dllexport) int GetData()
{
return NumOutput;
}
//---------------------------------------------------------------------------
extern "C" __declspec(dllexport) char* Copyright()
{
return "Copyright © 2011 Loo30fer";
}
//---------------------------------------------------------------------------
extern "C" __declspec(dllexport) char* GetInfo()
{
return "Loo30fer";
}
//---------------------------------------------------------------------------
extern "C" __declspec(dllexport) char* GetShortInfo()
{
return "http://Loo30fer.com";
}
//---------------------------------------------------------------------------
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
return 1;
}
//---------------------------------------------------------------------------