核心API的帮助及例子(英文,全部DELPHI)(0分)

  • 主题发起人 主题发起人 歪就歪
  • 开始时间 开始时间

歪就歪

Unregistered / Unconfirmed
GUEST, unregistred user!
刚弄到一个HELP文件,包括核心API的帮助信息。每个一API均有完整
例子代码。英文,但却是100%DELPHI代码。
是中级和低级程序员的理想工具。文件Zip后有1.4M,其中主要的帮助
文件名为:Coreapi.hlp,大小为1.02M
歪就歪的歪主意是:
任何人若想要这个文件,可以在“非技术问题”内提一个200分的问题,
主题词为:Junk y9y。问题的内容为空(不得有任何联系办法),并给
我email你的Pop3信箱地址。我的地址为:tianhai@hotmail.com
当我收到200分后,将于24小时内给你寄去。
完成这个交易的附带条件是(完全依赖您本人的信誉):
一、不得在《大富翁》上以任何形式扩散这个文件,以免断了我的财路。
二、不许骂我贪心、更不许骂我的主意歪!
等歪就歪挣够了钱,就能放开了问问题了!
 
以下是帮助文件中关于CreateProcess的说明:
Unit
Windows.Pas
Syntax
CreateProcess(
lpApplicationName: PChar; {pointer to the name of the application}
lpCommandLine: PChar; {pointer to the command line of the application}
lpProcessAttributes, {pointer to process security attributes}
lpThreadAttributes: PSecurityAttributes; {pointer to the thread security attributes}
bInheritHandles: BOOL; {inheritance flag}
dwCreationFlags: DWORD; {creation flag}
lpEnvironment: Pointer; {pointer to environment block}
lpCurrentDirectory: PChar; {pointer to the current directory}
const lpStartupInfo: TStartupInfo; {pointer to a TStartupInfo data structure}
var lpProcessInformation: TProcessInformation {pointer to a TProcessInformation data structure}
): BOOL; {returns TRUE or FALSE}
Description
This function will create a new process and its primary thread. The primary thread created will have an initial stack size that is specified in the header of the executable, and the thread will begin
execution at the executable image's entry point. The entry point of a Delphi executable is set by choosing Project|Options, clicking on the Linker page, an modifying the image base setting. The default value for the image base should never need to be modified.
Parameters
lpApplicationName: A pointer to a null terminated string that specifies the name of the executable. If this parameter is set to NIL, the lpCommandLine parameter must contain the path and executable name (i.e. C:/Windows/Wordpad.exe Readme.txt). Under Window NT, this parameter should be set to NIL and the lpCommandLine parameter should be used to specify the executable name.
lpCommandLine: A null terminated string that specifies the command line for the executable. If this parameter is set to NIL, the lpApplicationName parameter can be used for the command line of the application. If neither of these parameters are set to NIL, the lpApplicationName parameter will indicate the path and name of the application, and the lpCommandLine parameter will indicate the command line of the application. If the lpApplicationName parameter is set to NIL, the first space delimited portion of the lpCommandLine parameter will be the application name. If the EXE extension is not given, it will be appended unless there is a (.) in the filename or the filename contains the path.
lpProcessAttributes: A pointer to a TSecurityAttributes structure that specifies the security descriptor for the process. If this parameter is set to NIL, the process will have the default security descriptor and is not inheritable. See the CreateFile function for a description of this parameter.
lpThreadAttributes: A pointer to a TSecurityAttributes structure that specifies the security descriptor for the thread of the process. If this parameter is set to NIL, the thread will have the default security descriptor and is not inheritable. See the CreateFile function for a description of this parameter.
bInheritHandles: Indicates if the new process will inherit handles opened by the calling process. If this parameter is set to TRUE, the created process will inherit all the open handles of the calling process. The inherited handles will have the same value and access privileges as the original handles.
dwCreationFlags: Specifies the creation of the process and control of the priority class. Priority class defaults to NORMAL_PRIORITY_CLASS. If the creating process has a priority class of IDLE_PRIORITY_CLASS, the child default priority class will be IDLE_PRIORITY_CLASS.
lpEnvironment: A pointer to an environment block for the new process. If this parameter is set to NIL, the new process will use the environment of the calling process. Please see the GetEnvironmentStrings function for more information.
lpCurrentDirectory: A null terminated string specifying the current drive and directory for the new process. If this parameter is set to NIL, the new process will have the same current directory as the calling process.
lpStartupInfo: A pointer to a TStartupInfo structure that specifies how the main window of the new process should appear. Please see the GetStartupInfo function for more information.
lpProcessInformation: A variable of type TProcessInformation that receives information about the new process. The TProcessInformation data structure is defined as:
TProcessInformation = record
hProcess: THandle; {the process handle}
hThread: THandle; {a handle to the primary thread}
dwProcessId: DWORD; {a global process identifier}
dwThreadId: DWORD; {a global thread identifier}
end;

