| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 820 人关注过本帖
标题:[求助]可视化程序
只看楼主 加入收藏
comeyiyi
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2007-3-1
收藏
 问题点数:0 回复次数:6 
[求助]可视化程序
用c不是c++可以编出像windows自带的计算器那样的可视化程序吗?
要用到什么软件?
在哪里下载
大侠帮忙呀!
谢了
搜索更多相关主题的帖子: 可视化 
2007-03-02 11:33
福尔摩斯
Rank: 5Rank: 5
等 级:贵宾
威 望:12
帖 子:4011
专家分:370
注 册:2006-8-15
收藏
得分:0 
你到微软 下载directx SDK

在windows下的图形和音频基本上是通过它来完成的

自我放逐。。。
2007-03-02 12:06
comeyiyi
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2007-3-1
收藏
得分:0 
大侠 还是不懂呀
我就一初学者,大侠可以说的清楚点吗?
怎么才能编出来呢?要看哪方面的书,还有需要什么软件?
谢了呀
2007-03-02 13:06
xu2000
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:51
帖 子:3890
专家分:56
注 册:2006-4-8
收藏
得分:0 
#include <windows.h>

LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,

PSTR szCmdLine, int iCmdShow)

{

static TCHAR szAppName[] = TEXT ("HexCalc") ;

HWND hwnd ;

MSG msg ;

WNDCLASS wndclass ;



wndclass.style = CS_HREDRAW | CS_VREDRAW;

wndclass.lpfnWndProc = WndProc ;

wndclass.cbClsExtra = 0 ;

wndclass.cbWndExtra = DLGWINDOWEXTRA ; // Note!

wndclass.hInstance = hInstance ;

wndclass.hIcon = LoadIcon (hInstance, szAppName) ;

wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;

wndclass.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1) ;

wndclass.lpszMenuName = NULL ;

wndclass.lpszClassName = szAppName ;



if (!RegisterClass (&wndclass))

{

MessageBox ( NULL, TEXT ("This program requires Windows NT!"),

szAppName, MB_ICONERROR) ;

return 0 ;

}



hwnd = CreateDialog (hInstance, szAppName, 0, NULL) ;

ShowWindow (hwnd, iCmdShow) ;

while (GetMessage (&msg, NULL, 0, 0))

{

TranslateMessage (&msg) ;

DispatchMessage (&msg) ;

}

return msg.wParam ;

}


void ShowNumber (HWND hwnd, UINT iNumber)

{

TCHAR szBuffer[20] ;

wsprintf (szBuffer, TEXT ("%X"), iNumber) ;

SetDlgItemText (hwnd, VK_ESCAPE, szBuffer) ;

}


DWORD CalcIt (UINT iFirstNum, int iOperation, UINT iNum)

{

switch (iOperation)

{

case '=': return iNum ;

case '+': return iFirstNum + iNum ;

case '-': return iFirstNum - iNum ;

case '*': return iFirstNum * iNum ;

case '&': return iFirstNum & iNum ;

case '|': return iFirstNum | iNum ;

case '^': return iFirstNum ^ iNum ;

case '<': return iFirstNum << iNum ;

case '>': return iFirstNum >> iNum ;

case '/': return iNum ? iFirstNum / iNum: MAXDWORD ;

case '%': return iNum ? iFirstNum % iNum: MAXDWORD ;

default : return 0 ;

}

}


LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam,LPARAM lParam)

{

static BOOL bNewNumber = TRUE ;

static int iOperation = '=' ;

static UINT iNumber, iFirstNum ;

HWND hButton ;



switch (message)

{

case WM_KEYDOWN: // left arrow --> backspace

if (wParam != VK_LEFT)

break ;

wParam = VK_BACK ;

// fall through

case WM_CHAR:

if ((wParam = (WPARAM) CharUpper ((TCHAR *) wParam)) == VK_RETURN)

wParam = '=' ;



if (hButton = GetDlgItem (hwnd, wParam))

{

SendMessage (hButton, BM_SETSTATE, 1, 0) ;

Sleep (100) ;

SendMessage (hButton, BM_SETSTATE, 0, 0) ;

}

else

{

MessageBeep (0) ;

break ;

}

// fall through

case WM_COMMAND:

SetFocus (hwnd) ;



if (LOWORD (wParam) == VK_BACK) //backspace

ShowNumber (hwnd, iNumber /= 16) ;



else if (LOWORD (wParam) == VK_ESCAPE) // escape

ShowNumber (hwnd, iNumber = 0) ;



else if (isxdigit (LOWORD (wParam))) // hex digit

{

if (bNewNumber)

{

iFirstNum = iNumber ;

iNumber = 0 ;

}

bNewNumber = FALSE ;

if (iNumber <= MAXDWORD >> 4)

ShowNumber (hwnd, iNumber = 16 * iNumber + wParam -

(isdigit (wParam) ? '0': 'A' - 10)) ;

else

MessageBeep (0) ;

}

else // operation

{

if (!bNewNumber)

ShowNumber (hwnd, iNumber =

CalcIt (iFirstNum, iOperation, iNumber)) ;

bNewNumber = TRUE ;

iOperation = LOWORD (wParam) ;

}

return 0 ;

case WM_DESTROY:

PostQuitMessage (0) ;

return 0 ;

}

return DefWindowProc (hwnd, message, wParam, lParam) ;

}

