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

 

    摘要: hi, 你好: 我想用 c 或 c++ 编一个数据加密与解蜜的程序,以学习网络安全方面的知识,但不知到那里能找到这方面的好书(最好带code的,较新的书)以及code。 谢谢!!! ......
 ·初学者要求各位帮忙    »显示摘要«
    摘要: 各位大哥: 小弟初学c语言2个星期,开始使得是tc2.0,朋友说用vc6.0写c程序很好,而且界面也好,我装上vc后却不知道怎么创建.c的源程序,所以只能用创建文件里的c++ source file来写c,不过到也能调试通过,不过保存的代码是.cpp格式的c++源码,请各位帮帮忙,小弟先谢了!! ......


:关于MicroSoft SDK API的问题,这段程序哪位牛人帮忙具体解说一下.谢谢.

这是一个返回文件夹路径的程序.因为实在看不懂程序到底是什么意思。  
  void   CXianlu::OnButton2()    
  {  
        //   TODO:   Add   your   control   notification   handler   code   here  
        char   direct[MAX_PATH];  
        LPMALLOC   pMalloc;  
        ~~~~~~~~~~~~~~~~~~?这句话什么意思?  
        char   pszBuffer[MAX_PATH];  
        //Gets   the   Shells   default   allocator  
        if   (::SHGetMalloc(&pMalloc)   ==   NOERROR)  
            ~~~~~~~~~~~~~~~这个是什么意思了?  
        {  
                BROWSEINFO   bi;  
                //   char   pszBuffer[MAX_PATH];  
                LPITEMIDLIST   pidl;  
                //Get   help   on   BROWSEINFO   struct   -   its   got   all    
                //the   bit   settings.  
                bi.hwndOwner   =   GetSafeHwnd();  
                bi.pidlRoot   =   NULL;  
                bi.pszDisplayName   =   pszBuffer;  
                strcpy(direct,"C:");  
                strcpy(direct,"\\");  
                strcpy(direct,"My   Documents");  
                bi.lpszTitle   =   _T(direct);//Select   a   Starting   Directory  
                bi.ulFlags   =   BIF_RETURNFSANCESTORS   |   BIF_RETURNONLYFSDIRS;  
                bi.lpfn   =   NULL;  
                bi.lParam   =   0;  
                //   This   next   call   issues   the   dialog   box.  
                if   ((pidl   =   ::SHBrowseForFolder(&bi))   !=   NULL)  
                {  
                    if   (::SHGetPathFromIDList(pidl,   pszBuffer))  
                    {  
            //   At   this   point   pszBuffer   contains   the   selected   path  
                              SetDlgItemText(IDC_EDIT4,pszBuffer);  
                    }  
                      //   Free   the   PIDL   allocated   by   SHBrowseForFolder.  
                      pMalloc->Free(pidl);  
              }  
              //   Release   the   shells   allocator.  
              pMalloc->Release();  
        }  
  }      
   
  越具体越好,如果觉得分数不够,还可以再给分.只是我的分数不多,才900分.  
  等待着大侠的回答.

NO.1   作者: liutang

好象是取得IMalloc接口的,但不知为什么他这里要搞这么复杂,你把其中有关pMalloc变量的语句注释掉应该可以正常运行。

NO.2   作者: onlynight

LPMALLOC   pMalloc;     pMalloc是一个指向IMalloc接口的指针,这个接口是用来分配或释放内存的(就是用来释放LPITEMIDLIST   pidl,如果注释的话,pidl的资源将留在内存中)  
   
  SHGetMalloc(&pMalloc)用来获取IMalloc接口,因为函数的参数是指针的指针,所以加上了“&”,函数如果成功就返回NOERROR  
   
   
 

NO.3   作者: onlynight

关于释放pidl的问题   可以开一个内存检测的工具看一下就可以发现了

NO.4   作者: dycdyc123

SDK   确实麻烦!  
   
   
  你从中学到了什么??  
   
 

NO.5   作者: onlynight

