string类型如何转化到pchar类型

shyboy2003 2003-09-12 05:21:10
var
mes: string;
response: integer;
begin

mes := '确定删除 ' + adotable1.fieldvalues['轴承型号'] + '?';

response := application.messagebox(mes, '提示', MB_OKCANCEL)


总是提示messagebox中mes类型应该是pchar,而不是string
请问如何转换?
急。。。。。。。。。。
...全文
59 21 打赏 收藏 转发到动态 举报
写回复
用AI写文章
21 条回复
切换为时间正序
请发表友善的回复…
发表回复
coreblood 2003-09-13
  • 打赏
  • 举报
回复
呵呵~
zousoft 2003-09-13
  • 打赏
  • 举报
回复
啊?这是什么意思?你是不是给的分超过问题分数了?
shyboy2003 2003-09-13
  • 打赏
  • 举报
回复
谢谢各位
问题解决了
给分的时候系统说:跟贴次数大于跟给分次数
怎么给分的哦
gx 2003-09-13
  • 打赏
  • 举报
回复
楼上都很正确,可以结帖了
aushqh 2003-09-13
  • 打赏
  • 举报
回复
messagebox具体参数定义如下:

int MessageBox(

HWND hWnd, // handle of owner window
LPCTSTR lpText, // address of text in message box
LPCTSTR lpCaption, // address of title of message box
UINT uType // style of message box
);


参数说明:

hWnd

Identifies the owner window of the message box to be created. If this parameter is NULL, the message box has no owner window.

lpText

Points to a null-terminated string containing the message to be displayed.

lpCaption

Points to a null-terminated string used for the dialog box title. If this parameter is NULL, the default title Error is used.

uType

Specifies a set of bit flags that determine the contents and behavior of the dialog box.
dawnming 2003-09-13
  • 打赏
  • 举报
回复
application.messagebox(pchar(mes), '提示', MB_OKCANCEL)

我原本不是一头猪
kaiyun97 2003-09-13
  • 打赏
  • 举报
回复
同上
DY2003 2003-09-13
  • 打赏
  • 举报
回复
PChar(string);
zousoft 2003-09-13
  • 打赏
  • 举报
回复
string -> pchar: PChar(string);
pchar -> string: 直接用,会自动转的。
sailer_shi 2003-09-13
  • 打赏
  • 举报
回复
var
mes: string;
response: integer;
begin

mes := '确定删除 ' + adotable1.fieldvalues['轴承型号'] + '?';

response := application.messagebox(pChar(mes), '提示', MB_OKCANCEL)
很土 2003-09-13
  • 打赏
  • 举报
回复
PChar(String) 强制类型转换即可.
FrameSniper 2003-09-13
  • 打赏
  • 举报
回复
同意楼上的!
jpyc 2003-09-13
  • 打赏
  • 举报
回复
pchar(your_string)
tjff2000 2003-09-13
  • 打赏
  • 举报
回复
同上。
sy_315 2003-09-13
  • 打赏
  • 举报
回复
pchar(your_string)
是一个好方法
var
mes: string;
response: integer;
begin

mes := '确定删除 ' + adotable1.fieldvalues['轴承型号'] + '?';

response := application.messagebox(pchar(mes), '提示', MB_OKCANCEL)
jzzm 2003-09-13
  • 打赏
  • 举报
回复
pchar(string)不就行了!
myshushu005 2003-09-13
  • 打赏
  • 举报
回复
用强自转换不就行了吗。
response := application.messagebox(pchar(mes), '提示', MB_OKCANCEL);
shyboy2003 2003-09-13
  • 打赏
  • 举报
回复
呜。。
我自己顶一下
overtime 2003-09-13
  • 打赏
  • 举报
回复
pchar(string)
syoutaku 2003-09-13
  • 打赏
  • 举报
回复
老版本的DELPHI还可以用strpcopy函数
加载更多回复(1)

5,930

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