473,322 Members | 1,755 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Send fax number from vb6 app. to printer dialog?

spider1916
hi all

i am working on a application writen in vb6 (winXP PRO). in this appl. my users pull reports from an MS access db into a MSflexGrid. if they click on a supplier in the supplier column, a purchase order form appears. this form must be sent by fax. the supplier's details (fax number, contact person ets.) are read from the db and inserted into textboxes.

the fax will be sent to a RICOH Africio 2018D RPCS printer with a LAN_FAX M4
driver. i want to know if it's possible to send the supplier's details from my appl. to the dialog box that appears when you print after selecting LAN-Fax as the printer. so that faxing is made a bit easier.

pls...help
i don't realy know much about vb6
Sep 4 '06 #1
3 4775
Did you find out how to do this? I'm trying to do it in VB .net

hi all

i am working on a application writen in vb6 (winXP PRO). in this appl. my users pull reports from an MS access db into a MSflexGrid. if they click on a supplier in the supplier column, a purchase order form appears. this form must be sent by fax. the supplier's details (fax number, contact person ets.) are read from the db and inserted into textboxes.

the fax will be sent to a RICOH Africio 2018D RPCS printer with a LAN_FAX M4
driver. i want to know if it's possible to send the supplier's details from my appl. to the dialog box that appears when you print after selecting LAN-Fax as the printer. so that faxing is made a bit easier.

pls...help
i don't realy know much about vb6
Dec 15 '06 #2
Did you find out how to do this? I'm trying to do it in VB .net
no, not the way i wanted to.........but i used the clipboard.settext function
to copy the number to the clipboard and then my users, after fax machine has been selected, click in the txt box where the number is requested and press
ctrl + v or r-click and paste......

good luck
spider1916
Jan 16 '07 #3
Esky
1
I realize this is an old post, but this may help others in search of an answer...

In VB 5/6, code execution is halted whenever a fax/printer dialog box is opened. Once the printer dialog box is closed, execution resumes. In order to populate the dialog box, a background worker thread is needed. In VB.net this is no problem, but in VB5/6, I chose to create a "worker program" that is launched (with the fax number as a command line argument) just prior to opening the printer/fax dialog.

The worker program simply watches for the fax/printer dialog box to be opened. The worker program than inserts the fax number, sends the fax and closes the dialog box. As soon as the dialog box is closed, the main program resumes execution. In VB.net, a background worker thread can run even though the main code is halted by the printer dialog box. This worker thread can enter the fax number and close the dialog box.

