Hallo Leute,
ich versuche seit langem eine Lösung für das Auslesen des
Standarddruckers zu finden. WMI, API,
System.Drawing.Printing.PrinterSettings habe ich alles schon versucht,
leider nicht zurfrieden stellend. Hat jemand eine saubere Lösung ffür
VB.Net oder C#???
Mit der Win-API habe ich z.B. versucht GetDefaultPrinter aufzurufen,
jedoch erscheint dann immer die Meldung "Es wurde versucht, im
geschützten Speicher zu lesen oder zu schreiben. Dies ist häufig ein
Hinweis darauf, dass anderer Speicher beschädigt ist." Was soll das?
Eine Lösung für dieses Problem habe ich noch nicht gefunden.
Code:
Das kann frusten :-((
Declare Function GetDefaultPrinter Lib "winspool.drv" Alias
"GetDefaultPrinterA" (ByRef pszBuffer As String, ByRef dwLen As
Integer) As Integer
Na ja wäre jedenfalls nett, wenn jemand einen Tip hätte.
Vielen Dank 4 7819
From what I gather, if you create a PrintSettings object it will
contain the settings for the default printer. Use the PrinterName
property to get the name of the default printer.
mreisi wrote: Hallo Leute,
ich versuche seit langem eine Lösung für das Auslesen des Standarddruckers zu finden. WMI, API, System.Drawing.Printing.PrinterSettings habe ich alles schon versucht, leider nicht zurfrieden stellend. Hat jemand eine saubere Lösung ffür VB.Net oder C#??? Mit der Win-API habe ich z.B. versucht GetDefaultPrinter aufzurufen, jedoch erscheint dann immer die Meldung "Es wurde versucht, im geschützten Speicher zu lesen oder zu schreiben. Dies ist häufig ein Hinweis darauf, dass anderer Speicher beschädigt ist." Was soll das? Eine Lösung für dieses Problem habe ich noch nicht gefunden. Code: Das kann frusten :-((
Declare Function GetDefaultPrinter Lib "winspool.drv" Alias "GetDefaultPrinterA" (ByRef pszBuffer As String, ByRef dwLen As Integer) As Integer
Na ja wäre jedenfalls nett, wenn jemand einen Tip hätte.
Vielen Dank
"Göran Andersson" <gu***@guffa.com> schrieb: From what I gather, if you create a PrintSettings object it will contain the settings for the default printer. Use the PrinterName property to get the name of the default printer.
In addition, check out 'PrinterSettings.IsDefaultPrinter'.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Ja das habe ich auch schon ausprobiert, jedoch funktioniert das leider
nicht, wenn man den Standarddrucker kurz zuvor gewechselt hat. Trotzdem
Danke für den Tipp. Die MSDN sagt dazu folgendes:
"Ruft einen Wert ab, der angibt, ob die PrinterName-Eigenschaft immer
dann den Standarddrucker festlegt, wenn der Benutzer PrinterName nicht
explizit festlegt."
Das ist leider nicht wirklich die Lösung.
Ja das habe ich auch schon ausprobiert, jedoch funktioniert das leider
nicht, wenn man den Standarddrucker kurz zuvor gewechselt hat. Trotzdem
Danke für den Tipp. Die MSDN sagt dazu folgendes:
"Ruft einen Wert ab, der angibt, ob die PrinterName-Eigenschaft immer
dann den Standarddrucker festlegt, wenn der Benutzer PrinterName nicht
explizit festlegt."
Das ist leider nicht wirklich die Lösung. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: teso |
last post by:
Hallo Zusammen,
Ich suche eine Möglichkeit Internet bzw. HTML Inhalte zu vergleichen.
Mein Ansatz war den hashcode (URL.hashCode()) einer URL zu ermitteln
und diesen zu vergleichen.
Dazu habe...
|
by: Tom Vukovich |
last post by:
Hi All,
I have an application that I am porting from VB6 to VBNet and in vb6 i can detect the unloadMode. DotNet doesn't support this but I need the functionality. I understand the code should be in...
|
by: Klaus Löffelmann |
last post by:
Hello,
how can a console application get its startpath? The application-object
doesn't apply for console applications, does it?
Thanks
Klaus
|
by: SStory |
last post by:
Hi,
I am building an explorer type interface for file selection
Need to know how to determine what type of device a DRIVE is
i.e. C: (harddisk)
A: (floppy)
|
by: Giuseppe Pezzella |
last post by:
Hi
In Windows every file have yours icon, so:
how I get them ( Extension and Icon) and
save in a imageList for use later in a ListView?
In VB6 was SHGetFileInfo.
In VB.NET?
How I can...
|
by: mreisi |
last post by:
Hallo Leute,
ich habe vor kurzem schon einmal das Thema gestartet, wie man den
Standarddrucker unter .Net auslesen kann. Die API-Funktion
GetDefaultPrinter() ist mir dabei über den Weg gelaufen,...
|
by: Peter Hansch |
last post by:
Hallo,
habe ein VS02 Projekt konvertiert auf VS05. Es handelt sich um eine Klasse
zur erzeugung eines Screenshots
Dabei tritt oben genannter Fehler auf an.
Und zwar bei markierter Stelle:
...
|
by: kirstenkirsche |
last post by:
Hi guys....
i know this question has been asked already and I found a few answers but it would be soo great if anyone could help me with this script, which just browses images on a webpage in an...
|
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: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |