|
At my office we have multiple printers, however only one of them is a color printer. In order to print to this printer you need to enter a valid password into the appropriate box under the printer settings. However there is a file that needs to be printed from my program that always needs to be printed to this printer and printed in color. I know how to select the printer I want to print to, but I don't know how to access these printer specific settings. There doesn't seem to be a way in .NET so I'm assuming I'm going to have to do some DLLImport or something similar. Any guidance would be greatly appreciated it. BTW (in case it helps) this is a Ricoh Aficio MP C4500 network printer. Thanks in advanced.
|
|
|
|
|
DisIsHoody wrote: we have multiple printers, however only one of them is a color printer
DisIsHoody wrote: a file that needs to be printed from my program that always needs to be printed to this printer and printed in color
Looking at this information I am guessing that the printed to this printer requirement is only because it is the only color printer and the file needs to be printed in color. In other words, is it a safe bet to assume that the only real requirement is that the file needs to be printed in color?
If so, the most cost effective solution can probably be found outside of your code. I.e. simply buy another cheap color printer, and dedicate it to this job, or reconsider the need of password protection being on the existing printer, and instead move the printer to a room that can only be entered with a special key or electronic tag, or whatever.
If not, you are going to have to talk to Ricoh about an sdk of sorts, unless it is possible to save the password in the printer settings on the computer that is running the program.
Good luck,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
Hallo,
I've got an problem with my GUI. My program has to request a couple of websites (POST) and then store the responses in local files.
While requesting the sites, a GUI textbox (tbLog) should inform the user, what site actually is being requested and a "STOP" butten should enable the user to stop the whole process.
Now, when I start work, the GUI freezes and the user cannot do anything until all websites are done. There is no update of tbLog.text at all and no stop button can be pressed.
Me.Refresh() does not help, to.
I read something about threading, but all examples seem to be oversized for my problem.
This is part of my code (simplyfied):
1)Start working by clicking button:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.tbLog.Clear()
Dim zaehler As Integer
Do Until (zaehler = 20)
Dim antwortseite As String
antwortseite = getResults("http://localhost/antiquartwo/test-params.php", "field-keywords=ASP.NET 2.0")
' todo: verarbeiten der antwortseite
' anzeige der response in der GUI
Me.tbLog.Text &= antwortseite
zaehler = zaehler + 1
Loop
Me.Refresh()
End Sub
2) Webrequest (POST):
Function getResults(ByVal portalURI As String, ByVal suchbegriff As String) As String
Dim uri As New Uri(portalURI)
'Dim data As String = "field-keywords=ASP.NET 2.0"
Dim data As String = suchbegriff
Dim request As HttpWebRequest = HttpWebRequest.Create(uri)
request.Method = WebRequestMethods.Http.Post
request.ContentLength = data.Length
request.ContentType = "application/x-www-form-urlencoded"
Dim writer As New StreamWriter(request.GetRequestStream)
writer.Write(data)
writer.Close()
Dim oResponse As HttpWebResponse = request.GetResponse()
Dim reader As New StreamReader(oResponse.GetResponseStream())
Dim tmp As String = reader.ReadToEnd()
oResponse.Close()
'Response.Write(tmp)
getResults = tmp
End Function
Can anybody help me by optimizing my code?
Thank you. Cipherwar
|
|
|
|
|
Hi,
your code doesn't need optimizing; it is wrong, and it needs a make-over.
As it is, everything runs on the main thread, a big loop gets started by pressing a button, and inside the loop all web pages get loaded using a blocking call (Stream.ReadToEnd). As a result the GUI is dead for as long as that takes. For proper GUI response, you should not have any blocking calls in an event handler!
The easiest solution would be to add one thread that handles the web stuff; in this case a BackgroundWorker would be an excellent choice: whatever you put in the DoWork handler will run on a background thread and not freeze the GUI; so put the fetch loop there. However, you are not allowed to touch GUI accesses from a different thread, and that is where ReportProgress comes in: call that method to pass results onto the ProgressChanged handler which automagically executes on the main thread (assuming it was the main thread that created the BGW to begin with).
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Thanks for that hint. I think I know what you mean and I also think my VB experience is not as good as needed to implement that
Maybe you could add one or two code snippets or functions , so that I could use them for my journey into documentation or google-ing ?
cipherwar
|
|
|
|
|
cipherwar wrote: Maybe you could add one or two code snippets
I could.
You should read up about BackgroundWorker on the reference material in MSDN, then maybe a few articles here on CodeProject.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
I got it working Thanks for helping me.
|
|
|
|
|
You're welcome.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
thanks in advance
i got this code while googled but not working , in this code its giving
errors like ManagementScope is not defined , ObjectQuery is not defined ,
I am not preferring this code, any help will be appreciated.
Imports System.Management
Public Class Form2
Private Sub Button1_Click( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs _
) Handles Button1.Click
Dim ms As New ManagementScope("\root\cimv2")
Dim oq As New ObjectQuery("Select * from Win32_Session")
Dim query As New ManagementObjectSearcher(ms, oq)
Dim queryCollection As ManagementObjectCollection = query.[Get]()
For Each mo As ManagementObject In queryCollection
If mo("LogonType").ToString().Equals("2") Then
' 2 - for logged on User
MessageBox.Show("Started Time: " + mo("StartTime").ToString)
End If
Next
End Sub
End Class
Any suggestions
SOFTDEV
Luck in life always exists in the form of an abstract class that cannot be instantiated directly and needs to be inherited by hard work and dedication.
modified on Monday, March 28, 2011 5:29 AM
|
|
|
|
|
S0FTDEV wrote: i got this code while googled but not working
Yes; Google for working code or try to point out what isn't working
I are Troll
|
|
|
|
|
Nopes ,Need directions/hints/any material which can help me in this regards. i don't like copy paste, just posted for reference
SOFTDEV
Luck in life always exists in the form of an abstract class that cannot be instantiated directly and needs to be inherited by hard work and dedication.
|
|
|
|
|
S0FTDEV wrote: ,Need directions/hints/any material which can help me in this regards.
Like Eddy said, explain what is not working; nobody can guess what is happening on your PC.
|
|
|
|
|
I am not preferring this code, any help will be appreciated. i need any guide line so i can get
User Login and out time.
SOFTDEV
Luck in life always exists in the form of an abstract class that cannot be instantiated directly and needs to be inherited by hard work and dedication.
|
|
|
|
|
S0FTDEV wrote: i need any guide line so i can get User Login and out time.
Asking for help begins with "I tried X and it did Y instead of Z, where am I going wrong?". Try to explain what functionality you're after, as opposed to dropping a snippet with your needs.
Is your computer in a domain (validating your credentials against some Windows Server) or on a workgroup? (local credentials)
Write a console-app that gets launched when the user logs in (put a link in the startup folder). You could keep it running, doing nothing, and write down the time again when Windows closes your application (on shutdown, Windows informs your app why it's being closed)
I'm not sure whether the Active Directory keeps this information around, but the above should work under all circumstances.
I are Troll
|
|
|
|
|
Please read the question i mentioned i googled and code is also there that what problem is in it.
SOFTDEV
Luck in life always exists in the form of an abstract class that cannot be instantiated directly and needs to be inherited by hard work and dedication.
|
|
|
|
|
I have also posted a possible solution to the stated problem. Didn't it work?
I are Troll
|
|
|
|
|
hi plz i have function but i d'ont know declared on program vb.net
function .math
Please help me because I am in very big trouble and I need to have this day
its simple function of diagramme rayonnement
|
|
|
|
|
imen532 wrote: hi plz i have function but i d'ont know declared on program vb.net function .math
Using the functions of the Math class[^]; there's examples on the bottom of that page.
imen532 wrote: Please help me because
You'd get more reactions if you started a new thread, and formulated a specific question on what you want help with ("Math" is a bit general)
imen532 wrote: and I need to have this day
Wrong deadline, especially at this price.
I are Troll
|
|
|
|
|
S0FTDEV wrote: ... an abstract class that cannot be instantiated directly and needs to be inherited by hard work and dedication.
I haven't seen much of your dedication yet. Most of the time your message boils down to:
"I found this code. It does not work. Help!"
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Thanks for the reply , actually i did this for the first time not most of the time
SOFTDEV
Luck in life always exists in the form of an abstract class that cannot be instantiated directly and needs to be inherited by hard work and dedication.
|
|
|
|
|
I admit there have been times you did not even find code.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
, so you are admitting that i put it for the first time , so from where your 1st statement came :P
SOFTDEV
Luck in life always exists in the form of an abstract class that cannot be instantiated directly and needs to be inherited by hard work and dedication.
|
|
|
|
|
Did i asked for code ever ,,,, MVP
SOFTDEV
Luck in life always exists in the form of an abstract class that cannot be instantiated directly and needs to be inherited by hard work and dedication.
|
|
|
|
|
It often is not clear what you want. You seem to have an idea or a need, don't provide much information, don't tell what you have tried nor what exact problem you encountered, and sometimes you don't even ask a question at all.
example 1[^] example 2[^] example 3[^]
I suggest you improve your enquiring style and show more of what you tried, it will result in more, better, and sooner answers.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
lol, i will try to improve
SOFTDEV
Luck in life always exists in the form of an abstract class that cannot be instantiated directly and needs to be inherited by hard work and dedication.
|
|
|
|