Torna indietro   Hardware Upgrade Forum > Software > Programmazione

Sony WF-1000X M6: le cuffie in-ear di riferimento migliorano ancora
Sony WF-1000X M6: le cuffie in-ear di riferimento migliorano ancora
WF-1000X M6 è la sesta generazione di auricolare in-ear sviluppata da Sony, un prodotto che punta a coniugare facilità di utilizzo con una elevata qualità di riproduzione dei contenuti audio e una cura nella riduzione del rumore ambientale che sia da riferimento
Snowflake porta l'IA dove sono i dati, anche grazie a un accordo con OpenAI
Snowflake porta l'IA dove sono i dati, anche grazie a un accordo con OpenAI
Snowflake ha presentato diverse novità per la sua piattaforma legate all'intelligenza artificiale. Quella forse più eclatante è una collaborazione con OpenAI, ma non mancano diverse nuove funzionalità che rendono la piattaforma più flessibile e in grado di rispondere meglio alle esigenze in continuo cambiamento delle aziende
Sistema Mesh Roamii BE Pro: il Wi-Fi 7 secondo MSI
Sistema Mesh Roamii BE Pro: il Wi-Fi 7 secondo MSI
Con velocità teoriche fino a 11 Gbps, gestione tramite app intelligente e protezione avanzata dei dispositivi, Roamii BE Pro porta il Wi‑Fi 7 tri‑band nelle abitazioni più esigenti. Un sistema Wi-Fi Mesh proposto da MSI allo scopo di garantire agli utenti una rete fluida e continua capace di sostenere streaming 8K, gaming competitivo e le applicazioni moderne più esigenti in termini di banda
Tutti gli articoli Tutte le news

Vai al Forum
Rispondi
 
Strumenti
Old 13-07-2003, 13:09   #1
uMoR
Registered User
 
Iscritto dal: Aug 2002
Messaggi: 274
[vb] intercettare stampe

devo fare un codicino che mi intercetta le stampe effettuate e in particolar modo il numero dei fogli stampati..
come posso fare ?
uMoR è offline   Rispondi citando il messaggio o parte di esso
Old 13-07-2003, 21:40   #2
tas
Senior Member
 
L'Avatar di tas
 
Iscritto dal: Feb 2001
Città: Nordest
Messaggi: 217
Ma dentro ad un particolare software oppure quando lanci una stampa da una qualsiasi applicazione?

Nel primo caso basta analizzare la struttura DEVMODE. Ti riporto un pezzo di codice di una library che ho scritto per le mia applicazioni:
Codice:
Dim lppd As PRINTDLG
Dim dm As DEVMODE
Dim lpdm As Long
Dim ret As Long
Dim copies As Integer

lppd.Flags = PD_RETURNDEFAULT Or PD_RETURNDC
lppd.lStructSize = Len(lppd)

ret = api_PrintDlg(lppd)
m_hdevmode = lppd.hDevMode

lpdm = api_GlobalLock(m_hdevmode)
api_CopyMemory dm, lpdm, Len(dm)
api_GlobalUnlock m_hdevmode

copies = dm.dmCopies
PRINTDLG, DEVMODE, i flags, PrintDlg, GlobalLock, CopyMemory, GlobalUnlock li trovi nel visualizzatore API di VB6.


Se invece devi intercettare questo dato per tutte le applicazioni, presumo sia necessario attivare un hook al sistema, ma non ho la più pallida idea di come fare.
__________________
Chi non cerca trova.
tas è offline   Rispondi citando il messaggio o parte di esso
Old 13-07-2003, 22:48   #3
uMoR
Registered User
 
Iscritto dal: Aug 2002
Messaggi: 274
per tutte le applicazioni
uMoR è offline   Rispondi citando il messaggio o parte di esso
Old 14-07-2003, 05:42   #4
matpez
Senior Member
 
L'Avatar di matpez
 
Iscritto dal: Aug 2002
Città: Biella
Messaggi: 1882
Mi sa che ci vuole un hook allo spoiler di stampa, cosi in qlk modo riusciresti a leggere il numero di documenti in coda i sapere il numero...solo che nn ho la + pallida idea di come si faccia
matpez è offline   Rispondi citando il messaggio o parte di esso
Old 14-07-2003, 05:53   #5
matpez
Senior Member
 
L'Avatar di matpez
 
Iscritto dal: Aug 2002
Città: Biella
Messaggi: 1882
Guarda questo codice, ora è un po' presto al mattimo (5.50) per mettermi a ragionare, ma cmq dai parametri nn sembra male:

Codice:
Private Const CCHDEVICENAME = 32
Private Const CCHFORMNAME = 32