Expand|Select|Wrap|Line Numbers
  1. 'Worker thread or exe to find the printer/fax dialog box
  2. 'locate the fax number input box, enter the fax number
  3. 'locate the "send" button and send.
  4. 'Thanks to 'URL: http://www.allapi.net/
  5. 'For help with the APIs  E-Mail: KPDTeam@Allapi.net
  6.  
  7.  
  8. '********* WORKERTHREAD.EXE Module *********
  9. Const SW_SHOWNORMAL = 1
  10. Const KEYEVENTF_KEYUP = &H2
  11. Const INPUT_KEYBOARD = 1
  12.  
  13. Private Type KEYBDINPUT
  14.   wVk As Integer
  15.   wScan As Integer
  16.   dwFlags As Long
  17.   time As Long
  18.   dwExtraInfo As Long
  19. End Type
  20. Private Type GENERALINPUT
  21.   dwType As Long
  22.   xi(0 To 23) As Byte
  23. End Type
  24.  
  25. Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
  26. Private Declare Function SendInput Lib "user32.dll" (ByVal nInputs As Long, pInputs As GENERALINPUT, ByVal cbSize As Long) As Long
  27. Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (pDst As Any, pSrc As Any, ByVal ByteLen As Long)
  28. Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
  29. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
  30.  
  31.  
  32. Sub Main()
  33. 'FAX NUMBER SHOULD BE VERIFIED/QUALIFIED BEFORE COMING HERE!
  34. Dim FaxNumber As String
  35. If VB.App.PrevInstance = True Then End
  36. FaxNumber = Command()
  37.  
  38. Dim WinWnd As Long, TheVal As Long
  39. 'Get Handle for desired GUI - search for the form's caption
  40. While WinWnd = 0
  41.     DoEvents
  42.     WinWnd = FindWindow(vbNullString, "PC-FAX") 
  43. '"PC-FAX" is my printer/fax dialog box caption. 
  44. 'Change this string to match your dialog box caption!
  45. Wend
  46. 'make the GUI window form active
  47. TheVal = SetForegroundWindow(WinWnd)
  48. 'Need time to process ?
  49. Sleep 10
  50. Dim Count As Integer
  51. 'send 5 tabs to get to the GUI FAX number input box
  52. 'Change this number to suit your needs!
  53. For Count = 1 To 5
  54.     Sleep 10
  55.     SendKey CByte(9)
  56.     DoEvents
  57. Next Count
  58. 'send the fax number to the GUI fax number input box
  59. 'sending one character at a time
  60. For Count = 1 To Len(FaxNumber)
  61.     Sleep 10
  62.     SendKey CByte(Asc(Mid(FaxNumber, Count, 1)))
  63.     DoEvents
  64. Next Count
  65. 'send three more tabs to get to the GUI SEND button
  66. 'Again, change the number of tabs to suit your needs!
  67. For Count = 1 To 3
  68.     Sleep 10
  69.     SendKey CByte(9)
  70.     DoEvents
  71. Next Count
  72. 'send ENTER to send the fax
  73. SendKey CByte(13)
  74.  
  75. End Sub
  76.  
  77.  
  78.  
  79. Public Sub SendKey(bKey As Byte)
  80. 'Thanks to 'URL: http://www.allapi.net/
  81. 'For help with the APIs  E-Mail: KPDTeam@Allapi.net
  82.  
  83.     Dim GInput(0 To 1) As GENERALINPUT
  84.     Dim KInput As KEYBDINPUT
  85.     KInput.wVk = bKey  'the key we're going to press
  86.     KInput.dwFlags = 0 'press the key
  87.     'copy the structure into the input array's buffer.
  88.     GInput(0).dwType = INPUT_KEYBOARD   ' keyboard input
  89.     CopyMemory GInput(0).xi(0), KInput, Len(KInput)
  90.     'do the same as above, but for releasing the key
  91.     KInput.wVk = bKey  ' the key we're going to realease
  92.     KInput.dwFlags = KEYEVENTF_KEYUP  ' release the key
  93.     GInput(1).dwType = INPUT_KEYBOARD  ' keyboard input
  94.     CopyMemory GInput(1).xi(0), KInput, Len(KInput)
  95.     'send the input now
  96.     Call SendInput(2, GInput(0), Len(GInput(0)))
  97. End Sub


The main program can then launch the worker exe similar to this...

Expand|Select|Wrap|Line Numbers
  1. 'execution stops until fax dialog is closed
  2. 'so launch app to enter number and send fax
  3. Dim FaxNumber as String
  4. FaxNumber = "15555555555"
  5. Shell ("C:\MyPrograms\WorkerThread.exe" & " " & FaxNumber)
  6. 'Launch your fax job dialog box
  7. MyExcel.ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:="KONICA MINOLTA bizhub 20 (FAX) on Ne01:"
  8. 'Code resumes after WorkerThread.exe finishes it's job
Jun 7 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: rodchar | last post by:
hey all, is there a way to bring up the printer dialog (File/Print) thru code in asp.net? thanks, rodchar
1
by: Tommy Martin | last post by:
I would like to bring up the printer dialog before my report is sent to the printer to allow the user to select another destination and possibly the number of copies. Can anyone steer me in the...
1
by: MIS | last post by:
Dear all I need to hidden dailog box printer on vb.net , How can i do ? Brg , Tingnong
11
by: pamelafluente | last post by:
I am doing my own PrintDialog, and have placed there a combo with the printer names, as in the PrintDialog provided by VB.NET. Here is the question: how do I open the native windows printer...
5
by: Diego | last post by:
How do I capture a cancel event of Printer dialog box? Regards, Diego
1
by: Tim Marshall | last post by:
A2003 Most of the time, in past apps, my report routines are usually a preview first and then DoCmd.RunCommand acCmdPrint for the printer dialog. However, I'm now faced with wanting to send a...
2
by: mehdi_mousavi | last post by:
Hi folks, has got a button, that enabled user whether to send some sort of data (when an application crashes) to Microsoft. I would like to know that is there anyway to incorporate this...
0
by: Marco Bonifazi | last post by:
Hello! I have a file (in my situation it is a Postscript file or a Pdf file, but it isn't important). I must send this file to a printer, using Python, and I need to select the printer to...
3
tsubasa
by: tsubasa | last post by:
I am working on a web page that allows a user to review orders that are pending approval. If the user approves the order it will print the order then run an asp page to close the order after it has...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.