解决方案 »
- 谁用过 deExpress cxRTTIInspector 控件 帮忙
- delphi idftp控件的问题
- vsscomm32.res 文件没有咋办。。。。??
- 关于twindowsmediaplayer的问题 急
- ADO的AsFloat返回的值有什么问题?
- 郁闷
- 请问,游戏中的鼠标和桌面上的鼠标有什么区别。
- 谁有Delphi的注册码?
- [资源分享] [视频教程] delphi for php 在线视频教程 :-) :-) :-)
- 怎样自定义事件
- 请问:如何利用google Finance或者yahoo Finance 获取汇率
- 窗口回调中,如何使按下这个Button时,能MessageBox??
2、在其它窗口:
var Node : TTreeNode;
begin
Node := TreeView1.Selected;
Node.ImageIndex:=0;
Node.StringData:=ID;
Node.SelectedIndex:=5;
.....
end;
begin
...
Node:= FormKcsp.TreeView1.Items.AddChild(FormKcsp.TreeView1.Selected,Edit1.Text);
Node.Data:=....end;
哦,d7也有的。Allocates space on and copies a string to the heap; returning a pointer to the string.UnitSysUtilsCategorybackward compatibility routinesDelphi syntax:function StrNew(const Str: PChar): PChar;C++ syntax:extern PACKAGE char * __fastcall StrNew(const char * Str);DescriptionStrNew allocates a copy of Str on the heap. If Str is nil (Delphi) or NULL (C++) or points to an empty string, StrNew returns a pointer to a new empty string.Otherwise, StrNew makes a duplicate of Str, obtaining space with a call to StrAlloc, and returns a pointer to the duplicated string. The allocated space is the length of Str + 5 bytes.
This example uses an edit control and a button on a form. When the button is clicked, memory is allocated for a copy of the text in the edit control, the text is displayed in a message box, and then the memory is deallocated.uses Sysutils;
procedure TForm1.Button1Click(Sender: TObject);var
Temp: PChar;
begin
// Allocate memory.
Temp := StrNew(PChar(Edit1.Text));
ShowMessage(Temp, 'StrNew, StrDispose example', MB_OK);
// Deallocate memory.
StrDispose(Temp);
end;那它与
ShowMessage(PChar(Edit1.Text), 'StrNew, StrDispose example', MB_OK);
的差别是什么呢?
就是多申请、释放一下了空间?
然後處理它的Selected.....