Private Type DEVMODE
    dmDeviceName As String * CCHDEVICENAME
    dmSpecVersion As Integer
    dmDriverVersion As Integer
    dmSize As Integer
    dmDriverExtra As Integer
    dmFields As Long
    dmOrientation As Integer
    dmPaperSize As Integer
    dmPaperLength As Integer
    dmPaperWidth As Integer
    dmScale As Integer
    dmCopies As Integer
    dmDefaultSource As Integer
    dmPrintQuality As Integer
    dmColor As Integer
    dmDuplex As Integer
    dmYResolution As Integer
    dmTTOption As Integer
    dmCollate As Integer
    dmFormName As String * CCHFORMNAME
    dmUnusedPadding As Integer
    dmBitsPerPel As Integer
    dmPelsWidth As Long
    dmPelsHeight As Long
    dmDisplayFlags As Long
    dmDisplayFrequency As Long
End Type

Private Type PRINTER_INFO_2
   pServerName As String
   pPrinterName As String
   pShareName As String
   pPortName As String
   pDriverName As String
   pComment As String
   pLocation As String
   pDevMode As Long
   pSepFile As String
   pPrintProcessor As String
   pDatatype As String
   pParameters As String
   pSecurityDescriptor As Long
   Attributes As Long
   Priority As Long
   DefaultPriority As Long
   StartTime As Long
   UntilTime As Long
   Status As Long
   JobsCount As Long
   AveragePPM As Long
End Type

Private Type PRINTER_DEFAULTS
  pDatatype As String
  pDevMode As DEVMODE
  DesiredAccess As Long
End Type

Public Enum Printer_Status
   PRINTER_STATUS_READY = &H0
   PRINTER_STATUS_PAUSED = &H1
   PRINTER_STATUS_ERROR = &H2
   PRINTER_STATUS_PENDING_DELETION = &H4
   PRINTER_STATUS_PAPER_JAM = &H8
   PRINTER_STATUS_PAPER_OUT = &H10
   PRINTER_STATUS_MANUAL_FEED = &H20
   PRINTER_STATUS_PAPER_PROBLEM = &H40
   PRINTER_STATUS_OFFLINE = &H80
   PRINTER_STATUS_IO_ACTIVE = &H100
   PRINTER_STATUS_BUSY = &H200
   PRINTER_STATUS_PRINTING = &H400
   PRINTER_STATUS_OUTPUT_BIN_FULL = &H800
   PRINTER_STATUS_NOT_AVAILABLE = &H1000
   PRINTER_STATUS_WAITING = &H2000
   PRINTER_STATUS_PROCESSING = &H4000
   PRINTER_STATUS_INITIALIZING = &H8000
   PRINTER_STATUS_WARMING_UP = &H10000
   PRINTER_STATUS_TONER_LOW = &H20000
   PRINTER_STATUS_NO_TONER = &H40000
   PRINTER_STATUS_PAGE_PUNT = &H80000
   PRINTER_STATUS_USER_INTERVENTION = &H100000
   PRINTER_STATUS_OUT_OF_MEMORY = &H200000
   PRINTER_STATUS_DOOR_OPEN = &H400000
   PRINTER_STATUS_SERVER_UNKNOWN = &H800000
   PRINTER_STATUS_POWER_SAVE = &H1000000
End Enum

Private Declare Function OpenPrinter Lib "winspool.drv" Alias "OpenPrinterA" (ByVal pPrinterName As String, phPrinter As Long, pDefault As PRINTER_DEFAULTS) As Long
Private Declare Function GetPrinter Lib "winspool.drv" Alias "GetPrinterA" (ByVal hPrinter As Long, ByVal Level As Long, buffer As Long, ByVal pbSize As Long, pbSizeNeeded As Long) As Long
Private Declare Function ClosePrinter Lib "winspool.drv" (ByVal hPrinter As Long) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Private Declare Function IsBadStringPtrByLong Lib "kernel32" Alias "IsBadStringPtrA" (ByVal lpsz As Long, ByVal ucchMax As Long) As Long

Public Function StringFromPointer(lpString As Long, lMaxLength As Long) As String
    Dim sRet As String
    Dim lret As Long
    If lpString = 0 Then
        StringFromPointer = ""
        Exit Function
    End If
    If IsBadStringPtrByLong(lpString, lMaxLength) Then
        ' An error has occured - do not attempt to use this pointer
        StringFromPointer = ""
        Exit Function
    End If
    ' Pre-initialise the return string...
    sRet = Space$(lMaxLength)
    CopyMemory ByVal sRet, ByVal lpString, ByVal Len(sRet)
    If Err.LastDllError = 0 Then
        If InStr(sRet, Chr$(0)) > 0 Then
            sRet = Left$(sRet, InStr(sRet, Chr$(0)) - 1)
        End If
    End If
    StringFromPointer = sRet
End Function

