<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Win32 StartDoc() question in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-StartDoc-question/m-p/766491#M20384</link>
    <description>&lt;P&gt;I did do a call CopyMemory(loc(iStatus), pPI2+72, 4) and iStatus, as expected, was0. &lt;/P&gt;
&lt;P&gt;Thanks for the Q160129 article. I will take a close look at that. Also, thanks for the additional Google info on StartDoc() hangs. I will have to start particpating in the Google groups!&lt;/P&gt;
&lt;P&gt;When StartDoc() hangs in Win2K it creates an exception (watching with the VSnet debugger)in a header ctl for a List View window. If the printer is attached and is on this does not occur. Possibly, the printer driver or someother code is trying to access memory used by the header ctl.The same code, however, works fine on an XP machine, and if the printer is not on simply spools the print job. &lt;/P&gt;
&lt;P&gt;I will try an HP2P printer that is attached to both machines to see what happens when it is not on or disconnected.&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Thu, 23 Feb 2006 21:43:40 GMT</pubDate>
    <dc:creator>ahasan</dc:creator>
    <dc:date>2006-02-23T21:43:40Z</dc:date>
    <item>
      <title>Win32 StartDoc() question</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-StartDoc-question/m-p/766481#M20374</link>
      <description>&lt;DIV&gt;If the printer is turned off by accident in a Windows 2000 program the win32 function StartDoc(hDc, di) does not return and locks up the program.Is there a way to see if a printer is connected before calling StartDoc()?In XP StartDoc() returns 3 when the printer is turned off or is not on line and does not hinder the program.&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;Thanks for any information.&lt;/DIV&gt;</description>
      <pubDate>Wed, 22 Feb 2006 00:53:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-StartDoc-question/m-p/766481#M20374</guid>
      <dc:creator>ahasan</dc:creator>
      <dc:date>2006-02-22T00:53:10Z</dc:date>
    </item>
    <item>
      <title>Re: Win32 StartDoc() question</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-StartDoc-question/m-p/766482#M20375</link>
      <description>I Googled a bit, it seems that you can use OpenPrinter/GetPrinter with PRINTER_INFO_2 structure to query printer status. See &lt;A href="http://groups.google.com/group/microsoft.public.access.formscoding/browse_thread/thread/a04054c6ffbbabf7/aef54e33b8acda5e?lnk=st&amp;amp;q=PRINTER_STATUS_OFFLINE&amp;amp;rnum=12&amp;amp;hl=en#aef54e33b8acda5e" target="_blank"&gt;here&lt;/A&gt; (I'm not positive it would work though – the entire "is printer online" stuff looks tricky).</description>
      <pubDate>Wed, 22 Feb 2006 17:07:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-StartDoc-question/m-p/766482#M20375</guid>
      <dc:creator>Jugoslav_Dujic</dc:creator>
      <dc:date>2006-02-22T17:07:51Z</dc:date>
    </item>
    <item>
      <title>Re: Win32 StartDoc() question</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-StartDoc-question/m-p/766483#M20376</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;
&lt;P&gt;Thanks for the information. I will give it a try. Also structure DevNames contains an offset to the name of the printer device:&lt;/P&gt;&lt;B&gt;wDeviceOffset -&lt;/B&gt;Offset, in characters, from the beginning of this structure to the null-terminated string that contains the name of the device.
&lt;P&gt;DevNames is filled inafter the OpenDlg box is closed, but not sure how to retieve the device name. Is it something like this:&lt;/P&gt;
&lt;P&gt;character(50) szBuffer&lt;BR /&gt;type (T_DEVNAMES) dnstruc&lt;BR /&gt;pointer(p_dnstruc, dnstruc)&lt;BR /&gt;szBuffer = p_dnstruc+wDeviceOffset&lt;/P&gt;
&lt;P&gt;Thanks again.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 22 Feb 2006 20:19:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-StartDoc-question/m-p/766483#M20376</guid>
      <dc:creator>ahasan</dc:creator>
      <dc:date>2006-02-22T20:19:25Z</dc:date>
    </item>
    <item>
      <title>Re: Win32 StartDoc() question</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-StartDoc-question/m-p/766484#M20377</link>
      <description>&lt;PRE&gt;&lt;BR /&gt;character(50) szBuffer; &lt;B&gt;pointer(pszBuffer, szBuffer)&lt;/B&gt;&lt;BR /&gt;type (T_DEVNAMES) dnstruc&lt;BR /&gt;pointer(p_dnstruc, dnstruc)&lt;BR /&gt;&lt;B&gt;p&lt;/B&gt;szBuffer = p_dnstruc+wDeviceOffset&lt;/PRE&gt;Offhand, I don't see the context, but are you sure you need it? If I recall correctly, the DEVMODE contains the same information. I've never had to use DEVNAMES... but then, this printing stuff is so complicated that I can't tell for sure.</description>
      <pubDate>Wed, 22 Feb 2006 20:29:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-StartDoc-question/m-p/766484#M20377</guid>
      <dc:creator>Jugoslav_Dujic</dc:creator>
      <dc:date>2006-02-22T20:29:30Z</dc:date>
    </item>
    <item>
      <title>Re: Win32 StartDoc() question</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-StartDoc-question/m-p/766485#M20378</link>
      <description>&lt;P&gt;Have not worked with pointers very much so your example code helps quite a bit. Kind of in the dark about win32 printing and avoiding errors that cannot be recovered from. So, at this point I am not sure what is needed, but I have enough info now to try some code and see what happens.&lt;/P&gt;
&lt;P&gt;Than you, JugoslavDujic.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2006 21:09:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-StartDoc-question/m-p/766485#M20378</guid>
      <dc:creator>ahasan</dc:creator>
      <dc:date>2006-02-22T21:09:10Z</dc:date>
    </item>
    <item>
      <title>Re: Win32 StartDoc() question</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-StartDoc-question/m-p/766486#M20379</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT color="#008000"&gt;
&lt;P&gt;Tried the following code after calling PrintDlg() so code could check on any printer that was selectable in the Printer Dlg box.&lt;/P&gt;
&lt;P&gt;GetPrinter() below returns 0 [failure], and GetLastError returns 1780, which is 'a null reference pointer was passed to the stub'Not sure what that means?&lt;BR /&gt;pPI2 appears to be a valid positive integer, and not Null before GetPrinter() is called..&lt;BR /&gt;&lt;BR /&gt;Everything seems OK until I get to GetPrinter(), hPrinter appears valid and no other indication of problems.&lt;/P&gt;
&lt;P&gt;Not sure if this approach is correct, so any comments would be appreciated.&lt;BR /&gt;&lt;BR /&gt;integer*4 hPrinter&lt;BR /&gt;integer*4 iSizePI2&lt;BR /&gt;integer*4 iSizeNeeded&lt;BR /&gt;Character(Max_Path) szPrinterName ; pointer(pszPrinterName, szPrinterName)type(T_DEVNAMES) DN ; pointer(pDN, DN)&lt;BR /&gt;type(T_PRINTER_INFO_2) PI2 ; pointer(pPI2, PI2)&lt;BR /&gt;type(T_PRINTDLG) PD&lt;/P&gt;
&lt;P&gt;! display print dlg box&lt;BR /&gt;Last_Error = PrintDlg(PD)&lt;BR /&gt;.....&lt;BR /&gt;pDN = GlobalLock(PD%hDevNames)&lt;BR /&gt;pszPrinterName = pDN + DN%wDeviceOffset&lt;BR /&gt;iret = GlobalUnlock(PD%hDevNames)&lt;BR /&gt;iret = OpenPrinter(szPrinterName, hPrinter, Null)&lt;BR /&gt;iSizePI2 = &lt;FONT color="#0000ff"&gt;SIZEOF&lt;/FONT&gt;(PI2)&lt;BR /&gt;iSizeNeeded = 0&lt;BR /&gt;iret = GetPrinter(hPrinter, int4(2), pPI2, iSizePI2, loc(iSizeNeeded))&lt;BR /&gt;&lt;B&gt;&lt;FONT color="#0000ff"&gt;if&lt;/FONT&gt;&lt;/B&gt;(iret == 0) iret = GetLastError()&lt;BR /&gt;&lt;FONT color="#008000"&gt;! PRINTER_STATUS_OFFLINE = 128&lt;BR /&gt;&lt;/FONT&gt;&lt;B&gt;&lt;FONT color="#0000ff"&gt;if&lt;/FONT&gt;&lt;/B&gt;(PI2%Status == PRINTER_STATUS_OFFLINE) &lt;B&gt;&lt;FONT color="#0000ff"&gt;then&lt;BR /&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;FONT color="#008000"&gt;! printer off line&lt;BR /&gt;&lt;/FONT&gt;&lt;B&gt;&lt;FONT color="#0000ff"&gt;goto&lt;/FONT&gt;&lt;/B&gt; 99&lt;BR /&gt;&lt;B&gt;&lt;FONT color="#0000ff"&gt;end if&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#0000ff"&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#0000ff"&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#008000"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;P&gt;Message Edited by halcyong@fcc.net on &lt;SPAN class="date_text"&gt;02-22-2006&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;09:16 AM&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Message Edited by halcyong@fcc.net on &lt;SPAN class="date_text"&gt;02-22-2006&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;01:37 PM&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Feb 2006 01:14:03 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-StartDoc-question/m-p/766486#M20379</guid>
      <dc:creator>ahasan</dc:creator>
      <dc:date>2006-02-23T01:14:03Z</dc:date>
    </item>
    <item>
      <title>Re: Win32 StartDoc() question</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-StartDoc-question/m-p/766487#M20380</link>
      <description>Hmmm. Where is allocated memory for PI2? It looks like an uninitialized value rather than a "valid positive integer"&lt;BR /&gt;&lt;BR /&gt;The general approach with printer-related structures (which are of "variable size") is "query size first, allocate buffer, then requery" (untested):&lt;BR /&gt;&lt;PRE&gt;integer(1), allocatable:: iPI2buf(:)&lt;BR /&gt;...&lt;BR /&gt;ret = GetPrinter(hPrinter, 2, &lt;B&gt;NULL&lt;/B&gt;, 0, LOC(iSize))&lt;BR /&gt;ALLOCATE(iPI2buf(iSize))&lt;BR /&gt;pPI2 = LOC(iPI2buf)&lt;BR /&gt;ret = GetPrinter(hPrinter, 2, pPI2, iSize, LOC(iSize))&lt;/PRE&gt;Similar code is required wherever you have a "pcbNeeded" argument (EnumPrinters, GetPrinterData etc.)</description>
      <pubDate>Thu, 23 Feb 2006 15:43:02 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-StartDoc-question/m-p/766487#M20380</guid>
      <dc:creator>Jugoslav_Dujic</dc:creator>
      <dc:date>2006-02-23T15:43:02Z</dc:date>
    </item>
    <item>
      <title>Re: Win32 StartDoc() question</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-StartDoc-question/m-p/766488#M20381</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;DIV&gt;
&lt;P&gt;Thanks. After I posted the last message, I reviewed the Google code again and realized that GetPrinter() needed more than sizeof(PI2) bytes. I was trying to allocate memory with pPI2 = MALLOC(iBytesNeeded)andran into exceptions in the debugger, not sure why. But, your code/method works great.&lt;/P&gt;
&lt;P&gt;With the following code the PRINT_INFO_2 stucture (PI2) appears to be filled in correctly, except for the last 4 elements which includes PI2%Status. If the printer isON orOFF line the last 4 elements of the structure are always 0. I noticed in the Google code thattheoutput buffer from GetPrinter() is copied explicitly to the local PI2 structure with the following: Call CopyMemory(pi2, Buffer(0), Len(pi2)) and then laterin the code the PI2%Status element is explicitly copied to StatusCode: Call CopyMemory(StatusCode, Buffer(72), 4). Is it necessary to do something like this in IVF to get the PI2%Status element? I tried Call CopyMemory(pPI2, pBuffer, sizeof(PI2)) but ran into memory access errors. pBuffer was the output buffer for GetPrinter() and was allocated as pBuffer = MALLOC(1600). The actual bytes need by GetPrinter() are 1596.&lt;/P&gt;
&lt;P&gt;pDN = GlobalLock(PD%hDevNames)&lt;BR /&gt;pszPrinterName = pDN + DN%wDeviceOffset&lt;BR /&gt;iret = GlobalUnlock(PD%hDevNames)&lt;BR /&gt;iret = OpenPrinter(szPrinterName, hPrinter, Null)&lt;BR /&gt;iBytesNeeded = 0&lt;BR /&gt;iret = GetPrinter(hPrinter, &lt;FONT color="#0000ff"&gt;int4&lt;/FONT&gt;(2), Null, 0, &lt;FONT color="#0000ff"&gt;loc&lt;/FONT&gt;(iBytesNeeded))&lt;BR /&gt;&lt;B&gt;&lt;FONT color="#0000ff"&gt;ALLOCATE&lt;/FONT&gt;&lt;/B&gt;(iPI2buf(iBytesNeeded))&lt;BR /&gt;pPI2 = &lt;FONT color="#0000ff"&gt;LOC&lt;/FONT&gt;(iPI2buf)&lt;BR /&gt;iret = GetPrinter(hPrinter, &lt;FONT color="#0000ff"&gt;int4&lt;/FONT&gt;(2), pPI2, iBytesNeeded, &lt;FONT color="#0000ff"&gt;loc&lt;/FONT&gt;(iBytesNeeded))&lt;BR /&gt;&lt;FONT color="#008000"&gt;! PRINTER_STATUS_OFFLINE = 80&lt;BR /&gt;&lt;/FONT&gt;&lt;B&gt;&lt;FONT color="#0000ff"&gt;if&lt;/FONT&gt;&lt;/B&gt;(PI2%Status == PRINTER_STATUS_OFFLINE) &lt;B&gt;&lt;FONT color="#0000ff"&gt;then&lt;BR /&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;FONT color="#008000"&gt;! printer off line&lt;BR /&gt;&lt;/FONT&gt;&lt;B&gt;&lt;FONT color="#0000ff"&gt;goto&lt;/FONT&gt;&lt;/B&gt; 99&lt;BR /&gt;&lt;B&gt;&lt;FONT color="#0000ff"&gt;end if&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 23 Feb 2006 18:44:48 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-StartDoc-question/m-p/766488#M20381</guid>
      <dc:creator>ahasan</dc:creator>
      <dc:date>2006-02-23T18:44:48Z</dc:date>
    </item>
    <item>
      <title>Re: Win32 StartDoc() question</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-StartDoc-question/m-p/766489#M20382</link>
      <description>No, you don't need to CopyMemory in VF. I suppose that it was done to overcome some VB limit  probably, VB cannot "equivalence" a structure and byte array.&lt;BR /&gt;&lt;BR /&gt;However, I'm worried about those zeros. I &lt;A href="http://groups.google.com/groups?hl=en&amp;amp;q=Is+printer+online&amp;amp;qt_s=Search" target="_blank"&gt;Googled a little&lt;/A&gt; and found that the most replies to the question are silence. I've just found &lt;A href="http://support.microsoft.com/default.aspx?scid=kb;EN-US;160129" target="_blank"&gt;Q160129&lt;/A&gt; which says:&lt;BR /&gt;&lt;BR /&gt;&lt;I&gt;Note, however, that the default port monitor for Windows does not usually set more than the PRINTER_STATUS_ERROR bit of a Printer's Status member. &lt;/I&gt;&lt;BR /&gt;&lt;BR /&gt;D'oh. You might try with some of those GetJob functions and family, but... it might just be impossible. I'm curious, though, as to why StartDoc stalls  I don't recall it has ever happened to me.</description>
      <pubDate>Thu, 23 Feb 2006 20:52:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-StartDoc-question/m-p/766489#M20382</guid>
      <dc:creator>Jugoslav_Dujic</dc:creator>
      <dc:date>2006-02-23T20:52:33Z</dc:date>
    </item>
    <item>
      <title>Re: Win32 StartDoc() question</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-StartDoc-question/m-p/766490#M20383</link>
      <description>No luck &lt;A href="http://groups.google.com/groups?hl=en&amp;amp;q=StartDoc+hangs&amp;amp;qt_s=Search" target="_blank"&gt;here&lt;/A&gt; as well. The hanging problem, however, doesn't seem to be common. The rare repliers suggest that it might be the fault of printer driver, and that you try with another driver of a non-existing printer to check it.</description>
      <pubDate>Thu, 23 Feb 2006 20:59:26 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-StartDoc-question/m-p/766490#M20383</guid>
      <dc:creator>Jugoslav_Dujic</dc:creator>
      <dc:date>2006-02-23T20:59:26Z</dc:date>
    </item>
    <item>
      <title>Re: Win32 StartDoc() question</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-StartDoc-question/m-p/766491#M20384</link>
      <description>&lt;P&gt;I did do a call CopyMemory(loc(iStatus), pPI2+72, 4) and iStatus, as expected, was0. &lt;/P&gt;
&lt;P&gt;Thanks for the Q160129 article. I will take a close look at that. Also, thanks for the additional Google info on StartDoc() hangs. I will have to start particpating in the Google groups!&lt;/P&gt;
&lt;P&gt;When StartDoc() hangs in Win2K it creates an exception (watching with the VSnet debugger)in a header ctl for a List View window. If the printer is attached and is on this does not occur. Possibly, the printer driver or someother code is trying to access memory used by the header ctl.The same code, however, works fine on an XP machine, and if the printer is not on simply spools the print job. &lt;/P&gt;
&lt;P&gt;I will try an HP2P printer that is attached to both machines to see what happens when it is not on or disconnected.&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 23 Feb 2006 21:43:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-StartDoc-question/m-p/766491#M20384</guid>
      <dc:creator>ahasan</dc:creator>
      <dc:date>2006-02-23T21:43:40Z</dc:date>
    </item>
    <item>
      <title>Re: Win32 StartDoc() question</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-StartDoc-question/m-p/766492#M20385</link>
      <description>Um, in &lt;I&gt;header ctl for ListView window&lt;/I&gt;???&lt;BR /&gt;&lt;BR /&gt;Are you sure you don't have a silent memory overwrite somewhere? DEVMODE, if you manipulate it directly (as opposed to PrintDlg) has the same properties as DEVNAMES or PRINTER_INFO_2  it takes far more memory than sizeof(T_DEVMODE), so the same query-allocate-requery mechanism is needed if you do e.g. DocumentProperties or CreateDC yourself. &lt;BR /&gt;&lt;BR /&gt;If the printer is off and the printer driver is faulty, then the same hanging should happen in other applications -- does it? If not, you might have some bug hanging around.</description>
      <pubDate>Thu, 23 Feb 2006 21:59:39 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-StartDoc-question/m-p/766492#M20385</guid>
      <dc:creator>Jugoslav_Dujic</dc:creator>
      <dc:date>2006-02-23T21:59:39Z</dc:date>
    </item>
    <item>
      <title>Re: Win32 StartDoc() question</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-StartDoc-question/m-p/766493#M20386</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;P&gt;I do manipulate the DEVMODE structure, so I will check that out.Thanks.&lt;/P&gt;
&lt;P&gt;Also, foundthat Print Direct To The Printer was checked in the properties dlg. box (Advancedsettings tab)for the printer on the Win2k machine. Once the 'Spool Print Document' was checked in the dlg box the Win2k machine did not hang. If the printer was off-line,the print job was simply spooled.&lt;/P&gt;
&lt;P&gt;However,thePRINTER_INFO_2 structure (PI2) can be used to check on the PRINT_ATTRIBUTE_DIRECT flag, and if it is set abort the print job as shown below.I tried this and it appears to work. Should be a work around if I can't identify any othertcauses forStartDoc() to hang.&lt;/P&gt;
&lt;P&gt;pDN = GlobalLock(PD%hDevNames)&lt;BR /&gt;pszPrinterName = pDN + DN%wDeviceOffset&lt;BR /&gt;iret = GlobalUnlock(PD%hDevNames)&lt;BR /&gt;iret = OpenPrinter(szPrinterName, hPrinter, Null)&lt;BR /&gt;iBytesNeeded = 0&lt;BR /&gt;iret = GetPrinter(hPrinter, &lt;FONT color="#0000ff"&gt;int4&lt;/FONT&gt;(2), Null, 0, &lt;FONT color="#0000ff"&gt;loc&lt;/FONT&gt;(iBytesNeeded))&lt;BR /&gt;&lt;B&gt;&lt;FONT color="#0000ff"&gt;ALLOCATE&lt;/FONT&gt;&lt;/B&gt;(iPI2buf(iBytesNeeded))&lt;BR /&gt;pPI2 = &lt;FONT color="#0000ff"&gt;LOC&lt;/FONT&gt;(iPI2buf)&lt;BR /&gt;iret = GetPrinter(hPrinter, &lt;FONT color="#0000ff"&gt;int4&lt;/FONT&gt;(2), pPI2, iBytesNeeded, &lt;FONT color="#0000ff"&gt;loc&lt;/FONT&gt;(iBytesNeeded))&lt;BR /&gt;&lt;FONT color="#008000"&gt;! check to see if print job is spooled or sent directly tp printer&lt;BR /&gt;! if sent directly to printer abort print job&lt;BR /&gt;&lt;/FONT&gt;iret = &lt;FONT color="#0000ff"&gt;IAND&lt;/FONT&gt;(PI2%ATTRIBUTES, PRINTER_ATTRIBUTE_DIRECT)&lt;BR /&gt;&lt;FONT color="#008000"&gt;! flag PRINTER_ATTRIBUTE_DIRECT = 2&lt;BR /&gt;&lt;/FONT&gt;&lt;B&gt;&lt;FONT color="#0000ff"&gt;if&lt;/FONT&gt;&lt;/B&gt;(iret == PRINTER_ATTRIBUTE_DIRECT) &lt;B&gt;&lt;FONT color="#0000ff"&gt;then&lt;BR /&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;FONT color="#008000"&gt;! post mesgbox() here and abort print job&lt;BR /&gt;&lt;/FONT&gt;&lt;B&gt;&lt;FONT color="#0000ff"&gt;go to&lt;/FONT&gt;&lt;/B&gt; 99&lt;BR /&gt;&lt;B&gt;&lt;FONT color="#0000ff"&gt;end if&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 23 Feb 2006 23:58:18 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-StartDoc-question/m-p/766493#M20386</guid>
      <dc:creator>ahasan</dc:creator>
      <dc:date>2006-02-23T23:58:18Z</dc:date>
    </item>
    <item>
      <title>Re: Win32 StartDoc() question</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-StartDoc-question/m-p/766494#M20387</link>
      <description>Ah, "Print directly to the printer" could be the reason for halt indeed. I don't have an idea why would like to switch on that one  print spooler is supposed to take care of that.</description>
      <pubDate>Fri, 24 Feb 2006 20:00:35 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-StartDoc-question/m-p/766494#M20387</guid>
      <dc:creator>Jugoslav_Dujic</dc:creator>
      <dc:date>2006-02-24T20:00:35Z</dc:date>
    </item>
    <item>
      <title>Re: Win32 StartDoc() question</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-StartDoc-question/m-p/766495#M20388</link>
      <description>&lt;DIV&gt;I did try MS NotePad and MSExcell with Print Direct To The Printer enabled in the Printer Properties Dlg. Box. Both NotePad and Excell hung when trying to print with the printers offline. This was on an XP Home machine, and I tried it with an HP and Epson printer. When the spooler iwas turned back on in the Printer Properties Dlg box,the print jobs spooled for NotePadand Excell (with the printers offline) and the programs did not hang. Could be the waymy XP Home machine is set up, but I am starting to think this may be a general problem. &lt;/DIV&gt;</description>
      <pubDate>Fri, 24 Feb 2006 22:59:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Win32-StartDoc-question/m-p/766495#M20388</guid>
      <dc:creator>ahasan</dc:creator>
      <dc:date>2006-02-24T22:59:13Z</dc:date>
    </item>
  </channel>
</rss>

