你可以在主程序初始化之前做一个dlg。如果返回真,直接向下运行,返回假,就可以直接退出。
至于
“1。弹出一个继承于CFrameWnd的单文档界面。
2。在菜单的文件选项中有 打印预览 打印 打印设置。点击后弹出windows公用对话框。”
MFC Wizzard可以自动生成。
画圆弧可以在OnPaint()中写,模式用ISO_TROPIC
至于
“1。弹出一个继承于CFrameWnd的单文档界面。
2。在菜单的文件选项中有 打印预览 打印 打印设置。点击后弹出windows公用对话框。”
MFC Wizzard可以自动生成。
画圆弧可以在OnPaint()中写,模式用ISO_TROPIC
2 再另做一个对话框工程
3 在单文档工程中, 加入对话框工程中的对话框类源文件.
4 在InitInstance()函数中,在建文档模板之前加入:
BOOL CXXXX::InitInstance()
{
.... CInstallDlg dlg;
m_pMainWnd = &dlg; // Add our own extra initialize code here
//////////////////////////////////////////
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
//这里做文档工程的建立
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
//这里可以退出
}
}
单文档想怎么做就怎么做
ShellExecute(NULL,"open","SID.exe",NULL,NULL,SW_NORMAL);
}ok!
我的本意是:
1。先生成一个单文档应用程序。例如show.exe (我会)
其生成的文件后缀为*.gr(这个我不会!)
2。在菜单的文件选项中有 打印预览 打印 打印设置(这个其实不成问题!)
3。在OnButton()中使用CFile file;建立文件。是使用show.exe打开的文件。(这个我也会!)
4。使用cdc画圆弧,画到文件中。(这个我不会!)
5。最后在使用WinExec("show.exe c:\\output");
这样点击button后,就调用出使用show.exe打开的output.gr文件。
其中有几步,解决不了。
希望各位帮忙!!
你在对话框的按键响应消息添加即可。
你注意掌握文档、框架和视结构就可以了
==============================
CFrameWnd* pOldFrame=(CFrameWnd*)AfxGetThread()->m_pMainWnd;
if (!m_pTemplate)
{
m_pTemplate = new CSingleDocTemplate(
IDR_MENU,
NULL,
RUNTIME_CLASS(CFrameWnd),
RUNTIME_CLASS(CYourView));
AfxGetApp()->AddDocTemplate(m_pTemplate);
}CFrameWnd * pFrameWnd = m_pTemplate->CreateNewFrame( NULL, NULL );m_pTemplate->InitialUpdateFrame( pFrameWnd, NULL);
.model flat,stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\user32.inc
includelib \masm32\lib\user32.lib ; calls to functions in user32.lib and kernel32.lib
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib WinMain proto :DWORD,:DWORD,:DWORD,:DWORD .DATA ; initialized data
ClassName db "SimpleWinClass",0 ; the name of our window class
AppName db "Our First Window",0 ; the name of our window .DATA? ; Uninitialized data
hInstance HINSTANCE ? ; Instance handle of our program
CommandLine LPSTR ?
.CODE ; Here begins our code
start:
invoke GetModuleHandle, NULL ; get the instance handle of our program.
; Under Win32, hmodule==hinstance mov hInstance,eax
mov hInstance,eax
invoke GetCommandLine ; get the command line. You don't have to call this function IF
; your program doesn't process the command line.
mov CommandLine,eax
invoke WinMain, hInstance,NULL,CommandLine, SW_SHOWDEFAULT ; call the main function
invoke ExitProcess, eax ; quit our program. The exit code is returned in eax from WinMain. WinMain proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:DWORD
LOCAL wc:WNDCLASSEX ; create local variables on stack
LOCAL msg:MSG
LOCAL hwnd:HWND mov wc.cbSize,SIZEOF WNDCLASSEX ; fill values in members of wc
mov wc.style, CS_HREDRAW or CS_VREDRAW
mov wc.lpfnWndProc, OFFSET WndProc
mov wc.cbClsExtra,NULL
mov wc.cbWndExtra,NULL
push hInstance
pop wc.hInstance
mov wc.hbrBackground,COLOR_WINDOW+1
mov wc.lpszMenuName,NULL
mov wc.lpszClassName,OFFSET ClassName
invoke LoadIcon,NULL,IDI_APPLICATION
mov wc.hIcon,eax
mov wc.hIconSm,eax
invoke LoadCursor,NULL,IDC_ARROW
mov wc.hCursor,eax
invoke RegisterClassEx, addr wc ; register our window class
invoke CreateWindowEx,NULL,\
ADDR ClassName,\
ADDR AppName,\
WS_OVERLAPPEDWINDOW,\
CW_USEDEFAULT,\
CW_USEDEFAULT,\
CW_USEDEFAULT,\
CW_USEDEFAULT,\
NULL,\
NULL,\
hInst,\
NULL
mov hwnd,eax
invoke ShowWindow, hwnd,CmdShow ; display our window on desktop
invoke UpdateWindow, hwnd ; refresh the client area .WHILE TRUE ; Enter message loop
invoke GetMessage, ADDR msg,NULL,0,0
.BREAK .IF (!eax)
invoke TranslateMessage, ADDR msg
invoke DispatchMessage, ADDR msg
.ENDW
mov eax,msg.wParam ; return exit code in eax
ret
WinMain endp WndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
.IF uMsg==WM_DESTROY ; if the user closes our window
invoke PostQuitMessage,NULL ; quit our application
.ELSE
invoke DefWindowProc,hWnd,uMsg,wParam,lParam ; Default message processing
ret
.ENDIF
xor eax,eax
ret
WndProc endp end start
可以用图元,或者对点阵还有以下办法。
创建一个内存DC
画图
用SelectObject将位图取出attach给一个CBitmap对象
用CBitmap::GetBitmap填一个BITMAP对象。
再由这个BITMAP对象取得位图格式和位数据地址,再将这些数据写入文件。