hProcess: A handle to the newly created process.
hThread: A handle to the primary thread of the newly created process.
dwProcessId: A global process identifier used to identify a process.
dwThreadId: A global thread identifier use to identify a thread.
Return Value
If the function succeeds, it returns TRUE;
otherwise it returns FALSE. To get extended error information, call the GetLastError function.
The Tomes of Delphi 3: Win32 Core API Help File by Larry Diehl
 
以下是CreateProcess的例子
procedure TForm1.ShowProgress;
var
ICount: Integer;
// general loop counter
begin
{wait for the semaphore, and get ownership}
WaitForSingleObject(SemaphoreHandle, INFINITE);
{display a visual indicator}
for ICount := 1 to 1000do
begin
Gauge1.Progress := ICount;
end;

{release the semaphore}
ReleaseSemaphore(Form1.SemaphoreHandle, 1, nil);
end;

procedure TForm1.Button1Click(Sender: TObject);
var
StartUpInfo: TStartUpInfo;
// holds startup information
ProcessInfo: TProcessInformation;
// holds process information
CurDir: string;
// holds the current directory
begin
{create the semaphore, nonsignaled}
SemaphoreHandle := CreateSemaphore(nil, 0, 2, 'MikesSemaphore');
{initialize the startup info structure}
FillChar(StartupInfo, SizeOf(TStartupInfo), 0);
with StartupInfodo
begin
cb := SizeOf(TStartupInfo);
dwFlags := STARTF_USESHOWWINDOW;
wShowWindow := SW_SHOWNORMAL;
end;

{launch the semaphore sibling program for the example}
CurDir := ExtractFilePath(ParamStr(0))+'ProjectOpenSemaphore.exe';
CreateProcess(PChar(CurDir), nil, nil, nil, False,
NORMAL_PRIORITY_CLASS, nil, nil, StartupInfo, ProcessInfo);
end;

procedure TForm1.Button2Click(Sender: TObject);
var
OldValue: DWORD;
// holds the previous semaphore count
begin
{release the semaphore}
ReleaseSemaphore(SemaphoreHandle, 2, @OldValue);
{start the visual indication}
ShowProgress;
end;

The Semaphore Sibling Program
procedure TForm1.Button1Click(Sender: TObject);
var
ICount: Integer;
// general loop counter
SemaphoreHandle: THandle;
// holds the semaphore handle
PrevCount: DWORD;
// holds the previous semaphore counter
begin
{Open a handle to the semaphore}
SemaphoreHandle := OpenSemaphore($00f0000 or $00100000 or $3, FALSE,
'MikesSemaphore');
{wait to achieve ownership of the semaphore}
WaitForSingleObject(SemaphoreHandle, INFINITE);
{display a visual indication}
for ICount := 1 to 100000do
begin
Gauge1.Progress := ICount;
end;

{release the semaphore}
ReleaseSemaphore(SemaphoreHandle, 1, @PrevCount);
end;

 
啊呀呀!我错了!
各路好汉,光棍再狠,不断人财路!嫌言碎语不许讲!
 
我要,我开题目了,y9y你接着:)
 
yes,i accept it
 
歪歪兄,俺也开题了,400分。
 
真是生财有道呀! :(
不过也只有接受“奸商”y9y的价钱:(
 
我也要,我也开题目了,y9y我可口你可乐了
 
英国病人:麻烦请你给: tianhai@hotmail.com发一个邮件,并结束你
的问题,我会跟据你的来信地址,把文件ATTACH过去
 
歪歪兄,400元早已付清,怎还不见来货?
不法歼商歪就歪借农忙时机倒卖公共财产,非法牟利已达1000余元,
预计本日内即将成为本月大富翁之首富。
 
O*O: 我已经在20分钟前把信寄去了,烦你再检查一下信箱。
歪就歪虽是投机倒把,但决不会坑蒙拐骗。
谢谢帮衬小店生意。
 
我开题目了,信也发了.
 
我也开题目了,请发到我登记的email.
我才知道什么叫"一日暴富"的暴发户.
 
歪就歪:
开题目了,信也发了,就等着Coreapi.hlp了。
 
哈哈,原来可以这样挣银子,早知如此,我早就成大富翁第一名了:-)
 
歪就歪:
我即将开题目,你等着
 
LiuJZX:
谢谢了,不过,这会儿太晚了,我得回床上等着了。明天再来。
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
2K
DelphiTeacher的专栏
D
后退
顶部