Private Sub Form_Load()
    Dim SizeNeeded As Long, buffer() As Long
    Dim pDef As PRINTER_DEFAULTS
    'Get a handle to the printer
    lret = OpenPrinter(Printer.DeviceName, mhPrinter, pDef)
    'Initialize the buffer
    ReDim Preserve buffer(0 To 0) As Long
    'Retrieve the required size (in bytes)
    lret = GetPrinter(mhPrinter, 2, buffer(0), UBound(buffer), SizeNeeded)
    'Resize the buffer... Note that a Long is four bytes
    ReDim Preserve buffer(0 To (SizeNeeded / 4) + 3) As Long
    'Retrieve the Printer information
    lret = GetPrinter(mhPrinter, 2, buffer(0), UBound(buffer) * 4, SizeNeeded)
    'The data stored in 'buffer' corresponds with the data of a PRINTER_INFO_2 structure
    ClosePrinter mhPrinter
    'Show the data
    PrintData "Server name", StringFromPointer(buffer(0), 255)
    PrintData "Printer name", StringFromPointer(buffer(1), 255)
    PrintData "Share name", StringFromPointer(buffer(2), 255)
    PrintData "Port name", StringFromPointer(buffer(3), 255)
    PrintData "Driver name", StringFromPointer(buffer(4), 255)
    PrintData "Comment", StringFromPointer(buffer(5), 255)
    PrintData "Location", StringFromPointer(buffer(6), 255)
    'Unload Me
End Sub

Sub PrintData(Name As String, Data As String)
    If LenB(Data) > 0 Then
        Debug.Print Name + ": " + Data
    End If
End Sub
Questo codice controllo lo stato della stampante con un foglio in stampa, perchè l'ho provato alla svelta ma nn dava in unscita nulla...oppure sono troppo rincoglionito e devo andare a nanna e pensarci dopo il riposo!!

Ciaooooooooooooooooooooooooo
matpez è offline   Rispondi citando il messaggio o parte di esso
Old 15-07-2003, 20:27   #6
uMoR
Registered User
 
Iscritto dal: Aug 2002
Messaggi: 274
uhm... io non sono riuscito a farci nulla tranne che avere il nome della stampante
uMoR è offline   Rispondi citando il messaggio o parte di esso
Old 15-07-2003, 20:35   #7
uMoR
Registered User
 
Iscritto dal: Aug 2002
Messaggi: 274
altre idee ?
uMoR è offline   Rispondi citando il messaggio o parte di esso
 Rispondi


Sony WF-1000X M6: le cuffie in-ear di riferimento migliorano ancora Sony WF-1000X M6: le cuffie in-ear di riferiment...
Snowflake porta l'IA dove sono i dati, anche grazie a un accordo con OpenAI Snowflake porta l'IA dove sono i dati, anche gra...
Sistema Mesh Roamii BE Pro: il Wi-Fi 7 secondo MSI Sistema Mesh Roamii BE Pro: il Wi-Fi 7 secondo M...
Recensione HUAWEI Mate X7: un foldable ottimo, ma restano i soliti problemi Recensione HUAWEI Mate X7: un foldable ottimo, m...
Nioh 3: souls-like punitivo e Action RPG Nioh 3: souls-like punitivo e Action RPG
Zscaler Threat Report 2026: l'adozione d...
Claude AI minaccia omicidi e ricatti qua...
Dentro la gara: a Milano Cortina 2026 i ...
Samsung Display presenta QD-OLED Penta T...
KONAMI torna con "Silent Hill: Town...
Rende il citofono smart a 44,99€: Ring I...
ThunderX3 XTC, la sedia da ufficio che s...
Mercy, Mission Impossible, Aronofsky: il...
Project Windless: il nuovo action in esc...
Saros: mostrato il gameplay del gioco de...
God of War: Sons of Sparta annunciato e ...
John Wick torna in un nuovo videogioco a...
MADE chiude il 2025 con 59 partner e 250...
007 First Light: allo State of Play un n...
Gli iPhone su Amazon costano meno che su...
Chromium
GPU-Z
OCCT
LibreOffice Portable
Opera One Portable
Opera One 106
CCleaner Portable
CCleaner Standard
Cpu-Z
Driver NVIDIA GeForce 546.65 WHQL
SmartFTP
Trillian
Google Chrome Portable
Google Chrome 120
VirtualBox
Tutti gli articoli Tutte le news Tutti i download

Strumenti

Regole
Non Puoi aprire nuove discussioni
Non Puoi rispondere ai messaggi
Non Puoi allegare file
Non Puoi modificare i tuoi messaggi

Il codice vB è On
Le Faccine sono On
Il codice [IMG] è On
Il codice HTML è Off
Vai al Forum


Tutti gli orari sono GMT +1. Ora sono le: 21:11.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Served by www3v