我一直在努力解决这个问题,做一些简单的事情似乎花了太长时间.
我有这样一个文件:
[
{
"FirstName": "Oleg",
"Surname": "Buckley"
},
{
"FirstName": "Amery",
"Surname": "Mcmillan"
},
{
"FirstName": "Denton",
"Surname": "Burnett"
....
Run Code Online (Sandbox Code Playgroud)
我希望能够将它们读入我的程序.到目前为止,我已经完成了这个非常小的功能:
function GetGeneratedNames: TArray<string>;
var fileName: TFileName;
JSONValue, jv: TJSONValue;
JSONArray: TJSONArray;
jo: TJSONObject;
pair: TJSONPair;
begin
result := nil;
filename := ExePath + 'Names.json';
JSONValue := TJSONObject.ParseJSONValue(TEncoding.ASCII.GetBytes(TFile.ReadAllText(filename)), 0);
if JSONValue is TJSONArray then begin
for jv in (JSONValue as TJSONArray) do begin
if jv is TJSONObject then begin
jo := jv as TJSONObject;
for pair in jo do …Run Code Online (Sandbox Code Playgroud) 我习惯于使用未使用的方法给出提示并且在装订线中没有蓝点.但那并没有发生.我刚刚将一个表单单元中的大量方法移动到另一个单元格中,期望找到它们的提示,这样我就可以避免将它们剪掉然后发现我需要它们的危险.
但我没有提示,未使用的方法有蓝点.这很可能是因为新的内省.我不喜欢哪个.
我试图在Win 7上从Delphi XE2中停止mysql.我已经根据我在网上为Delphi 7找到的东西编写了一些代码,这应该是这样做的,但它不起作用:
function StopMySQL: boolean;
const
UserName = 'Mark';
Domain = 'PC-Mark';
Command = 'net stop mysql';
var
StartupInfo: TStartupInfo;
ProcessInfo: TProcessInformation;
begin
FillChar(StartupInfo, SizeOf(StartupInfo), #0);
StartupInfo.cb := SizeOf(StartupInfo);
StartupInfo.dwFlags := STARTF_USESHOWWINDOW;
StartupInfo.wShowWindow := SW_HIDE;
result := CreateProcessWithLogonW(Username, Domain, Password, 0, nil, Command, 0, nil, nil, StartupInfo, ProcessInfo);
if result then
WaitForSingleObject(ProcessInfo.hProcess, INFINITE);
end;
Run Code Online (Sandbox Code Playgroud)
有谁知道如何做到这一点?
TIA Mark Patterson