Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Disabling Print-Button in Preview
Message
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00672347
Message ID:
00672371
Views:
7
>Hi there,
>is it possible to disable the print-button in the preview-toolbar for not all but only a few reports used in a project. I tried using "set print off" before calling the report and it seemed to work, but affected the app when it came to printing in other parts of the app.
>Thanks in advance
>Thomas

Hi Thomas,

Try it:
DECLARE INTEGER SetParent IN USER32 INTEGER, INTEGER
DECLARE INTEGER GetParent IN USER32 INTEGER
DECLARE         _fpreset IN msvcrt20.dll

DECLARE INTEGER CreateWindowExA IN USER32 INTEGER, STRING @, STRING @, INTEGER, INTEGER, INTEGER,;
                                INTEGER, INTEGER, INTEGER, INTEGER, INTEGER, STRING
DECLARE INTEGER GetClassName IN USER32 INTEGER, STRING @, INTEGER
DECLARE INTEGER GetWindowLong IN USER32 INTEGER, INTEGER
DECLARE INTEGER SetWindowLong IN USER32 INTEGER, INTEGER, INTEGER
DECLARE INTEGER ShowWindow IN USER32 INTEGER, INTEGER
DECLARE INTEGER DestroyWindow IN USER32 INTEGER
DECLARE INTEGER MoveWindow IN USER32 INTEGER, INTEGER,INTEGER, INTEGER,INTEGER, INTEGER
DECLARE INTEGER SetWindowPos IN USER32 INTEGER, INTEGER,INTEGER, INTEGER,INTEGER, INTEGER, INTEGER
DECLARE INTEGER IsWindowVisible IN USER32 INTEGER



#define WS_OVERLAPPED       0x00000000
#define WS_POPUP            0x80000000
#define WS_CHILD            0x40000000
#define WS_MINIMIZE         0x20000000
#define WS_VISIBLE          0x10000000
#define WS_DISABLED         0x08000000
#define WS_CLIPSIBLINGS     0x04000000
#define WS_CLIPCHILDREN     0x02000000
#define WS_MAXIMIZE         0x01000000
#define WS_CAPTION          0x00C00000
#define WS_BORDER           0x00800000
#define WS_DLGFRAME         0x00400000
#define WS_VSCROLL          0x00200000
#define WS_HSCROLL          0x00100000
#define WS_SYSMENU          0x00080000
#define WS_THICKFRAME       0x00040000
#define WS_GROUP            0x00020000
#define WS_TABSTOP          0x00010000

#define WS_MINIMIZEBOX      0x00020000
#define WS_MAXIMIZEBOX      0x00010000


#define WS_EX_DLGMODALFRAME     0x00000001
#define WS_EX_NOPARENTNOTIFY    0x00000004
#define WS_EX_TOPMOST           0x00000008
#define WS_EX_ACCEPTFILES       0x00000010
#define WS_EX_TRANSPARENT       0x00000020
#define WS_EX_MDICHILD          0x00000040
#define WS_EX_TOOLWINDOW        0x00000080
#define WS_EX_WINDOWEDGE        0x00000100
#define WS_EX_CLIENTEDGE        0x00000200
#define WS_EX_CONTEXTHELP       0x00000400

#define WS_EX_RIGHT             0x00001000
#define WS_EX_LEFT              0x00000000
#define WS_EX_RTLREADING        0x00002000
#define WS_EX_LTRREADING        0x00000000
#define WS_EX_LEFTSCROLLBAR     0x00004000
#define WS_EX_RIGHTSCROLLBAR    0x00000000

#define WS_EX_CONTROLPARENT     0x00010000
#define WS_EX_STATICEDGE        0x00020000
#define WS_EX_APPWINDOW         0x00040000


#define WS_EX_OVERLAPPEDWINDOW  (WS_EX_WINDOWEDGE + WS_EX_CLIENTEDGE)
#define WS_EX_PALETTEWINDOW     (WS_EX_WINDOWEDGE + WS_EX_TOOLWINDOW + WS_EX_TOPMOST)


#DEFINE GWL_HINSTANCE       (-6)
#define GWL_STYLE           (-16)
#define GWL_EXSTYLE         (-20)
#DEFINE SW_NORMAL           1
#define SW_SHOWNOACTIVATE   4

SET LIBRARY TO Foxtools.fll

LOCAL lotmr,lcPath,lcAlias
lcAlias=SYS(2015)
lcPath=SYS(16)
lcPath=IIF(RAT("\",lcPath)>0,LEFT(lcPath,RAT("\",lcPath)),lcPath)

* Open table
*USE (lcPath+"XXT900") ALIAS (lcAlias) IN 0


lotmr=CREATEOBJECT("_tmr")
lotmr.Enabled=.T.
* Print Preview
*REPORT FORM (lcPath+"xxr000") PREVIEW

RELE lotmr


USE IN (lcAlias)


SET LIBRARY TO 
RETURN

**********************************************

DEFINE CLASS _tmr AS timer
   Name="_tmr"
   Enabled=.F.
   Interval=100

   ee=.F.

   hPP=0 && Handle window Print Preview
   hTW=0 && Handle temp okna 

   vhPP=0 && VFP Handle window Print Preview
   vhTW=0 && VFP Handle temp okna 

   nTW = "" && Temp name window
   pTW = "" && Name object reference window

   iIndex=0
   dTitle="Print Preview"
   
   OWidth=0

   * Close temp window
   PROCEDURE Destroy
      =DestroyWindow(This.hTW)
   ENDPROC

   * Create temp window
   PROCEDURE Init
      =_fpreset()

      * create window  -  WIN API
      LOCAL lcClass,lii
      lcClass=SPACE(254)
      =GetClassName(MAINHWND(),@lcClass,LEN(lcClass))

      This.hTW=CreateWindowExA(0, ;
               ("STATIC"),.NULL.,;
               WS_CHILD,;
               0,0,100,100,MAINHWND(),0,GetWindowLong(MAINHWND(),GWL_HINSTANCE),.NULL.)

      IF This.hTW=0
         This.Destroy()
      ELSE
         lii=GetWindowLong(This.hTW,GWL_STYLE)
         =SetWindowLong(This.hTW,GWL_STYLE,lii+WS_DISABLED-WS_CHILD)
      ENDIF

      RETURN This.hTW>0
   ENDPROC

   PROCEDURE Timer
      =_fpreset()

      * Find handle of toolbar "Print Preview"
      IF This.vhPP=0
         This.vhPP=_WFINDTITL(This.dTitle)
         This.hPP=IIF(This.vhPP<=0,0,_WHTOHWND(This.vhPP))
      ENDIF

      LOCAL lcPom,liLeft,liTop

      IF This.hPP>0
         liWidth=_WWIDTHP(This.vhPP)
         IF liWidth#This.OWidth

            IF IsWindowVisible(This.hTW)=0
               =SetParent(This.hTW,This.hPP)
               =ShowWindow(This.hTW,SW_SHOWNOACTIVATE)
            ENDIF

            This.OWidth=liWidth
            DO CASE
               CASE liWidth=259
                    liLeft=229
                    liTop=5

               CASE liWidth=257
                    liLeft=229
                    liTop=5

               CASE liWidth=137
                    liLeft=95
                    liTop=30

               CASE liWidth=118
                    liLeft=34
                    liTop=55

               CASE liWidth=85
                    liLeft=34
                    liTop=80

               CASE liWidth=66
                    liLeft=33
                    liTop=105

               CASE liWidth=35
                    liLeft=4
                    liTop=147

            ENDCASE

            =MoveWindow(This.hTW,liLeft,liTop,24,22,8)
         ENDIF

      ENDIF

   ENDPROC

ENDDEFINE
"Navision is evil that needs to be erazed... to the ground"

Jabber: gorila@dione.zcu.cz
Jabber? Jabbim
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform