打印机调用哪几个api函数来打印数据

一、打印机调用哪几个api函数来打印数据

在MSDN库中去找。取一个函数名拷贝到MSDN的关键字栏里搜索就出来了,而且有详细的参数解释及用法。如:EndPagePrinterBOOL EndPagePrinter( HANDLE hPrinter // handle );ParametershPrinter[in] Handle to the prie page will be concluded. Use the OpenPrinter or Ar function to retrieve a printer handle.Return ValuesIf the function succeeturn value alue.If the function fails, the return value is zero. To get extended error information, call GetLastError.RemarksEac print job begins with a StartPagePrinter function call and ends with an EndPagePrinter function call. page is written to the print file by using tfunction.Requirements Windows NT/2000: Requires Windows NT 3.1 or later. Windows 9598: Requires Windows 95 or later. Header: Declared in Winspool.h; include Windows.h. Library: Use Winspool.lib.See AlsoPrinting and Print Spooler Overview, Printing and Print Spooler Functions, OpenPrinter, StartPagePrinter, WritePrinter

打印机调用哪几个api函数来打印数据

二、打印机调用哪几个api函数来打印数据

在MSDN库中去找。取一个函数名拷贝到MSDN的关键字栏里搜索就出来了,而且有详细的参数解释及用法。如:EndPagePrinter

BOOL EndPagePrinter(

HANDLE hPrinter // handle to printer object

);

Parameters

hPrinter

[in] Handle to the printer for which the page will be concluded. Use the OpenPrinter or AddPrinter function to retrieve a printer

handle.

Return Values

If the function succeeds, the return value is a nonzero value.

If the function fails, the return value is zero. To get extended error

information, call GetLastError.

Remarks

Each page in a print job begins with a StartPagePrinter function call and ends with

an EndPagePrinter function call. The data for each page is written to the

print file by using the WritePrinter

function.

Requirements

Windows NT/2000: Requires Windows NT 3.1 or later.

Windows

9598: Requires Windows 95 or later.

Header: Declared in

Winspool.h; include Windows.h.

Library: Use Winspool.lib.

See Also

Printing and Print Spooler Overview, Printing and Print Spooler Functions, OpenPrinter, StartPagePrinter, WritePrinter

三、如何在.Net中利用windowsapi函数打印一个文档

先新建一个win32 application工程。。

然后在工程中添加源文件。。

然后就可以写代码了。。

记得#include

下面送上一个hello windows。。

#include

lresult callback wndproc (hwnd hwnd, uint message,wparam wparam, lparam lparam);

int winapi winmain (hinstance hinstance, hinstance hprevinstance, lpstr lpcmdline, int icmdshow){ wndclass wc; hwnd hwnd; msg msg; bool bquit = false;

/* register window class / wc.style = cs_owndc; wc.lpfnwndproc = wndproc; wc.cbclsextra = 0; wc.cbwndextra = 0; wc.hinstance = hinstance; wc.hicon = loadicon (null, idi_application); wc.hcursor = loadcursor (null, idc_arrow); wc.hbrbackground = (hbrush) getstockobject (white_brush); wc.lpszmenuname = null; wc.lpszclassname = “hellowindows”; registerclass (&wc);

/ create main window / hwnd = createwindow ( “hellowindows”, “hello windows”, ws_caption | ws_popupwindow | ws_visible, 0, 0, 256, 256, null, null, hinstance, null);

/ program main loop / while (!bquit) { / check for messages / if (peekmessage (&msg, null, 0, 0, pm_remove)) { / handle or dispatch messages / if (msg.message == wm_quit) { bquit = true; } else { translatemessage (&msg); dispatchmessage (&msg); } } else { sleep (1); } }

/ destroy the window explicitly */ destroywindow (hwnd);

return msg.wparam;}

lresult callback wndproc (hwnd hwnd, uint message, wparam wparam, lparam lparam){

switch (message) { case wm_create: return 0; case wm_close: postquitmessage (0); return 0;

case wm_destroy: return 0;

case wm_keydown: switch (wparam) { case vk_escape: postquitmessage(0); return 0; } return 0;

default: return defwindowproc (hwnd, message, wparam, lparam); }}

本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。