HEXCALC.RC (摘录)

//Microsoft Developer Studio generated resource script.

#include "resource.h"

#include "afxres.h"

/////////////////////////////////////////////////////////////////////////////

// Icon

HEXCALC ICON DISCARDABLE "HexCalc.ico"


/////////////////////////////////////////////////////////////////////////////


#include "hexcalc.dlg"

HEXCALC.DLG

/*--------------------------------

HEXCALC.DLG dialog script

----------------------------------*/

HexCalc DIALOG -1, -1, 102, 122

STYLE WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX

CLASS "HexCalc"

CAPTION "Hex Calculator"

{

PUSHBUTTON "D", 68, 8, 24, 14, 14

PUSHBUTTON "A", 65, 8, 40, 14, 14

PUSHBUTTON "7", 55, 8, 56, 14, 14

PUSHBUTTON "4", 52, 8, 72, 14, 14

PUSHBUTTON "1", 49, 8, 88, 14, 14

PUSHBUTTON "0", 48, 8, 104,14, 14

PUSHBUTTON "0", 27, 26, 4, 50, 14

PUSHBUTTON "E", 69, 26, 24, 14, 14

PUSHBUTTON "B", 66, 26, 40, 14, 14

PUSHBUTTON "8", 56, 26, 56, 14, 14

PUSHBUTTON "5", 53, 26, 72, 14, 14

PUSHBUTTON "2", 50, 26, 88, 14, 14

PUSHBUTTON "Back", 8, 26, 104,32, 14

PUSHBUTTON "C", 67, 44, 40, 14, 14

PUSHBUTTON "F", 70, 44, 24, 14, 14

PUSHBUTTON "9", 57, 44, 56, 14, 14

PUSHBUTTON "6", 54, 44, 72, 14, 14

PUSHBUTTON "3", 51, 44, 88, 14, 14

PUSHBUTTON "+", 43, 62, 24, 14, 14

PUSHBUTTON "-", 45, 62, 40, 14, 14

PUSHBUTTON "*", 42, 62, 56, 14, 14

PUSHBUTTON "/", 47, 62, 72, 14, 14

PUSHBUTTON "%", 37, 62, 88, 14, 14

PUSHBUTTON "Equals", 61, 62, 104,32, 14

PUSHBUTTON "&&",38, 80, 24, 14, 14

PUSHBUTTON "|", 124, 80, 40, 14, 14

PUSHBUTTON "^", 94, 80, 56, 14, 14

PUSHBUTTON "<", 60, 80, 72, 14, 14

PUSHBUTTON ">", 62, 80, 88, 14, 14

}


我会拿出我全部的钱财,以保你衣食无忧。我会献出我所有的智慧,以助你一帆风顺。我会想到所有的笑语,以令你展眉开颜。我会挤出最长的时间,以使你终生幸福。        [本人原创的结婚宣言]
2007-03-02 13:15
yangxu0703
Rank: 1
等 级:新手上路
帖 子:61
专家分:0
注 册:2007-1-15
收藏
得分:0 
太厉害了!
2007-03-03 11:28
ChenMo
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:3
帖 子:481
专家分:10
注 册:2004-4-8
收藏
得分:0 

要使用 DirectX SDK 编写高性能的多媒体或游戏程序,最好先学学 COM(组建对象模型)。


欢迎加入 MVC 技术讨论群(新群:90093426)
2007-03-03 13:22
comeyiyi
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2007-3-1
收藏
得分:0 

谢过了

2007-03-03 20:12
快速回复:[求助]可视化程序
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.048493 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved