小编Mar*_*lka的帖子

为什么我不能在接收数组参数的函数中使用SetLength?

我试图使用以下函数来设置动态数组的长度,这是一个var param.我尝试编译代码时只有一个错误:

[dcc64错误] lolcode.dpr(138):E2008不兼容的类型

function execute(var command : array of string) : Boolean;
begin
  // Do something
  SetLength(command,0);
end;
Run Code Online (Sandbox Code Playgroud)

delphi parameters

8
推荐指数
2
解决办法
4784
查看次数

cmake cygwin make.exe 错误

我在使用 CMake 2.8.9 时遇到了问题。我使用图形用户界面。我尝试制作一个makefile(食人魔1.8)。
由于我使用的是 Windows 7 x64,我将 CygWin 与 gcc.exe 和 g++.exe 以及 make.exe(位于 bin 目录中)一起使用。
当我尝试“配置”时,CMake 会记录以下错误:

The C compiler identification is unknown
The CXX compiler identification is unknown
Check for working C compiler: G:/cygwin/bin/gcc.exe
Check for working C compiler: G:/cygwin/bin/gcc.exe -- broken
CMake Error at G:/Program Files/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):
The C compiler "G:/cygwin/bin/gcc.exe" is not able to compile a simple test program.

It fails with the following output:

Change Dir: H:/Ogre/gcc18/CMakeFiles/CMakeTmp



Run Build Command:G:/cygwin/bin/make.exe "cmTryCompileExec2682355191/fast"

/usr/bin/make -f …
Run Code Online (Sandbox Code Playgroud)

cygwin makefile cmake

6
推荐指数
1
解决办法
5690
查看次数

将用户添加到本地组

此功能应该在Windows Server 2003和2008 R2上运行使用命令行逐行执行它是SUCCESSFULL!脚本执行失败.

function addUser2Group([string]$user,[string]$group)
{    
    $cname = gc env:computername
    $objUser = [ADSI]("WinNT://$user")
    $objGroup = [ADSI]("WinNT://$cname/$group,group")  
    $members = $objGroup.PSBase.Invoke('Members')
    $found = $false

    foreach($m in $members)
    {
        if($m.GetType().InvokeMember('Name', 'GetProperty', $null, $m, $null) -eq $user)
        {
            $found = $true
        }
    }

    if(-not $found)
    {
        $objGroup.PSBase.Invoke('Add',$objUser.PSBase.Path)
    }

    $members = $objGroup.PSBase.Invoke('Members')
    $found = $false
    foreach($m in $members)
    {
        if($m.GetType().InvokeMember('Name', 'GetProperty', $null, $m, $null) -eq $user)
        {
            $found = $true
        }
    }

    return $found
}

addUser2Group('MyGlobalMonitoringUser',"SomeDBGroup")
Run Code Online (Sandbox Code Playgroud)

它应该将用户添加到本地组.但它只给我以下错误:

Exception calling "Invoke" with "2" argument(s): "Unknown …
Run Code Online (Sandbox Code Playgroud)

powershell

1
推荐指数
1
解决办法
3万
查看次数

当鼠标不在FireMonkey应用程序上移动时,Delphi"While"性能下降

我正在玩Delphi + openGL.因为我很懒,所以我想用FireMonkey为我制作表格.
所以我制作了一个FireMonkeyHD应用程序,初始化了GL,渲染了一个基本的立方体......并发现了一些奇怪的行为.当我不移动我的鼠标时,我得到大约10FPS.当我移动鼠标时,性能很容易上升到500FPS(显然)更多.那可能是什么?
*注意:我开始使用主线程中的onKeyDown事件进行渲染...

为了更好地理解,两个图片: 没有鼠标移动的应用程序 应用w野鼠移动

一些代码:

unit Unit1;

interface

uses
{ ... }
;

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure FormKeyDown(Sender: TObject; var Key: Word; var KeyChar: Char;
      Shift: TShiftState);
  private
    degen
    : IDeGEn;
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.fmx}

procedure TForm1.FormCreate(Sender: TObject);
var
  DeGEnFactory
  : TDeGEnFactory;
begin
  { ... }
  // Load DeGEn
  degen := DeGEnFactory.newDeGEn(WindowHandleToPlatform(Form1.Handle).Wnd);

  // Initialize
  degen.get3D.init(600, 800);
  degen.get3D.setOnRender(function : Boolean
  var
    v3d
    : R3DVector;
  begin …
Run Code Online (Sandbox Code Playgroud)

delphi opengl onkeydown firemonkey

1
推荐指数
1
解决办法
779
查看次数