WriteFile(), LPT, and spooler

I can open an LPT port with CreateFile() and then write data to that port
with WriteFile().  However, one of my test ports has a spooler attached to
it so sometimes when I write data to it the spooler holds the data and
doesn't squirt the data out of the port.  So this brings up 2 questions:

1)  When I open a parallel port with CreateFile() is there a reliable way to
determine if a spooler is attached to the LPT?  BTW, I tried using
"\\\\.\\NONSPOOLED_LPT1" as the port name and GetLastError() gave me an
error code 2 ("The system cannot find the file specified.").

2)  Is there any way to force the data in the spooler to be sent to the port
(i.e. flush the spooler)?

Thanks,
Mike



0
no (445)
12/28/2003 11:08:46 PM
vc.mfc 33608 articles. 0 followers. Follow

0 Replies
555 Views

Similar Articles

[PageSpeed] 4

Reply:

Similar Artilces:

MAPI spooler getting shut down for Outlook 2k
Hi, I am writing a MAPI transport provider that is working fine with Outlook XP. But when I tested the same with the Outlook 2K, when the transport provider is loaded, the spooler is getting shut down. Can anyone tell about the possible reasons which could cause the shut down of spooler? Also are there any differences in the Transport provider loading in Outlook 2K and Outlook XP as with Outlook XP i am running fine but getting the problem only with Outlook 2K? I understand the MAPI version of both should be different but my transport provider is very simple and does only basic things, so i t...

