Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RICH TEXTBOX CONTROL & WINDOWS 2000

Status
Not open for further replies.

MariK

MIS
Aug 18, 2001
17
0
0
ZA
I am using VB6 on a Windows 2000 pc. When I use the .selprint command to print text from a RTB the .selprint command never completes, and spools infinite pages to the printer.

The same code works perfectly on a Windows NT pc.

Can anybody tell me why this is happening?

Thanks

Mari
 
I haven't experienced this yet but you may want to see what happens when you use the API function ShellExecute to print the item:

(You will need to save the data to the file ,or better to a temp file, first)

Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation _
As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Private Const SW_SHOWMINNOACTIVE = 7
'==============================================

Put this in a sub and pass the file path and name to it (sFilePathAndName)
'Will print the file using the application the is the default type for the file name extension
ShellExecute Form1.hwnd, "Print", sFilePathAndName, ByVal 0&, ByVal 0&, SW_SHOWMINNOACTIVE
 
Hi,

Thanks for your reply. I changed the code to use the ShellExecute API Function but I'm still getting the same problem. Any other sugestions?

Regards

Mari
 
Do you have this problem with any other programs or can you safetly say that it is only with the RTB?

See what program defaults to opening a *.rtf file, and try to print from that program - the API function that I gave uses the default program to print with.
 
Hi,

I can safely say it is rtb. Last night after I posted my last mail I opened the files with Microsoft Word and it worked fine.

Thanks for your help.

Regards

Mari
 
But when you do a Double click on a *.Rtf file, does it open with MS Word, or another program?

The API call that I gave above uses the file itself (name and path are passed) then uses the program that is the default program for printing rtf files in order to print - it doesn't have anything to do with the RTB.

So, if rtf files default to Word, then the API function uses Word to print them.

Please verify this.
 
It opens with WordPad or Notepad.
I changed this with to open with Microsoft Word. The main problem with this is that I can not guarantee that the users of my program will open .rtf files with Microsoft Word. However, if I save the file with a .doc extention I can be fairly certain that it will open with Microsoft Word.

Another problem with opening the file in various applications will be that my code generates barcodes. It does not always print correct from diffrent text editors.

All the formating of the text and barcodes works fine in Microsoft Word.

A new problem that I've encountered is when I print, let say, 30+ files in sucession. I use a do while loop to create these specific files and prints them in the same loop. The problem is that it opens a lot of word documents, each in it's one instance of Microsoft Word. At some stage during this it gets to much to handle and Microsoft Word starts churing out errors. I'm saving each of the files to a temp file which gets deleted after it's printed.

Do you have any sugestions.
 
I do not have a problem like this (I also print rtf files via Word or MS Word Pad - depending on what is installed) and use Bar code font, etc, etc, and do not have any problems like this yet.

I think that this is either a bug in a ceratin update or a system/resource problem on that PC.

I would first make sure that I had the most recent service packs for Windows 2000 and for Office 2000( to make sure there isn't a problem with one of these. And I would check on another OS that has Windows 2000 and Office/Word 2000 to see if this problem happems there also.

Also go to the MS kb site and start searching for the bugs and problems on this:


One last thing: can you print other rtf files (ones produced with Word Pad) with Word PAd with-out problems? Maybe it has to do with a certain Font you are using (try a process of elimination)
 
Once I created the file in .rtf format and I open it with any aplication it works fine. I just seem to encounter problems while printing it form VB.


Thanks for all your help. I will look at the sites you mentioned for bugs.

Mari
 
So the file opens with the API function above AND Word Pad as the default for an rtf file?

If so then there seems to be a problem with the RTB and Win2000 - Do you have SP5 for VB6?
 
Don't know if anyone is still reading this thread or not but I'm experiencing the same problem in VB6 on Windows 2000 as Mari is- trying to print from a Rich Text Box fails with a spool error. The code works fine on 98, NT and XP but fails consistently on Win2K. I'm using the .selprint command as well. If anyone found a solution, I'd be thankful for any help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top