Jump to content
AndyS19

Where is the Y position for _WinAPI_TextOut

Recommended Posts

AndyS19

The _WinAPI_TextOut() function requires a x/y point.  In a rectangle enclosing a text character, where is the x/y point, upper left or lower left?  I'm trying to setup a function to print a header, then normal text lines, and I want the header to be at the top of the printable area on a page..  I use _WinAPI_GetDeviceCaps() to get the start of the printable area.  Then at the start of each page, I want to print a header, then text lines.

$iLeftMargin_X = _WinAPI_GetDeviceCaps($hDC, $PHYSICALOFFSETX) ; returns 151
$iTopMargin_Y = _WinAPI_GetDeviceCaps($hDC, $PHYSICALOFFSETY) ; returns 70

; print the header:
$x = $iLeftMargin_X
$y = $iTopMargin_Y
WinAPI_TextOut($hDC, $x , $y, "header text")

; print the first text line
$y += 22
WinAPI_TextOut($hDC, $x , $y, "The first text line")

Will the header text be at the physical top of the printable area or will it be 1 text line lower.  It all depends on whether $iTopMargin_Y refers to the top of the text or the bottom of the text.

Share this post


Link to post
Share on other sites
Bowmore

As with all these types of questions the answer is to try it and see where the text is placed.
From MSDN 
 

 
PHYSICALOFFSETY

For printing devices: the distance from the top edge of the physical page to the top edge of the printable area, in device units. For example, a printer set to print at 600 dpi on 8.5-by-11-inch paper, that cannot print on the topmost 0.5-inch of paper, has a vertical physical offset of 300 device units.


"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • FrancescoDiMuro
      By FrancescoDiMuro
      Good evening everyone
      I was trying to insert function header to the functions of my script, but, in the SciTE console, this appears:
      Function or struct definition not found, unable to insert header. @Jos Any suggestion?
      Thanks in advance.

      Best Regards.
    • argumentum
      By argumentum
      by  eltorro Posted April 26, 2010
      Most print preview solutions use the MFC Doc/View architecture which limits it usefulness outside of c++. I found an article where a Delphi programmer used Enhanced Meta Files wrapped in a custom header and packaged together to create a print preview control. After a little more searching, It looks like using EMFs is a solution that would work.
      Some people suggest to create the document in Word or HTML and use Word or a browser to view it. Indeed, I have rendered documents to HTML and used the IE UDF to display the contents and/or print them. Not quite as ideal as one would like.
      Using GRS's printwin.au3 as a start, I came up with a print preview solution which others may be able to expand upon
    • wakillon
      By wakillon
      HttpHeaderWatcher v1.0.1.3
       

      Some time ago, some members asked how to see the Http Requests.
      There are quite a few external applications but not in AutoIt!
      HttpHeaderWatcher in association with WinPcap, very modestly solves this lack.
       
      Once done this http watcher, i asked me : why not Re-build a WinHttp Request in AutoIt from a selected Request in one Click ?
      So i have added a "Create au3" button who open the WinHttp Request of your choice in AutoIt format in SciTE Editor.
      Voila voila, hope it can help ! 
      Buttons were made online with chimply.com the easy and free buttons generator !
      See Help for more infos.
      previous downloads : 253
      source and executable are available in the Download Section
      Hope you like it !
    • mutleey
      By mutleey
      Hello everybody, I have a problem here ... I need to generate a form of sale and print quality using the form I could do is not getting good, I created a window without borders with the fields I need, then use the function _ScreenCapture_CaptureWnd () to generate a print of this window and send the image to the printer using the UDF printMGv2.au3, the problem is that to get a good quality I would have to create a huge window to get the print, any suggestions to print this form with a good quality?
      thank you...
      example of the form it takes:
       

    • wakillon
      By wakillon
      Display Http Requests and response by analyzing http packets using winpcap
      and also recreate by one click the winhttp request to au3 format.
       
      Topic
       
×