Right Done as above, but it still won't open a gui for printing which is what I am hoping this will do.
If think I have missed something give a some info please.
if I put back into the program line
`Write MemBlock Dword PRINTDLGEX,40,_get_str_ptr(Pages) :`lpPageRanges
and
`Write MemBlock Dword PRINTDLGEX,52,_get_str_ptr(Copies) :`nCopies
they break the function they call , and I don't see why?
So if anyone has and idea on how to get it going they are very welcome to try.
Rem Project: printdlg
Rem Created: 6/26/2005 11:59:16 AM
Rem ***** Main Source File *****
rem Standard Setup Code
sync on : sync rate 0 :
backdrop on
color backdrop rgb(0,0,0) : hide mouse
set text font "arial" : set text size 12 : set text transparent
open As Boolean
do
text 100,100,"Press return key to send to printer?"
if returnkey()=1
_Printer_Setup("|1|","|1|")
endif
sync
loop
function _Printer_Setup(Pages As String, Copies As String)
open=1
user32 As Integer
comdlg32 As Integer
`Load in required Dll's
user32= _find_fee_dll()
load dll "user32.dll",user32
comdlg32 = _find_fee_dll()
load dll "comdlg32.dll",comdlg32
hwnd As Dword
hwnd = Call Dll(user32,"GetActiveWindow")
Delete Dll user32
PRINTDLGEX As Integer
PRINTDLGEX = _find_free_mem()
Make MemBlock PRINTDLGEX,84
lpopf as Dword
lpopf = Get MemBlock Ptr(PRINTDLGEX)
remstart :C++ structure Lay-out
typedef struct tagPDEX {
DWORD lStructSize;
HWND hwndOwner;
HGLOBAL hDevMode;
HGLOBAL hDevNames;
HDC hDC;
DWORD Flags;
DWORD Flags2;
DWORD ExclusionFlags;
DWORD nPageRanges;
DWORD nMaxPageRanges;
LPPRINTPAGERANGE lpPageRanges;
DWORD nMinPage;
DWORD nMaxPage;
DWORD nCopies;
HINSTANCE hInstance;
LPCTSTR lpPrintTemplateName;
LPUNKNOWN lpCallback;
DWORD nPropertyPages;
HPROPSHEETPAGE *lphPropertyPages;
DWORD nStartPage;
DWORD dwResultAction;
} PRINTDLGEX, *LPPRINTDLGEX;
remend
size As Integer
Printbuffer As String
Printbufferptr As Dword
Flags As Dword
exflags AS Dword
Pages As String
Copies As String
`filter = filter +"|"
`initdir = intdir+"|"
`dtitle=dtitle+"|"
`printbuffer = "|"+space$(255)+"|"
`Printbufferptr = _get_str_prt(Printbuffer)
Write MemBlock Dword PRINTDLGEX,0,76 :`lstrucsize
Write MemBlock Dword PRINTDLGEX,4,hwnd:` hwndOwner
Write MemBlock Dword PRINTDLGEX,8,HGLOBAL :`hdevMode
Write MemBlock Dword PRINTDLGEX,12,HGLOBAL :`hDevNames
Write MemBlock Dword PRINTDLGEX,16,HDC :`hDC
Write MemBlock Dword PRINTDLGEX,20,FLag :`Flags
Write MemBlock Dword PRINTDLGEX,24,Flag2 : `Flags2
Write MemBlock Dword PRINTDLGEX,28,exFlags :`ExclusionFlags
Write MemBlock Dword PRINTDLGEX,32,1 :` nPagesRanges
Write MemBlock Dword PRINTDLGEX,36,256 :`nMaxPageRanges
rem if I put this back I get a memblock error
`Write MemBlock Dword PRINTDLGEX,40,_get_str_ptr(Pages) :`lpPageRanges
Write MemBlock Dword PRINTDLGEX,44,0 : `nMinPage
Write MemBlock Dword PRINTDLGEX,48,256 :`nMaxPage
`Write MemBlock Dword PRINTDLGEX,52,_get_str_ptr(Copies) :`nCopies
Write MemBlock Dword PRINTDLGEX,56,HINSTANCE :`hInstance
Write MemBlock Dword PRINTDLGEX,60,LPCTSTR :`LPpRINTtEMPLATEnAME
Write MemBlock Dword PRINTDLGEX,64,LPUNKNOWN :`lpCallBack
Write MemBlock Dword PRINTDLGEX,68,0 : `nPrropertyPages
Write MemBlock Dword PRINTDLGEX,72,HPROPSHEETPAGE :`lphPropertyPages
Write MemBlock Dword PRINTDLGEX,76,StartPage :`nstartPage
Write MemBlock Dword PRINTDLGEX,80,Result :`dwResultAction
`Call the Command to open the Dialouge
retval As Dword
if open
retval = Call Dll(comdlg32,"PrintDlgA",lpopf)
endif
endfunction
function _find_fee_dll()
retval=0
repeat
inc retval
until dll exist(retval)=0
endfunction retval
function _find_free_mem()
retval=0
repeat
inc retval
until MemBlock Exist(retval)=0
endfunction retval
function _get_str_ptr(pstr As string)
memnum As Integer
strlen As Integer
char As Byte
memptr As Dword
strptr As Dword
memnum = _find_free_mem()
strlen = len(pstr)
make MemBlock memnum,strlen
For i = 1 to strlen
If Mid$(pstr,i)= "|"
char = 0
else
char = Asc(Mid$(pstr,i))
endif
Write MemBlock Byte memnum,(i - 1),char
next i
memptr = Get MemBlock Ptr(memnum)
strptr = Make Memory(strlen)
Copy Memory strptr,memptr,strlen
Delete MemBlock memnum
endfunction strptr
I'm not getting you down am I, Ho Look! another fancy Door?