IMalloc接口在这里专门负责释放用来保存资源信息的内存块  
  pMalloc->Free(pidl);//释放保存的资源信息  
  pMalloc->Release();//释放自己,因为这个是接口指针,如果不清楚可以看一下COM方面的资料  
   
   
  其它的就在MSDN上有,给你贴一下吧  
   
  BROWSEINFO  
   
  typedef   struct   _browseinfo   {    
          HWND   hwndOwner;    
          LPCITEMIDLIST   pidlRoot;    
          LPSTR   pszDisplayName;    
          LPCSTR   lpszTitle;    
          UINT   ulFlags;    
          BFFCALLBACK   lpfn;    
          LPARAM   lParam;    
          int   iImage;    
  }   BROWSEINFO,   *PBROWSEINFO,   *LPBROWSEINFO;    
   
   
  Contains   parameters   for   the   SHBrowseForFolder   function   and   receives   information   about   the   folder   selected   by   the   user.    
   
  hwndOwner    
  Handle   to   the   owner   window   for   the   dialog   box.    
   
  pidlRoot    
  Address   of   an   ITEMIDLIST   structure   specifying   the   location   of   the   root   folder   from   which   to   browse.   Only   the   specified   folder   and   its   subfolders   appear   in   the   dialog   box.   This   member   can   be   NULL;   in   that   case,   the   namespace   root   (the   desktop   folder)   is   used.    
   
  pszDisplayName    
  Address   of   a   buffer   to   receive   the   display   name   of   the   folder   selected   by   the   user.   The   size   of   this   buffer   is   assumed   to   be   MAX_PATH   bytes.    
   
  lpszTitle    
  Address   of   a   null-terminated   string   that   is   displayed   above   the   tree   view   control   in   the   dialog   box.   This   string   can   be   used   to   specify   instructions   to   the   user.    
   
  ulFlags    
  Flags   specifying   the   options   for   the   dialog   box.   This   member   can   include   zero   or   a   combination   of   the   following   values:                             BIF_BROWSEFORCOMPUTER     Only   return   computers.   If   the   user   selects   anything   other   than   a   computer,   the   OK   button   is   grayed.      
  BIF_BROWSEFORPRINTER     Only   return   printers.   If   the   user   selects   anything   other   than   a   printer,   the   OK   button   is   grayed.      
  BIF_BROWSEINCLUDEFILES     The   browse   dialog   will   display   files   as   well   as   folders.      
  BIF_DONTGOBELOWDOMAIN     Do   not   include   network   folders   below   the   domain   level   in   the   tree   view   control.      
  BIF_EDITBOX     Version   4.71.   The   browse   dialog   includes   an   edit   control   in   which   the   user   can   type   the   name   of   an   item.      
  BIF_RETURNFSANCESTORS     Only   return   file   system   ancestors.   If   the   user   selects   anything   other   than   a   file   system   ancestor,   the   OK   button   is   grayed.      
  BIF_RETURNONLYFSDIRS     Only   return   file   system   directories.   If   the   user   selects   folders   that   are   not   part   of   the   file   system,   the   OK   button   is   grayed.      
  BIF_STATUSTEXT     Include   a   status   area   in   the   dialog   box.   The   callback   function   can   set   the   status   text   by   sending   messages   to   the   dialog   box.      
  BIF_VALIDATE     Version   4.71.   If   the   user   types   an   invalid   name   into   the   edit   box,   the   browse   dialog   will   call   the   applications   BrowseCallbackProc   with   the   BFFM_VALIDATEFAILED   message.   This   flag   is   ignored   if   BIF_EDITBOX   is   not   specified.      
   
  lpfn    
  Address   of   an   application-defined   function   that   the   dialog   box   calls   when   an   event   occurs.   For   more   information,   see   the   BrowseCallbackProc   function.   This   member   can   be   NULL.    
   
  lParam    
  Application-defined   value   that   the   dialog   box   passes   to   the   callback   function,   if   one   is   specified.    
   
  iImage    
  Variable   to   receive   the   image   associated   with   the   selected   folder.   The   image   is   specified   as   an   index   to   the   system   image   list.    
   
   
   
   
  ITEMIDLIST  
   
   
  typedef   struct   _ITEMIDLIST   {  
          SHITEMID   mkid;  
  }   ITEMIDLIST,   *   LPITEMIDLIST;    
  typedef   const   ITEMIDLIST   *   LPCITEMIDLIST;    
   
  Contains   a   list   of   item   identifiers.    
   
  mkid    
  List   of   item   identifiers.    
   
 


    摘要: 把adoquery放在hege页上 用了一个button1来根据radiobutton的选定来决定hege上的这个adoquery执行什么查询语句, 然后用了一个button2来创建预览report ======================================================================== 程序如下: unit hegebiaozhun......
» 本期热门文章:

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