高手关照一下,我刚进入Delphi!!! (32分)

  • 主题发起人 主题发起人 ParisHistory
  • 开始时间 开始时间
P

ParisHistory

Unregistered / Unconfirmed
GUEST, unregistred user!
以下几个小问题:
1)我放一ShellListView在一form上,指定路径
“E:/my document/”下有一些,word、excel、
ppt etc.文件,运行程序后,双击ShellListView中
的word图标,提示word出错,但是通过在word图标上
点右鍵,点打开是没有问题的。我不知道此问题如何
解决?
2)为什么有时候释放的时候,只有free就可以了,
为什么有的时候还要使***:=nil才可以。
另外free,nil,release and destroy etc.
这些都是怎样用的,在书上找不到系统的介绍的,
请各位高手关照一下。
3)另外,如何用opendialog的OpenExecute事件,
在点击‘打开’按纽时,支持多种文档格式,
such as word,excel and ppt etc.
:))
 
这些都是很简单的问题呀,还是先多看看别人的例子吧
 
to smallghost:
你有时间吗?
   给我发一个listview实现word,excel etc.的打开新建
   窗体有大图标,小图标和详细列表方式查看的例子好吗?
   my email:faguobali@163.com
 
to smallghost:
还确实不好回答,上面的问题你能回答上来吗?
 如果能的话,给我发过来。
  不要太傲慢了!
:)
 
都是ABC问题啊。
1. 帮助中很详细说明了。
2. 参看$(DELPHI)/Demos/Virtual ListView/下的例子
3. 察看OpenDialog.Filter 这个属性的帮助或者直接编辑看看就知道了。
4. 你这个"新建"按钮是谁的? 你自己做的还是OpenDialog里的? 自己做的话看OnClick事件的帮助。
是Dialog里的那么用下面语句实现(根本不需要什么事件):
if OpenDialog1.Execute then
begin
// 点了"新建"或"打开"按钮就会进到这里
end
else //点了"取消"按钮就在这
5. 直接设置 某个MdiChildForm.Top和Left即可
 
1.The reserved word nil is a special constant that can be assigned to any pointer. When nil is assigned to a pointer, the pointer doesn抰 reference anything.
***
Destroys an object and frees its associated memory, if necessary.

procedure Free;

Description

Use Free to destroy an object. Free automatically calls the destructor if the object reference is not nil. Any object instantiated at runtime that does not have an owner should be destroyed by a call to Free so that it can be properly disposed of and its memory released. Unlike Destroy, Free is successful even if the object is nil; so if the object was never initialized, Free won抰 result in an error.

When you call Free for a component, it calls Free for all components that it owns梩hat is, all components in its component list. Since a form owns all the controls and nonvisual components that are created on it in design mode, those components are automatically freed when the form is freed. By default, all forms are owned by the Application object; when the application terminates, it frees the Application object, which frees all forms. For objects that are not components, or for components created with a nil owner, be sure to call Free after you are finished with them; otherwise the allocated memory will not be usable until after the application terminates.

Warning: Never explicitly free a component within one of its own event handlers or the event handler of a component it owns or contains. For example, don抰 free a button, or the form that owns the button, in its OnClick event handler.

To free a form, call its Release method, which destroys the form and releases the memory allocated for it after all its event handlers and those of the components it contains are through executing.
***
Destroys the form and frees its associated memory.

procedure Release;

Description

Use Release to destroy the form and free its associated memory.

Release does not destroy the form until all event handlers of the form and event handlers of components on the form have finished executing. Any event handlers of the form should use Release instead of Free. Failing to do so could lead to an access violation.

Note: Release returns immediately to the caller. It does not wait for the form to be freed before returning.

***
Destructor for the object instance.

destructor Destroy; override;

Description

Destroy is the destructor for the object instance.
Destroy is responsible for decrementing the value of gnInstanceCount prior to completion of the destructor. When gnInstanceCount reaches 0, the TIdStack instance in GStack is Freed and set to Nil.
Applications should not call the Destroy method, but use Free instead.
2.3.4.5 the same to up!
 
多人接受答案了。
 
后退
顶部