001
29.05.2003, 02:33 Uhr
~lucky
Gast
|
Hi Villeicht hilft dir das...
C++: |
#include <windows.h>
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { WNDCLASS WndClass;
WndClass.style=0; WndClass.cbClsExtra=0; WndClass.cbWndExtra=0; WndClass.lpfnWndProc=WndProc; WndClass.hInstance=hInstance; WndClass.hbrBackground=(HBRUSH) (COLOR_WINDOW+1); WndClass.hCursor=LoadCursor(NULL,IDC_ARROW); WndClass.hIcon=LoadIcon(NULL,IDI_APPLICATION); WndClass.lpszMenuName=0; WndClass.lpszClassName="Winprog";
RegisterClass(&WndClass);
HWND hWindow, hButton; hWindow=CreateWindow("WinProg","Fenster", WS_OVERLAPPEDWINDOW,0,0,400, 400,NULL,NULL,hInstance,NULL);
hButton=CreateWindow("BUTTON","Drucken", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,10,340,140, 20,hWindow, (HMENU) 1,hInstance,NULL);
ShowWindow (hWindow,nCmdShow);
UpdateWindow(hWindow);
MSG Message;
while (GetMessage(&Message,NULL,0,0)) {
DispatchMessage(&Message);
}
return (Message.wParam);
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT uiMessage, WPARAM wParam, LPARAM lParam) {
switch(uiMessage) {
case WM_COMMAND: if(HIWORD(wParam)==BN_CLICKED) { if(LOWORD(wParam)==1) { PRINTDLG pd; ZeroMemory(&pd, sizeof(PRINTDLG)); pd.lStructSize=sizeof(PRINTDLG); pd.hwndOwner=hWnd; pd.hDevMode=NULL; pd.hDevNames=NULL; pd.Flags=PD_USEDEVMODECOPIESANDCOLLATE | PD_RETURN_DC; pd.nCopies=1; pd.nFromPage=0xFFFF; pd.nToPage=0xFFFF; pd.nMinPage=1; pd.nMaxPage=0xFFFF;
if(PrintDlg(&pd)==true) { MessageBox(hWnd,"richtig","richtig",MB_OK); }
DOCINFO di; di.cbSize=sizeof(DOCINFO); di.lpszDocName="Bitmap Printind Test"; di.lpszOutput=(LPTSTR) NULL; di.fwType=0; StartDoc(pd.hDC, &di); StartPage(pd.hDC);
TextOut(pd.hDC,10,10,"Drucker",lstrlen("Drucker"));
EndPage(pd.hDC); EndDoc(pd.hDC); DeleteDC(pd.hDC); } }
return 0;
case WM_DESTROY: PostQuitMessage(0); return 0; default: return DefWindowProc(hWnd,uiMessage,wParam,lParam);
} }
|
Bearbeitung von Pablo: |
CPP TAG GESETZT!!!!
|
Dieser Post wurde am 02.04.2004 um 19:41 Uhr von Pablo editiert. |