小编isa*_*isa的帖子

在InstalledLocation StorageFolder中尝试CreateFileAsync时拒绝访问?

我在InstalledLocation StorageFolder中尝试CreateFileAsync时拒绝Access

StorageFolder storageFolder = Windows.ApplicationModel.Package.Current.InstalledLocation;
StorageFile file = await storageFolder.CreateFileAsync("fileNmae", Windows.Storage.CreationCollisionOption.ReplaceExisting);
Run Code Online (Sandbox Code Playgroud)

我也试过了

var storageFolder = await StorageFolder.GetFolderFromPathAsync("ms-appx:///");
Run Code Online (Sandbox Code Playgroud)

得到"价值不在预期的范围内"

我可以去周围并CreateFileAsyncWindows.Storage.ApplicationData.Current.LocalFolder随后CopyAsync以InstalledLocation StorageFolder?

StorageFolder storageFolder = Windows.Storage.ApplicationData.Current.LocalFolder;
StorageFile file = await storageFolder.CreateFileAsync("fileName", Windows.Storage.CreationCollisionOption.ReplaceExisting);

StorageFolder installedLocationFolder = Windows.ApplicationModel.Package.Current.InstalledLocation;
var result = await file.CopyAsync(installedLocationFolder, "fileName", Windows.Storage.NameCollisionOption.ReplaceExisting);
Run Code Online (Sandbox Code Playgroud)

但是CreateFileAsync在InstalledLocation中,StorageFolder会拒绝访问?是因为安全原因还是我在这里编码错了?

c# file-io microsoft-metro windows-8

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

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

是否可以在Delphi可执行应用程序中嵌入和运行exe文件?

资源文件(.RES)接受任何类型的二进制文件,但如果它是exe文件,我该如何运行它?

embed delphi resource-file embedded-resource

6
推荐指数
2
解决办法
4608
查看次数

6
推荐指数
2
解决办法
3724
查看次数

如何在Delphi中预览屏幕保护程序?

我希望我的屏幕保护程序出现在屏幕保护程序预览框中?

delphi screensaver

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

在delphi 2009中创建一个gif动画文件?

gif := TgifImage.Create;
gif.Width := 100;
gif.Height := 100;
gif.AnimationSpeed := 500;
gif.Animate := true;
gif.add(image1.Picture.Bitmap);
gif.add(image2.Picture.Bitmap);
gif.add(image3.Picture.Bitmap);
gif.SaveToFile('gif.gif');
Run Code Online (Sandbox Code Playgroud)

这只循环一次,速度不是500?

如何让它循环并设置速度?

delphi delphi-2009

5
推荐指数
2
解决办法
4954
查看次数

为什么在Delphi中循环比C#更快?

德尔福:


procedure TForm1.Button1Click(Sender: TObject);
var I,Tick:Integer;
begin
  Tick := GetTickCount();
  for I := 0 to 1000000000 do
    begin
    end;
  Button1.Caption := IntToStr(GetTickCount()-Tick)+' ms';
end;

C#:


private void button1_Click(object sender, EventArgs e)
        {
            int tick = System.Environment.TickCount;
            for (int i = 0; i < 1000000000; ++i)
            {
            }
            tick = System.Environment.TickCount - tick;
            button1.Text = tick.ToString()+" ms"; 
        }

德尔福提供大约515毫秒

C#给出大约3775毫秒

c# delphi

5
推荐指数
3
解决办法
3809
查看次数

如何在delphi中将图标转换为具有alpha透明度的png?

下面的代码将从文件中提取图标并将其转换为png但没有alpha透明度?

var
   IconIndex : word;
   icon:TIcon;
   png:TPngImage;
   bmp:TBitmap;
begin
  IconIndex := 0;
  icon := TIcon.Create;
  icon.Handle := ExtractAssociatedIcon(hInstance,pChar(Edit1.Text), IconIndex) ;
  bmp:= TBitmap.Create;
  bmp.LoadFromFile('blank.bmp');
  DrawIcon(bmp.Canvas.Handle, 0, 0, icon.Handle) ;
  png := TPngImage.Create();
  png.Assign(bmp);
  png.SaveToFile('icon.png');
end;
Run Code Online (Sandbox Code Playgroud)

delphi

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

避免功能是否会提高性能?

这是一个小测试:

function inc(n:integer):integer;
begin
  n := n+1;
  result := n;
end;


procedure TForm1.Button1Click(Sender: TObject);
var
  start,i,n:integer;
begin
  n := 0;
  start := getTickCount;
  for i := 0 to 10000000 do begin
    inc(n);//calling inc function takes 73 ms
    //n := n+1; writing it directly takes 16 ms
  end;
  showMessage(inttostr(getTickCount-start));
end;
Run Code Online (Sandbox Code Playgroud)

delphi optimization

2
推荐指数
3
解决办法
1065
查看次数

如何从TBitmaps序列中编写avi文件?

我找到了一种从BMP文件中编写avi的方法:
http :
//www.delphi3000.com/articles/article_2770.asp?SC =我想从TBitmaps的数组或TList中编写avi?

delphi

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

如何在windows 8 metro应用程序中将html5画布保存为图像文件?

var myImage = canvas.toDataURL("image/png");
Run Code Online (Sandbox Code Playgroud)

我认为myImage现在以png格式编码的图像字节如何保存myImage为文件(在图像文件夹中)?

javascript canvas microsoft-metro windows-8

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

如何将OnComplete事件添加到bitmap.SaveToFile('img.bmp');

当我的位图完全保存时,我想暂停我的应用程序?

delphi

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

调用Beginthread API时如何避免GUI冻结?

下面是2个线程中的2个按钮之间的简单比赛,

这将冻结表单上的其他组件.


procedure moveButton1();
var
  I: Integer;
begin
  for I := 0 to 6000 do
    Form1.Button1.Left := Form1.Button1.Left - 1;
  Form1.Caption := 'Button1 won!';
  EndThread(0);
end;

procedure moveButton2(); var I: Integer; begin for I := 0 to 6000 do Form1.Button2.Left := Form1.Button2.Left - 1; Form1.Caption := 'Button2 won!'; EndThread(0); end;

procedure TForm1.Button3Click(Sender: TObject); var thread1, thread2,tick : Integer; id1, id2 : LongWord; begin thread1 := BeginThread(nil, 0, Addr(moveButton1), nil, 0, id1);

thread2 := BeginThread(nil, 0, Addr(moveButton2), nil, 0, id2); CloseHandle(thread1); …

Run Code Online (Sandbox Code Playgroud)

delphi

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