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

 

    摘要: 在《visual c++ 技术内幕》的cexo6b中有一个微调按钮与编辑框的联合使用的代码, 但如果想要通过微调按钮来使得在编辑框中出现负小数(-3.6)。该如何实现?因为,滚动条的滚动位置是从零开始的,如果按照书上的代码,设置微调按钮的范围为(-5,5)时,不能实现预定的结果,该如何实现? ......
 ·毕业设计问题    »显示摘要«
    摘要: 我在答辩中可能会被问到char,varchar,varchar(2)的区别,请问大家我应该怎样回答 ......


如何使用文件的快捷方式(包括生成和读取它的真实路径)

如何使用文件的快捷方式(包括生成和读取它的真实路径)

NO.1   作者: webber84

创建快捷方式:  
  //   CreateLink   -   uses   the   shells   IShellLink   and   IPersistFile   interfaces    
  //       to   create   and   store   a   shortcut   to   the   specified   object.    
  //   Returns   the   result   of   calling   the   member   functions   of   the   interfaces.    
  //   lpszPathObj   -   address   of   a   buffer   containing   the   path   of   the   object.    
  //   lpszPathLink   -   address   of   a   buffer   containing   the   path   where   the    
  //       shell   link   is   to   be   stored.    
  //   lpszDesc   -   address   of   a   buffer   containing   the   description   of   the    
  //       shell   link.    
     
  HRESULT   CreateLink(LPCSTR   lpszPathObj,    
          LPSTR   lpszPathLink,   LPSTR   lpszDesc)    
  {    
          HRESULT   hres;    
          IShellLink*   psl;    
     
          //   Get   a   pointer   to   the   IShellLink   interface.    
          hres   =   CoCreateInstance(&CLSID_ShellLink,   NULL,    
                  CLSCTX_INPROC_SERVER,   &IID_IShellLink,   &psl);    
          if   (SUCCEEDED(hres))   {    
                  IPersistFile*   ppf;    
     
                  //   Set   the   path   to   the   shortcut   target   and   add   the    
                  //   description.    
                  psl->lpVtbl->SetPath(psl,   lpszPathObj);    
                  psl->lpVtbl->SetDescription(psl,   lpszDesc);    
     
                //   Query   IShellLink   for   the   IPersistFile   interface   for   saving   the    
                //   shortcut   in   persistent   storage.    
                  hres   =   psl->lpVtbl->QueryInterface(psl,   &IID_IPersistFile,    
                          &ppf);    
     
                  if   (SUCCEEDED(hres))   {    
                          WORD   wsz[MAX_PATH];    
     
                          //   Ensure   that   the   string   is   ANSI.    
                          MultiByteToWideChar(CP_ACP,   0,   lpszPathLink,   -1,    
                                  wsz,   MAX_PATH);    
     
                          //   Save   the   link   by   calling   IPersistFile::Save.    
                          hres   =   ppf->lpVtbl->Save(ppf,   wsz,   TRUE);    
                          ppf->lpVtbl->Release(ppf);    
                  }    
                  psl->lpVtbl->Release(psl);    
          }    
          return   hres;    
  }    
   
 


    摘要: 这是我的答辩可能会遇到的问题,我自己也分析了一些,怕不完善,请大家帮帮忙 ......
» 本期热门文章:

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