CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
山寨机中的战斗机! 程序优化工程师到底对IT界有没有贡献
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  C++ Builder >  Windows SDK/API

在BCB中怎样调用API函数?

楼主ylp92155(一只菜鸟)2002-11-15 08:28:30 在 C++ Builder / Windows SDK/API 提问

才学BCB,   有几个问题需要澄清  
  1、在BCB中怎样调用API   函数  
  2、API在VB中使用的名字参数等,适合BCB中一样吗,怎样将VB   的声明转成BCB声明  
  比如:  
  Declare   Function   AddPrintProcessor   Lib   "winspool.drv"   Alias   "AddPrintProcessorA"   (ByVal   pName   As   String,   ByVal   pEnvironment   As   String,   ByVal   pPathName   As   String,   ByVal   pPrintProcessorName   As   String)   As   Long  
   
  为指定的系统添加一个打印处理器  
  Long,非零表示成功,零表示失败。会设置GetLastError  
  pName   ----------     String,指定要在其中安装驱动程序的一台服务器的名字。对于本地系统,设为vbNullString  
  pEnvironment   ---     String,要在其中添加打印处理器的一个环境(如“Windows  
      NT   x86”)。对于当前(本地)系统环境,则设为vbNullString  
  pPathName   ------     String,包含了打印管理器的一个文件的名字。文件必须位于打印处理器目录中  
  pPrintProcessorName   -     String,打印处理器的名字  
   
  我下载到一个很全的API资料但是是for   vb的怎样改为   for   bcb  
  问题点数:20、回复次数:13Top

1 楼ylp92155(一只菜鸟)回复于 2002-11-15 08:32:49 得分 0

资料是有一部分是英文的,谁有兴趣将它译成中文,并配上bcb   例程?Top

2 楼yinglang(影狼)回复于 2002-11-15 08:32:51 得分 1

直接使用就可以了,不需要声明Top

3 楼ylp92155(一只菜鸟)回复于 2002-11-15 08:36:03 得分 0

参数弄不明白  
  新手,最好有例子,按葫芦画瓢才行Top

4 楼ylp92155(一只菜鸟)回复于 2002-11-15 08:37:25 得分 0

有能系统讲一下的吗?Top

5 楼fsstolw(fsstolw)回复于 2002-11-15 08:52:58 得分 1

推荐一本书吧一定对你有用:  
  C++Builder与Windows   API经典范例  
  因为是才买,所以也说不出什么名堂来,只好你自己找找这本书看咯。Top

6 楼sunnykong(空空)回复于 2002-11-15 11:36:00 得分 10

1.只要BCB自带的库中有你说的API函数的库声明,你就可以在程序里直接使用API函数,如果没有你就只好自己找一个了,当然你也可以直接使用相应的*.dll。  
  2.建议你遇到这种问题,查一下MSDN,以下是我查到的关于你那个API函数的说明:  
  AddPrintProcessor  
  The   AddPrintProcessor   function   installs   a   print   processor   on   the   specified   server   and   adds   the   print-processor   name   to   an   internal   list   of   supported   print   processors.    
   
  BOOL   AddPrintProcessor(  
      LPTSTR   pName,                                 //   pointer   to   server   name  
      LPTSTR   pEnvironment,                   //   pointer   to   environment   name  
      LPTSTR   pPathName,                         //   pointer   to   path  
      LPTSTR   pPrintProcessorName       //   pointer   to   print-processor   name  
  );  
     
  Parameters  
  pName    
  Pointer   to   a   null-terminated   string   that   specifies   the   name   of   the   server   on   which   the   print   processor   should   be   installed.   If   this   parameter   is   NULL,   the   print   processor   is   installed   locally.    
  pEnvironment    
  Pointer   to   a   null-terminated   string   that   specifies   the   environment   (for   example,   "Windows   NT   x86",   "Windows   NT   R4000",   "Windows   NT   Alpha_AXP",   or   "Windows   4.0").   If   this   parameter   is   NULL,   the   current   environment   of   the   caller/client   (not   of   the   destination/server)   is   used.    
  pPathName    
  Pointer   to   a   null-terminated   string   that   specifies   the   name   of   the   file   that   contains   the   print   processor.   This   file   must   be   in   the   system   print-processor   directory.    
  pPrintProcessorName    
  Pointer   to   a   null-terminated   string   that   specifies   the   name   of   the   print   processor.    
  Return   Values  
  If   the   function   succeeds,   the   return   value   is   nonzero.  
   
  If   the   function   fails,   the   return   value   is   zero.   To   get   extended   error   information,   callGetLastError.    
   
  Remarks  
  Before   calling   the   AddPrintProcessor   function,   an   application   should   verify   that   the   file   containing   the   print   processor   is   stored   in   the   system   print-processor   directory.   An   application   can   retrieve   the   name   of   the   system   print-processor   directory   by   calling   the   GetPrintProcessorDirectory   function.    
   
  An   application   can   determine   the   name   of   existing   print   processors   by   calling   the   EnumPrintProcessors   function.    
   
  QuickInfo  
      Windows   NT:   Requires   version   3.1   or   later.  
      Windows:   Requires   Windows   95   or   later.  
      Windows   CE:   Unsupported.  
      Header:   Declared   in   winspool.h.  
      Import   Library:   Use   winspool.lib.  
      Unicode:   Implemented   as   Unicode   and   ANSI   versions   on   Windows   NT.  
   
  Top

7 楼szbug(深圳虫)回复于 2002-11-15 11:54:54 得分 1

直接用就行了。。。。Top

8 楼tjzzx888(青草)回复于 2002-11-15 12:41:24 得分 1

直接用Top

9 楼ylp92155(一只菜鸟)回复于 2002-11-15 16:59:58 得分 0

sunnykong(空空)    
  API   函数在MSDN上全能查到,对吧?Top

10 楼shadowstar(CodeFast for Delphi & C++Builder)回复于 2002-11-17 15:07:06 得分 1

建议先看一下C/C++之类的书Top

11 楼cdws222(二当家)回复于 2002-11-17 15:36:56 得分 3

在BCB中用API不用声明.h文件里已经声明好了,例:MessageBox(Handle,"这是对话框","这是标题",MB_OK   |   MB_ICONERROR);这就是一个API,直接用就行了Top

12 楼xlRiver()回复于 2002-11-21 17:58:20 得分 1

对,直接使用,不有声明,方便啊!!!  
  Top

13 楼losthold(呵呵)回复于 2002-11-22 14:10:43 得分 1

在函数前加"::"就可以直接调用api函数了Top

相关问题

  • 调用api函数出错
  • api函数调用问题
  • 如何在bcb中调用win32 api函数?
  • 关于在调用API函数
  • 如何用PB调用API函数Getmodulefilename()?
  • API函数调用问题之一
  • c中能调用API函数吗?
  • API函数(DeleteFile)在vb调用
  • 调用API函数的问题
  • 关于调用API函数的问题!!!

关键词

  • 函数
  • bcb
  • 打印
  • api
  • 文件
  • 系统
  • nt
  • null
  • server
  • 调用

得分解答快速导航

  • 帖主:ylp92155
  • yinglang
  • fsstolw
  • sunnykong
  • szbug
  • tjzzx888
  • shadowstar
  • cdws222
  • xlRiver
  • losthold

相关链接

  • CSDN Blog
  • 技术文档
  • 代码下载
  • 第二书店
  • 读书频道

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo