G
Guest
i need help to translate this code C++ TO C# FWP30.DLL is printer driver
DWORD WINAPI PrintProc( LPVOID pParams
LOGFONT lf
lf.lfHeight = 36
lf.lfWidth = 0
lf.lfEscapement = 0
lf.lfOrientation = 0
lf.lfWeight = FW_BOLD
lf.lfItalic = FALSE
lf.lfUnderline = FALSE
lf.lfStrikeOut = 0
lf.lfCharSet = ANSI_CHARSET
lf.lfOutPrecision = OUT_DEFAULT_PRECIS
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS
lf.lfQuality = DEFAULT_QUALITY
lf.lfPitchAndFamily = DEFAULT_PITCH | FF_SWISS
_tcscpy( lf.lfFaceName, _T( "Arial" ) )
// Initialize printin
DOCINFO di
di.cbSize = sizeof( DOCINFO )
di.fwType = 0
di.lpszDocName = _T( "Doc" )
di.lpszDatatype = 0
di.lpszOutput = NULL
DEVMODE dm
HDC hDC = CreateDC( _T( "FWP30.DLL" ), NULL, TEXT( "COM1:" ), &dm ); // Context yaratıyor.
// Set header form of
BYTE tmp = 0;
ExtEscape( hDC, HOF_MODIFY, 1, ( const char * )&tmp, 0, NULL )
StartDoc( hDC, &di )
StartPage( hDC );
HFONT hFont = CreateFontIndirect( &lf )
HFONT hOldFont = ( HFONT )SelectObject( hDC, hFont )
DeleteObject( hFont )
DeleteObject( hOldFont )
RECT rect = { 10, 10, 600, 40 }
DrawText( hDC, _T( "Offense # 0023JL4NP" ), -1, &rect, DT_SINGLELINE | DT_NOCLIP )
rect.top += 220
DrawText( hDC, _T( "Violation: Illegal Parking" ), -1, &rect, DT_SINGLELINE | DT_NOCLIP | DT_EXPANDTABS )
rect.top += 40
DrawText( hDC, _T( "FINE £70" ), -1, &rect, DT_SINGLELINE | DT_NOCLIP | DT_EXPANDTABS )
lf.lfHeight = 26
hFont = CreateFontIndirect( &lf )
hOldFont = ( HFONT )SelectObject( hDC, hFont )
DeleteObject( hFont )
DeleteObject( hOldFont )
rect.top -= 220;
DrawText( hDC, _T( "Time 12.34" ), -1, &rect, DT_SINGLELINE | DT_NOCLIP | DT_EXPANDTABS )
rect.left += 300
DrawText( hDC, _T( "Date 25/03/2004" ), -1, &rect, DT_SINGLELINE | DT_NOCLIP | DT_EXPANDTABS )
rect.left -= 300
rect.top += 30
DrawText( hDC, _T( "Officer PO304044" ), -1, &rect, DT_SINGLELINE | DT_NOCLIP | DT_EXPANDTABS )
rect.top += 30
DrawText( hDC, _T( "Location Main High Street" ), -1, &rect, DT_SINGLELINE | DT_NOCLIP | DT_EXPANDTABS )
rect.top += 30
DrawText( hDC, _T( "Meter Number N/A" ), -1, &rect, DT_SINGLELINE | DT_NOCLIP | DT_EXPANDTABS )
rect.top += 30
DrawText( hDC, _T( "Check Code IGCILP523" ), -1, &rect, DT_SINGLELINE | DT_NOCLIP | DT_EXPANDTABS )
rect.top += 250
DrawText( hDC, _T( "Registration AA05 ABC" ), -1, &rect, DT_SINGLELINE | DT_NOCLIP | DT_EXPANDTABS )
rect.top += 30
DrawText( hDC, _T( "Make Peugeot" ), -1, &rect, DT_SINGLELINE | DT_NOCLIP | DT_EXPANDTABS )
rect.top += 30
DrawText( hDC, _T( "Model 206" ), -1, &rect, DT_SINGLELINE | DT_NOCLIP | DT_EXPANDTABS )
rect.top += 30
DrawText( hDC, _T( "Colour Blue" ), -1, &rect, DT_SINGLELINE | DT_NOCLIP | DT_EXPANDTABS )
rect.top += 30
DrawText( hDC, _T( "Ticket Code TCKTCD0024" ), -1, &rect, DT_SINGLELINE | DT_NOCLIP | DT_EXPANDTABS )
// Close down printin
EndPage( hDC )
EndDoc( hDC );
DeleteDC( hDC )
HWND* phWnd = ( HWND* )pParams
:ostMessage( *phWnd, WM_PRINT_END, 0, 0 )
Sleep( 2000 )
return 0
}
DWORD WINAPI PrintProc( LPVOID pParams
LOGFONT lf
lf.lfHeight = 36
lf.lfWidth = 0
lf.lfEscapement = 0
lf.lfOrientation = 0
lf.lfWeight = FW_BOLD
lf.lfItalic = FALSE
lf.lfUnderline = FALSE
lf.lfStrikeOut = 0
lf.lfCharSet = ANSI_CHARSET
lf.lfOutPrecision = OUT_DEFAULT_PRECIS
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS
lf.lfQuality = DEFAULT_QUALITY
lf.lfPitchAndFamily = DEFAULT_PITCH | FF_SWISS
_tcscpy( lf.lfFaceName, _T( "Arial" ) )
// Initialize printin
DOCINFO di
di.cbSize = sizeof( DOCINFO )
di.fwType = 0
di.lpszDocName = _T( "Doc" )
di.lpszDatatype = 0
di.lpszOutput = NULL
DEVMODE dm
HDC hDC = CreateDC( _T( "FWP30.DLL" ), NULL, TEXT( "COM1:" ), &dm ); // Context yaratıyor.
// Set header form of
BYTE tmp = 0;
ExtEscape( hDC, HOF_MODIFY, 1, ( const char * )&tmp, 0, NULL )
StartDoc( hDC, &di )
StartPage( hDC );
HFONT hFont = CreateFontIndirect( &lf )
HFONT hOldFont = ( HFONT )SelectObject( hDC, hFont )
DeleteObject( hFont )
DeleteObject( hOldFont )
RECT rect = { 10, 10, 600, 40 }
DrawText( hDC, _T( "Offense # 0023JL4NP" ), -1, &rect, DT_SINGLELINE | DT_NOCLIP )
rect.top += 220
DrawText( hDC, _T( "Violation: Illegal Parking" ), -1, &rect, DT_SINGLELINE | DT_NOCLIP | DT_EXPANDTABS )
rect.top += 40
DrawText( hDC, _T( "FINE £70" ), -1, &rect, DT_SINGLELINE | DT_NOCLIP | DT_EXPANDTABS )
lf.lfHeight = 26
hFont = CreateFontIndirect( &lf )
hOldFont = ( HFONT )SelectObject( hDC, hFont )
DeleteObject( hFont )
DeleteObject( hOldFont )
rect.top -= 220;
DrawText( hDC, _T( "Time 12.34" ), -1, &rect, DT_SINGLELINE | DT_NOCLIP | DT_EXPANDTABS )
rect.left += 300
DrawText( hDC, _T( "Date 25/03/2004" ), -1, &rect, DT_SINGLELINE | DT_NOCLIP | DT_EXPANDTABS )
rect.left -= 300
rect.top += 30
DrawText( hDC, _T( "Officer PO304044" ), -1, &rect, DT_SINGLELINE | DT_NOCLIP | DT_EXPANDTABS )
rect.top += 30
DrawText( hDC, _T( "Location Main High Street" ), -1, &rect, DT_SINGLELINE | DT_NOCLIP | DT_EXPANDTABS )
rect.top += 30
DrawText( hDC, _T( "Meter Number N/A" ), -1, &rect, DT_SINGLELINE | DT_NOCLIP | DT_EXPANDTABS )
rect.top += 30
DrawText( hDC, _T( "Check Code IGCILP523" ), -1, &rect, DT_SINGLELINE | DT_NOCLIP | DT_EXPANDTABS )
rect.top += 250
DrawText( hDC, _T( "Registration AA05 ABC" ), -1, &rect, DT_SINGLELINE | DT_NOCLIP | DT_EXPANDTABS )
rect.top += 30
DrawText( hDC, _T( "Make Peugeot" ), -1, &rect, DT_SINGLELINE | DT_NOCLIP | DT_EXPANDTABS )
rect.top += 30
DrawText( hDC, _T( "Model 206" ), -1, &rect, DT_SINGLELINE | DT_NOCLIP | DT_EXPANDTABS )
rect.top += 30
DrawText( hDC, _T( "Colour Blue" ), -1, &rect, DT_SINGLELINE | DT_NOCLIP | DT_EXPANDTABS )
rect.top += 30
DrawText( hDC, _T( "Ticket Code TCKTCD0024" ), -1, &rect, DT_SINGLELINE | DT_NOCLIP | DT_EXPANDTABS )
// Close down printin
EndPage( hDC )
EndDoc( hDC );
DeleteDC( hDC )
HWND* phWnd = ( HWND* )pParams
:ostMessage( *phWnd, WM_PRINT_END, 0, 0 )
Sleep( 2000 )
return 0
}