VC中class myclass
{
public
myclass();
virtual ~myclass();
protected:
bool MyErrorMsg( UINT myID );
}
bool myclass::MyErrorMsg( UINT myID )
{
CString strMsg;
strMsg.LoadString(myID);
AfxMessageBox( strMsg, (MB_ICONERROR|MB_OK), 0 ); return false;
}在delphi中我这样写
type myclass = class
public
constructor myclass();
destructor Destroy; override;
protected
function MyErrorMsg(myID: DWORD): Boolean;
end;function myclass.MyErrorMsg(myID: DWORD): Boolean;
var strMsg: CString; //这一句报错 和string类型一样吗 该如何修改
begin
strMsg.LoadString(nID);//这一句也提示错误 这个LoadString函数在delphi中如何写?
MessageBox(0, strMsg, '提示', MB_ICONERROR and MB_OK);
Result := False;
end;
{
public
myclass();
virtual ~myclass();
protected:
bool MyErrorMsg( UINT myID );
}
bool myclass::MyErrorMsg( UINT myID )
{
CString strMsg;
strMsg.LoadString(myID);
AfxMessageBox( strMsg, (MB_ICONERROR|MB_OK), 0 ); return false;
}在delphi中我这样写
type myclass = class
public
constructor myclass();
destructor Destroy; override;
protected
function MyErrorMsg(myID: DWORD): Boolean;
end;function myclass.MyErrorMsg(myID: DWORD): Boolean;
var strMsg: CString; //这一句报错 和string类型一样吗 该如何修改
begin
strMsg.LoadString(nID);//这一句也提示错误 这个LoadString函数在delphi中如何写?
MessageBox(0, strMsg, '提示', MB_ICONERROR and MB_OK);
Result := False;
end;
后者不行,c++的类,别人访问起来不方便,要使用通用的char *前者,没问题,只是LoadString函数是从文件还是资源load,要搞清楚
这样,最简单的,你调试一下vc的代码,看变量怎么变化的,再用delphi去实现