Wine >> C/C++ >> Dialog >> Common Dialog
PageSetup
參考資訊:
1. win32
2. petzold
3. tutorial
4. examples_win32
main.c
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <windows.h> int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { PAGESETUPDLG dlg = {0}; dlg.lStructSize = sizeof(PAGESETUPDLG); if (PageSetupDlg(&dlg)) { char buf[255] = {0}; sprintf(buf, "printer:%s", *((char**)dlg.hDevMode)); MessageBox(NULL, buf, "main", MB_OK); } ExitProcess(0); return 0; }
編譯、執行
$ sudo apt-get install cups-pdf -y $ winegcc main.c -o main -lcomdlg32 $ wine ./main.exe
P.S. 如果沒有安裝cups-pdf,wine會顯示no default printer defined