No announcement yet.

Three simple questions (?)

  • Filter
  • Time
  • Show
Clear All
new posts

  • Three simple questions (?)

    Three simple questions (?)
    1) Could somebody point me in the direction of the code for a
    graduated fill to a dialog caption bar - last year or the year
    2) How can I pass arrays to a DLL - say 6 arrays of 200 entries
    in each. Is it easier to pass Types?
    3) The following code works under W9X, but not NT4 (surprise,
    DocumentProperties hDlg, hPrt, BYCOPY pPrinterName, BYVAL DvModePtr, BYVAL %NULL, %DM_OUT_BUFFER
    @DvModePtr.dmOrientation = %DMORIENT_LANDSCAPE
    The printer driver remains in portrait mode under NT - how can I
    force landscape?

    “None but those who have experienced them can conceive of the enticements of science” - Mary Shelley

  • #2

    I can only comment on 2:

    A UDT array consisting of the 6 variables that you'd pass in separate arrays would most certainly be faster.
    You'd not only have less overhead from passing array addresses on the stack, but accessing UDT members appears to be faster than accessing multiple array members.

    Arrays are always passed by reference. What is passed is the address of an array descriptor if you use TheArray() without any subscripts.
    The DLL can access the entire array that way, including its bounds. You can even use a different array name inside the DLL function if you like.
    If you pass TheArray(Subscribt) however, the DLL gets the address to that value only.


    [email protected]
    [email protected]


    • #3
      1. I wrote some elementary code for a graduated caption a couple of years ago, but I never finished it up (to handle different resolutions and font sizes cleanly, etc). It's not "high quality" code and would probably still require some work, but if you email me, I'll send you what I have - it should get you started. Note: since high color modes in later version of Windows do this automatically, the code would need to be changed to work out if the graduation effect was necessary.

      2. If you are not using dynamic string arrays, pass the 1st element of the array BYREF to the DLL along with the index count (ubound-lbound+1), and then the DLL can access the data directly in memory. In fact, if you do it this way, you can use DIM..AT in the DL to superimpose an array at the same memory address and manipulate the array data as required.

      3. What does the call to DocumentProperties() return? That could be the clue you need, however, since your call is not specifying %DM_IN_BUFFER, it looks like you are not setting any DEVMODE items, just retrieving them.

      Here is what I use:
          IF ISTRUE OpenPrinter(PortTestName, hPrt, BYVAL %NULL) THEN
              dwNeed = DocumentProperties(%HWND_DESKTOP, hPrt, PortTestName, BYVAL %NULL, BYVAL %NULL, 0)
              pDevMode = SPACE$(dwNeed)
              DvModePtr = STRPTR(pDevMode)
              dwRet = DocumentProperties(%HWND_DESKTOP, hPrt, PortTestName, BYVAL DvModePtr, BYVAL %NULL, %DM_OUT_BUFFER)
              IF dwRet <> %IDOK THEN
                  pDevMode = ""
                  DocumentProperties %HWND_DESKTOP, hPrt, PortTestName, BYVAL DvModePtr, BYVAL %NULL, %DM_OUT_BUFFER
                  @DvModePtr.dmOrientation = gOrientation '%DMORIENT_PORTRAIT or %DMORIENT_LANDSCAPE
                  DocumentProperties %HWND_DESKTOP, hPrt, PortTestName, BYVAL DvModePtr, BYVAL DvModePtr, %DM_OUT_BUFFER OR %DM_IN_BUFFER
              END IF
              ClosePrinter hPrt
          END IF
      PowerBASIC Support
      mailto:[email protected][email protected]</A>
      mailto:[email protected]


      • #4
        iain --
        own caption ...
        you can use as skeleton.
        rewrite a fragment if needtorefresh then ... end if
        to avoid flickering, use memory hdc.
        i also recommend to leave ws_popup only and to draw standart buttons by drawframecontrol.

        btw, on codeguru and similar sites you can find some c examples.

        e-mail: [email protected]


        • #5
          Thank you for the help - another job to do!
          Apologies for the delay in replying - been offline for a couple of days.
          Isn't amazing how much there is to catch up on!

          “None but those who have experienced them can conceive of the enticements of science” - Mary Shelley