WriteFile
Hi , I am using WriteFile function for writting some data to harddisk. Is there any limit in size of data it can write. Basically this function is writting imcomplete data. I checked the contents of file. ( Writs encoded data to file then decode the data using Winzip ( MIME data ) no of Bytes are at boundries like : fff, 9fff, ffff ... Any idea why this is hapening ? I'm not sure if there is a limit, or how to find out. Are you checking the parameter that tells the number of bytes written to see if it equals the number of bytes to write? Perhaps you can just keep calling WriteFile...

Messaging Subsystem Spooler Error
I can't send or receive any messages. I keep getting a Messaging Subsystem Spooler Error message as soon as I open outlook that tells me an error has occurred and to try again later. The error signature app name is mapisp32.exe if that helps? Please let me know what to do if anyone knows!!! Thank you immensely in advance!!! Hello Peter, Have you tried recreating your Outlook profile? There could be a problem with the grouping of Outlook settings (profile) that you are currently using. Here are a couple of KBs on how to create a new profile... 195478 OL2000: (CW) User Pro...

MAPI Spooler #5
How do I delete a message from my Outlook Outbox that the 'MAPI Spooler' has begun transmitting? What version of Outlook? -- Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the (insert latest virus name here) virus, all mail sent to my personal account will be deleted without reading. After furious head-scratching, Kirk asked this group: | How do I delete a message from my Outlook Outbox that the 'MAPI | Spooler' has begun transmitting? I am using Outlook 2000 "Milly Staples [MVP - Outlook]" wrote: > ...

Print spooler problem
When attempting to print documents in Publisher, it will only print the first part of the page, then ejects the page, draws up another, prints part of the document, so on and so forth until the print job is done. At one point, I got an error message something about a spooler error. How do I fix this? Thanks. I usually get this problem when I have been doing too much (having opened too many programs at once, lots of photo's etc) and rebooting the computer will help. Also perhaps your printerdrivers might need to be updated. Op Wed, 3 Dec 2003 07:51:44 -0800schreef "Terry Ro...

WriteFile and ERROR_INSUFFICIENT_BUFFER
I'm using the WriteFileEx function to write a file asynchronously. However I sometimes get the error code ERROR_INSUFFICIENT_BUFFER (with GetLastError), although the function still returns a success and the data gets written ok. However I don't think it is actually doing an asynchronous write. I open the file with a call to CreateFile, with the flags: FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED | FILE_FLAG_NO_BUFFERING To satisfy the No buffering, I use VirtualAlloc and make sure source/dest and size values are all aligned to sector sizes. That bit seems fine. Also, if I try...

Outlook 2000 Mapi Spooler
My messages don't always leave my outbox very quickly. In some cases, the message sits there until I send another and then it sends the new message and an older one but it will only send two at a time. I have recently updated to SR-1 and can't seem to figure it out. Any suggestions? Scott ...

MAPI Spooler error
I am in need of help. Evertime I open a particular users OL97 and check for new mail the programs hangs and I have to end it. After closing the program I then try and go back in and get the MAPI Spooler has shutdown unexpectedly error. I have installed both the Outlook 97 Service pack 1 and 2 patches and still no luck. ...

WriteFile need help,
Can some one explaint to me why is my output file print out garbage string, event I print BOM at the begining of the file? Did I miss something? output.txt ⁥Tue Feb 07 15:22:02 2006⁢ Testing log file 1. ///////////MY CODE//////////////////// WORD BOM=0xfeff; DWORD cBytes; hFile = CreateFile(szDirectory, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); if (NULL != hFile && INVALID_HANDLE_VALUE != hFile) { SetFilePointer(hFile, 0, NULL, FILE_BEGIN); WriteFile(hFile, &BOM, sizeof(BOM), &cBytes, NULL); } void WriteToFile(wchar_t* p_...

Is there a solution for writefile fails in vista
I was trying to write from starting sector of the harddisk through writefile function, In vista WriteFile() function fails(Access denied) due to security methods in vista and server 2008. Is there a solution for this ??? There are better Vista programmers here than me, but I think you either need to: Elevate your program to a status that allows this function Have your user run as an administrator account to do this kind of advanced functionality Disable UAC Some things to try anyway. Tom "StudioX" <StudioX@discussions.microsoft.com> wrote in message news:3837A5AB-2FF...

ReadFile & WriteFile Problem?
I need to read/write on raw disk drive and it works. After many trials, I found a little bit strange thing. The API ReadFile and WriteFlle read/write datas only from sector size boundaries. I don't know why it should do like that. Following is my code. void readBytes ( void *readBuf, long bytesToMove, long bytesToRead) { int ret = SetFilePointer (diskHandle, bytesToMove, NULL, FILE_BEGIN); unsigned long bytesRead; BOOL result = ReadFile ( diskHandle, readBuf, bytesToRead, &bytesRead , NULL); printf("read %d bytes!!\n", bytesRead); } When char readBuf[512]; long by...

mapi spooler error #3
I right click on a picture (in my file folder), click "send to" then "mail recipient". I click "make all pictures smaller", then "ok" (when it asks me if the I want to use "Microsoft Outlook" for a profile name. Then I get an error..."The MAPI Spooler could not be started. Close and then restart all mail-enabled applications. MAPI 1.0 [000004C7]" Can anyone help me? I'm using Windoes XP Pro, I've checked for updates, re-installed internet explorer...and still the same problem. Thanks Is Outlook your default mai...

WriteFile(), LPT, and spooler
I can open an LPT port with CreateFile() and then write data to that port with WriteFile(). However, one of my test ports has a spooler attached to it so sometimes when I write data to it the spooler holds the data and doesn't squirt the data out of the port. So this brings up 2 questions: 1) When I open a parallel port with CreateFile() is there a reliable way to determine if a spooler is attached to the LPT? BTW, I tried using "\\\\.\\NONSPOOLED_LPT1" as the port name and GetLastError() gave me an error code 2 ("The system cannot find the file specified."). 2) ...

Caching for Vista Client-Side Print Spooler
During development of a printer driver what appears to be a bug with Vista spooler (client-side) caching of printer Bidirectional data was discovered. I have a sample application which demonstrates the problem. Sharing a printer from Vista to XP works fine, but sharing a printer from XP to Vista experiences the problem. The problem is that calling DeletePrinterData then GetPrinterData on the client side results in a error code 2 (file not found). What should occur however is that the client side spooler should RpcGetPrinterData to the server side spooler and the server side...

MAPI spooler Stuck, PLEAS HELP
How can I empty the MAPI spooler in Outlook 2000? I have one message that seems to be stuck in my out box. It has been sitting there for about 10 hours. As a result I cannot send or receive any mail. I tried to move it to another folder but I get the message "Can not be moved. MAPI spooler has already started sending this message." Can you tell me what I can do short of uninstalling office. Thanks. Give this a shot: http://support.microsoft.com/default.aspx?scid=kb;en-us;162343 Ken "Baha" <anonymous@discussions.microsoft.com> wrote in message news:078...

serial WriteFile hangs
I need to get an old Win98 program running on WinXP. The program works on Win98, but hangs in WriteFile to COM port on Windows-XP. The Visual-C++ program remote controls an embedded board through serial port. Any ideas? _Doug wrote: > I need to get an old Win98 program running on WinXP. > > The program works on Win98, but hangs in WriteFile to COM port on Windows-XP. > > The Visual-C++ program remote controls an embedded board through serial port. > > Any ideas? There is something wrong with the program. Done properly, the same code should work on Win98 and XP. ...

MAPI Spooler Could Not be started.
I've been using Outlook for a few years now and recently when I opened my Outlook, I got a blank screen and a window popped up stating "The MAPI spooler could not be started. Close and then restart all mail-enabled applications." MAPI 1.0 [000004C7] Do you know what the problem may be? I've restarted my computer and other applications, but that hasn't worked. Thanks. PD ...

WriteFile function hangs!
Hi, I am printing something through the LPT using the API WriteFile. This is working fine when the printer is connected to the system.But if the printer is not connected then it hangs!! When debugged it found that the program hangs in WriteFile function. Its not coming out from that function!! How to solve it? Pls help... rgds, RENAK. It may just be trying to write all of the characters and waiting for each to time out since the printer is not there. You may want to check for access to the printer perhaps by trying to write a single innocuous control character to the printer first (ba...

printing to parallel port with writefile
I was wondering if someone might be able to tell me how to use writefile to send a string of text to a parallel printer. The text is special IPL printer codes for a barcode printer so it has to be sent directly to a printer. I have used the system command() though with mixed results in Visual C++ and windows. I am used to programming in DOS where all I had to do was send a file to a printer using the copy command like: "copy 227-029.fmt lpt1" or "copy 227-029.fmt com1" (after setting up the com port with another system command. Even so I would like to know how to...

MAPI Spooler
I have an email stuck in the Outbox that can't be deleted. Every time I send mail I get an error message about the one email that couldn't be sent because the MAPI Spooler is processing it. How do I get it out of there? >-----Original Message----- >I have an email stuck in the Outbox that can't be >deleted. Every time I send mail I get an error message >about the one email that couldn't be sent because the MAPI >Spooler is processing it. How do I get it out of there? >. >i have exactly the same problem if yu find a solution please let me ...

CString UNICODE WriteFile problem...
Hi all, I am trying to send command to a manchine via serial port. I have created a serial port class called as CSerPort,and it has a function SendString() as below. My problem is here that when i try to send a string ,such as "AT+X", via this function,the machine does not respond. If i write the command directly to the WriteFile function as a parameter; .... .. if( (WriteFile(hCOMx,"AT+X",sCommand.GetLength(),&wWrittenBytes, NULL)) == NULL) ... ... then it responds properly. I have an ASCII version of this class and it works very well. I tried to assign the sComma...

MAPI Spooler error #2
hello: i am having a problem with sending e-mails with my outlook 2000. for some reason the outbox does not seem to send a few e-mails since yesterday. when i click on the selected e-mail it says "can't open this item. the mapi spooler has already begun transmitting this message" all my email settings and internet connection are fine. i also tried to repair the office using the installation cd, but the problem did not go away. the e-mails are being received by people, but the they still appear in my outbox as never being sent? it looks like the spooler grabed the...

WriteFile, insert data in the middle of the file.
Hello, What I want to do is to insert data (not overwrite existing data) in the middle of a big file. Does WriteFile( ) have this option? If there's no way to insert data in the middle, I guess I have to read out all the data from the insertion point, and append my new data, and write them back to the file? Isn't this too inefficient? Anybody knows how OS handles this kind of "insert in the middle" scenario? Thank you, I appreciate your opinion. wk Well you answered your own question. There is no way to write to the middle of the file without overwriting what's ...

Question on how to monitor spool status with WriteFile
I'm sending a file to the parallel port using CreateFile() and WriteFile(). The whole file is immediately being sent to the spooler however it takes some time for the data to be completely sent to the printer. Is there a way to monitor the status on this spool job from my program so that I can take some action when the job is complete? Thanks Take a look at EnumJobs and GetJob function. Using these two functions you can get the status of the print jobs for a particular printer. AliR. "mao" <NoSpam> wrote in message news:%23s8miKqxEHA.4040@TK2MSFTNGP11.phx.gbl... > ...

how to work writefile function with Microsoft Word
Hi, If we write any DOC file using MS Word i think we need ReadFile CreateFile WriteFile FlushFileBuffers CloseFile above functions.... Can anyone tell me what happned between WriteFile & closefile functions. if i hook WriteFile function & im using it like:::: BOOL WINAPI _WriteFile( HANDLE hFile, // handle to file to write to LPCVOID lpBuffer, // pointer to data to write to file DWORD nNumberOfBytesToWrite, // number of bytes to write LPDWORD lpNumberOfBytesWritten, // pointer to number of bytes...