Delphi中调用Windows自带的图片和传真浏览器
Delphi中调用Windows自带的图片和传真浏览器查看图片,可以旋转图片也可以调用画图程序编辑图像。自己写不出来好的代码,就用系统自带的好了。
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,ShellAPI;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
Var
SysDir,StrParm,StrPicPath,StrRundll:array[0..128] of char;
p1,p2:pchar;
begin
GetSystemDirectory(SysDir,128);
StrRundll:=SysDir;
strcat(StrRundll,'\rundll32.exe');
// showmessage('获取rundll32路径正常');
StrParm:=SysDir;
Strcat(StrParm,'\shimgvw.dll imageview_fullscreen ');
StrPicPath:='D:\My Document\My Pictures\未命名.bmp';
strcat(StrParm,StrPicPath);
// showmessage('获取strparm正常');
ShellExecute(Form1.Handle,nil,pChar(@StrRundll),pChar(@StrParm),nil,SW_SHOWMAXIMIZED);
edit1.Text:=strparm;
end;
end.
相关文档:
Delphi操作注册表步骤如下:
-------------------------------------
1)在Uses中添加Registry单元;
2)声明TRegistry对象;
3)创建TRegistry对象;
4)指定根键;
----------------try------------------
5)打开需要操作的主键;
6)读写操作;
7)保存并关闭主键;
--------------finally----------------
......
// 判断是否是数值型 By yangxiao 2007.7.21
function isNumeric(strText: WideString): Boolean;
var
s: string;
i, l, p: Integer;
begin
Result := False;
l := Length(strText);
if l = 0 then Exit;
s := '';
for i:=1 to l do
......
开发步骤:
1、创建ActiveX Library工程。
2、创建COM Object。
3、创建Type Library,并创建相应接口。
4、创建接口对应的函数和实现。
具体如下:
1、创建ActiveX Library工程。
new|other|activeX|activeX library
Delphi会自动生成框架代码,直接编译的话就可以得到一个dll文件了;
如果想编译出来的是ocx文 ......
设有以下三个变量:
var
s:string;
p:pchar;
a:array[1..20] of char;
那么三者之间的转换如下:
1、字符串到PChar
p:=PChar(s);
2、PChar到字符串
s:=p;
3、PChar到字符数组
StrCopy(@a,p);
4、字符数组到PChar
......
delphi中Synchronize这个东东有什么用?我知道是线程同步使用的
是否是一个函数或变量,当一个线程在使用时,如果这个函数使用了Synchronize修钸的话就不允许别一个线程来调用这个函数
1楼:别的线程会等待该操作完成后才能继续
2楼:你说的基本是这个意思。它的目的是避免多个子线程同时访问主线程资源。
示例:
......