当前位置:首页
开发技术指南» 文章正文
    引言:
 

 

 ·多用户系统的问题    »显示摘要«
    摘要: 小弟遇到这样一个问题,请各位解决:    一般我们为企业提供系统时,是给他提供多用户系统不是单用户系统。具体说,有几个企业都需要基于mysql+php的产品展示系统,我可以做一个通用的多用户系统,由这一个系统统一为他们提供服务,还是用一个单用户的系统,当企业需要时,单独为企业建立数据库、上传程序。这两种方法我感觉各有各有好处。各位谈谈自己的看法和经验,具体谈谈在什么情况下用什么样的方法 ......
    摘要: 如题, 我想让用户输入一个数字, 存在int id里, 然后传递给"http://www.some.com/test.cgi?id="中的id值, 这一切都在后台发生, 用sdk写的话需要什么技术? ......


delphi中如何调用DLL,谢谢回复

感谢昨晚的几位的解答,小虾谢了分儿也给了.  
  http://expert.csdn.net/Expert/topic/1690/1690082.xml?temp=.7899897  
   
  新问题如下:    
        用VC   写DLL在delphi   中用,原函数如下:  
   
        __declspec(dllexport)   int   _stdcall   WriteA(struct   cardinfo   *cardinfo);  
         
      __declspec(dllexport)   int   _stdcall   WriteB(unsigned   char   *key);  
   
      __declspec(dllexport)     int   _stdcall   OpenCom(int   com,   long   baud);  
         
  cardinfo   为结构体.   动态连接库为a.dll  
         
    大虾们给俺再解答一下吧,分儿继续给!      
    主要是关于参数的如何引用!  
   
   
 

NO.1   作者: tpmao

我的示例给你看看,不知道对你有什么帮助!!!!  
          //声明动态调用的过程  
          TGstr   =   function():Pchar;stdcall;                                                         //函数的声明  
          TMYProc   =   procedure(var   inhandle:HWND;   instring:pchar);stdcall;     //是否使用stdcall要依DLL文件决定  
                                                                                                                                          //注意静态调用时stdcall的位置  
          //静态调用动态库  
          procedure   messageshow(   var   inhandle:HWND;   instring:pchar);stdcall;   external   D:\MyProject\DELPHI\动态库的调用\动态库文件\dllformp.dll;  
        function   GetString():Pchar;stdcall;external   D:\MyProject\DELPHI\动态库的调用\动态库文件\dllformp.dll;  
        //方法二用name引出  
        //procedure   messagesho(   var   inhandle:HWND;   instring:pchar);stdcall;   external   D:\MyProject\DELPHI\动态库的调用\动态库文件\dllformp.dll   name   messageshow;  
  var  
      Form1:   TForm1;  
      MyLib:THandle;  
      i:integer;  
  implementation  
   
  {$R   *.dfm}  
   
  procedure   TForm1.Button1Click(Sender:   TObject);  
   
  var  
          temp:Pchar;  
          AHandle:HWND;  
  begin  
            temp:=呵呵,你好啊!;  
              AHandle:=application.Handle;  
              edit1.Text:=getstring();  
              messageshow(AHandle,temp);  
              edit1.Text:=;  
  end;  
   
  procedure   TForm1.Button2Click(Sender:   TObject);  
  var  
        temp1:Pchar;  
        UHandle:HWND;  
        P:TMYproc;  
        G:TGstr;  
  begin  
          temp1:=呵呵,你好啊!;  
          UHandle:=application.Handle;  
          if   MyLib>0   then  
          begin  
   
                    @G:=getprocaddress(mylib,GetString);             //调用入口  
                    if   @G<>nil   then  
                          begin  
                                    edit1.Text:=G();  
                          end  
                    else  
                          showmessage(没有找到函数的入口);  
   
                    @p:=GetProcAddress(mylib,messageshow);  
                    if   @p<>nil   then  
                          begin  
                                    p(UHandle,temp1);  
                          end  
                    else  
                          showmessage(没有找到函数的入口);  
   
                    edit1.Text:=;      
          end  
          else  
                    showmessage(函数加载失败!);  
  end;  
   
  procedure   TForm1.Button3Click(Sender:   TObject);  
  begin  
                messagebeep(0);  
                TIMER1.Enabled:=TRUE;  
  end;  
   
  procedure   TForm1.Timer1Timer(Sender:   TObject);   //加载动态资源,动态库在FORM   CREATE   中加载  
  var  
        IconHand:THandle;  
  begin  
              if   isiconic(application.Handle)   then  
                    begin  
                          if   i>9   then  
                                i:=1;  
   
                          iconhand:=loadicon(mylib,Pchar(ICON+INTTOSTR(I)));  
                          if   iconhand<>   0   then  
                                application.Icon.Handle:=iconhand  
                          else  
                                  showmessage(cant   find   icon!);  
                          inc(i);  
                    end;            
  end;  
   
  procedure   TForm1.FormCreate(Sender:   TObject);  
  begin  
                  MyLib:=LoadLibrary(D:\MyProject\DELPHI\动态库的调用\动态库文件\dllformp.dll);  
              if   mylib=0   then  
              begin  
                    showmessage(Cant   Load   The   Dll!);  
                    application.Terminate;  
              end;  
              i:=1;  
               
  end;  
   
  procedure   TForm1.FormClose(Sender:   TObject;   var   Action:   TCloseAction);  
  begin  
          freelibrary(mylib);  
  end;  
   
  end.  
   
   
 

NO.2   作者: l_xiaofeng

应该是这样:  
  function   WriteA(cardinfo:pointer):Integer;   stdcall;   external   a.dll;  
  function   WriteB(key:string):Integer;   stdcall;   external   a.dll;  
  function   OpenCom(com:Integer;baud:longint):Integer;   stdcall;   external   a.dll;  
  不一定对,试试看?

NO.3   作者: u2m

应该如下  
    type    
        Pcardinfo=^cardinfo;  
  function   WriteA(cardinfo:Pcardinfo):Integer;   stdcall;   external   a.dll;  
  function   WriteB(key:PChar):Integer;   stdcall;   external   a.dll;  
  function   OpenCom(com:Integer;baud:longint):Integer;   stdcall;   external   a.dll;  
 

NO.4   作者: flyinger1

呵呵!看:  
  http://expert.csdn.net/Expert/topic/1645/1645329.xml?temp=.5758631


    摘要: 谢谢大家。      牛牛 ......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE