SetLandscape

SetLandscape

Postby Otto » Sun Jun 13, 2021 12:57 am

Hello friends,
If I use oPrn:SetLandscape() or oPrn:SetPortrait() ? oPrn:nOrient always returns 1.
Is SetLandscape working for you?
Best regards,
Otto

Code: Select all  Expand view  RUN

function nOrientPrn()
    local cret, oprn
    PRINTER oPrn
    cRet := oPrn:getmodel()
     ? cRet
    oPrn:SetLandscape()
    ? oPrn:nOrient
    oPrn:SetPortrait()
   ? oPrn:nOrient
     endprint
 return cret
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Re: SetLandscape

Postby Antonio Linares » Sun Jun 13, 2021 6:12 am

Dear Otto,

Please try this change in your code:

? oPrn:nOrient := oPrn:GetOrientation()
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42103
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: SetLandscape

Postby Otto » Sun Jun 13, 2021 8:10 am

Dear Antonio,
I did what you suggested but Setorient() in my case does not work.

If I change directly the Printer setup in the setup window then you get the right orientation from GetOrient() function.

Best regards,
Otto

function SetOrient(nOrient)
local cret, oprn

//#define DMORIENT_PORTRAIT 1
//#define DMORIENT_LANDSCAPE 2


PRINTER oPrn
if nOrient=2
oPrn:SetLandscape()
else
oPrn:SetPortrait()
endif
endprint

return NIL

function nOrientPrn()
local cret, oprn

PRINTER oPrn
cRet := oPrn:getmodel()
? oPrn:nOrient := oPrn:GetOrientation()
endprint

return cret
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Re: SetLandscape

Postby Antonio Linares » Sun Jun 13, 2021 9:04 am

yes, thats the right way to do it
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42103
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: SetLandscape

Postby Otto » Sun Jun 13, 2021 9:41 am

Dear Antonio,
maybe I explained myself bad.
It is not working.
Only if I change the orientation manually I can see with getorient() right orientaion. But Setorient() is not working.
What should I do?

Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Re: SetLandscape

Postby Antonio Linares » Sun Jun 13, 2021 4:23 pm

Please try it this way and lets check if there is a difference:

PrnLandscape( oPrinter:hDC )
...
PrnPortrait( oPrinter:hDC )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42103
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: SetLandscape

Postby Otto » Sun Jun 13, 2021 7:26 pm

Dear Antonio,
the situation is the same. It hasn't changed.
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Re: SetLandscape

Postby nageswaragunupudi » Sun Jun 13, 2021 10:28 pm

For me, this is working
Code: Select all  Expand view  RUN
  PRINT oPrn PREVIEW
   oPrn:SetPortrait()
   ? oPrn:GetOrientation() // --> 1
   oPrn:SetLandScape()
   ? oPrn:GetOrientation() // --> 2
 


Did I not understand the problem?
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10643
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: SetLandscape

Postby Otto » Mon Jun 14, 2021 12:24 am

Dear Mr. Rao,

shouldn't these changes affect the printer setup?

Image

Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Re: SetLandscape

Postby Otto » Mon Jun 14, 2021 7:33 am

Dear Mr. Rao, dear Antonio,

My problem is that I need to print from TActiveX.

It seems that Fivewin creates a printer device context and not makes the default for this printer for all applications.
Printing from the web browser control I think is a different application.
Therefore, I would need the changes for all applications.
Can you please help me?
Best regards,
Otto


https://www.amyuni.com/forum/viewtopic.php?t=1224



Once the DEVMODE structure has been modified to suit our configuration, we can either create a
printer device context using the CreateDC API call:

Code: Select all

HDC hDC = CreateDC( _T( "winspool" ), szPrinter, NULL, lpDevMode );

Or make this configuration as the default for this printer and for all applications using this printer.

Code: Select all

DWORD dw;
PRINTER_INFO_2 *pi2;
// get default printer info structure which contains the DEVMODE
GetPrinter( m_hPrinter, 2, NULL, 0, &dw );
pi2 = (PRINTER_INFO_2 *)GlobalAllocPtr( GHND, dw );
GetPrinter( m_hPrinter, 2, (LPBYTE)pi2, dw, &dw );
// set the new printer info structure
pi2->pDevMode = lpDevMode;
SetPrinter( m_hPrinter, 2, (LPBYTE)pi2, 0 );
GlobalFreePtr( pi2 );
// notify applications that the default DEVMODE has changed
SendMessageTimeout( HWND_BROADCAST, WM_DEVMODECHANGE, 0, (LPARAM)szPrinter,
SMTO_NORMAL, 1000, NULL );
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Re: SetLandscape

Postby Otto » Mon Jun 14, 2021 10:26 pm

Hello Antonio, hello Mr. Rao,
The first tests with Rundll32 and the PRINTUI.DLL work.
I have to call rundll32.exe with WINEXEC but it works.
If it were possible, I would prefer to be able to make the change with Fivewin.
Best regards,
Otto

Code: Select all  Expand view  RUN


function hochformat()
    winexec('RUNDLL32.EXE PRINTUI.DLL,PrintUIEntry /Sr /n "Seminar" /a "c:\setprnter\Seminarhoch.dat"')
return nil

function landscape()
    winexec('RUNDLL32.EXE PRINTUI.DLL,PrintUIEntry /Sr /n "Seminar" /a "c:\setprnter\Seminar.dat"')
return nil

function Setdefault()
    winexec('RUNDLL32.EXE PRINTUI.DLL,PrintUIEntry /y /n "Seminar"')
return nil

 
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Re: SetLandscape

Postby Otto » Thu Jun 17, 2021 3:41 pm

Hello friends,

Switching between landscape and portrait is working fine now
Best regards,
Otto
Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 84 guests