C++代码转为C#
At offset 24 (0x18) after the end of the DEVMODE structure, there is a byte that directly controls this setting.
So, you need only punch the right value into the right place, at the right time. You'll want to make the change to the application-global DEVMODE right before printing. I decided to put it in the easily-accessible OnPreparePrinting function of my View class.
主要是这句:
PBYTE pbDriverData= (PBYTE)(((BYTE *)pDM)+(pDM->dmSize));
So, you need only punch the right value into the right place, at the right time. You'll want to make the change to the application-global DEVMODE right before printing. I decided to put it in the easily-accessible OnPreparePrinting function of my View class.
BOOL CMyView::OnPreparePrinting(CPrintInfo* pInfo)
{
PRINTDLG rPD;
BOOL fRet= AfxGetApp()->GetPrinterDeviceDefaults( &rPD );
LPDEVMODE pDM= (LPDEVMODE)::GlobalLock( rPD.hDevMode );
PBYTE pbDriverData= (PBYTE)(((BYTE *)pDM)+(pDM->dmSize));// right after the end
pbDriverData[24]= 2; // set to 4-up (1=2-up, 3=6-up, etc.)
::GlobalUnlock( rPD.hDevMode );
// default handling (as added by the ClassWizard)
return( DoPreparePrinting(pInfo) );
}主要是这句:
PBYTE pbDriverData= (PBYTE)(((BYTE *)pDM)+(pDM->dmSize));
...全文
相关推荐
C++程序员快速转向C#开发.doc
C++程序员快速转向C#开发时,可以参考这个文档,快速学习异同点。
C++ 与 C# 代码互相调用
C++ 和 C# 代码的互相调用为软件开发带来了更多的灵活性和功能扩展性,通过多种方式如动态链接库、COM 组件、C++/CLI 以及代理存根机制等,可以根据不同的应用场景和需求实现两者之间有效的交互。然而,在实现互调的过程中,也面临着诸多挑战,包括数据类型转换、内存管理、调试困难以及性能优化等方面的问题,需要开发者充分了解两种语言的特点、互调机制的原理以及相关的工具和技术,才能顺利地完成跨语言的代码集成,开发出高质量、高性能的软件系统。
c#调用c++库函数参数类型转换.docx
c#调用c++库函数参数类型转换.docx
dll.rar_Java 生成dll_Java程序转为c#调用时需要的dll包_jdk 生成 dll
Java程序生成dll,c#调用时需要的dll动态库,ikvm库 非常好用
csv.rar_C csv_C# csv_File Operate csv_c++ csv_读取文件
csv文件的读取 csv文件显示到clistctrl控件 循环读取



