大法师广泛的
2016-04-14 21:01
337 查看
Matlab读文件 数字图像处理
参考
一个简单的Visual C++窗口程序:
参考
import java.io.*; import java.net.URL; public class Love { public static void main(String[] args) throws IOException{ // TODO Auto-generated method stub System.out.println("Hello World!"); String fileName = "secLZW.zip"; //The file that will be saved on your computer URL link = new URL(" http://www.hooklee.com/Papers/ICME2011_SecLZW.zip"); //The file that you want to download //Code to download InputStream in = new BufferedInputStream(link.openStream()); ByteArrayOutputStream out = new ByteArrayOutputStream(); byte[] buf = new byte[1024]; int n = 0; while (-1!=(n=in.read(buf))) { out.write(buf, 0, n); } out.close(); in.close(); byte[] response = out.toByteArray(); FileOutputStream fos = new FileOutputStream(fileName); fos.write(response); fos.close(); //End download code System.out.println("Finished"); } }
一个简单的Visual C++窗口程序:
#include <Windows.h> #include <tchar.h> LRESULT CALLBACK WindowProc(HWND hWND, UINT message, WPARAM wParam, LPARAM lParam); #define WC WindowClass int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { WNDCLASSEX WindowClass; static LPCTSTR szAppName{ _T("OFWin") }; HWND hWnd; MSG msg; WindowClass.cbSize = sizeof(WNDCLASSEX); WindowClass.style = CS_HREDRAW | CS_VREDRAW; WindowClass.lpfnWndProc = WindowProc; WindowClass.cbClsExtra = 0; WindowClass.cbWndExtra = 0; WindowClass.hInstance = hInstance; WindowClass.hIcon = LoadIcon(nullptr, IDI_APPLICATION); WindowClass.hCursor = LoadCursor(nullptr, IDC_ARROW); WindowClass.hbrBackground = static_cast<HBRUSH>(GetStockObject(GRAY_BRUSH)); WC.lpszMenuName = nullptr; WC.lpszClassName = szAppName; WC.hIconSm = nullptr; RegisterClassEx(&WC); hWnd = CreateWindow(szAppName, _T("A Basic Window the Hard Way"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, nullptr, nullptr, hInstance, nullptr); ShowWindow(hWnd, nCmdShow); UpdateWindow(hWnd); while (GetMessage(&msg, nullptr, 0, 0) == TRUE) { TranslateMessage(&msg); DispatchMessage(&msg); } return static_cast<int>(msg.wParam); } LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_PAINT: HDC hDC; PAINTSTRUCT PaintSt; RECT aRect; hDC = BeginPaint(hWnd, &PaintSt); GetClientRect(hWnd, &aRect); SetBkMode(hDC, TRANSPARENT); DrawText(hDC, _T("But, soft! What light breaks,sadf,asdf?"), -1, &aRect, DT_SINGLELINE | DT_CENTER | DT_VCENTER); EndPaint(hWnd, &PaintSt); return 0; case WM_LBUTTONDOWN: MessageBox(NULL, LPCWSTR(L"Left Button Pressed"), LPCWSTR(L"Caption"), MB_ICONWARNING | MB_DEFBUTTON2); return 0; case WM_RBUTTONDOWN: MessageBox(NULL, LPCWSTR(L"Right Button Pressed"), LPCWSTR(L"Right Caption"), MB_ICONWARNING | MB_DEFBUTTON2); return 0; case WM_MBUTTONDOWN: MessageBox(NULL, LPCWSTR(L"Middle Button Pressed"), LPCWSTR(L"Right Caption"), MB_ICONWARNING | MB_DEFBUTTON2); return 0; case WM_DESTROY: PostQuitMessage(0); return 0; } return DefWindowProc(hWnd, message, wParam, lParam); }
相关文章推荐
- iOS企业开发In House ipa发布流程
- 深入学习java虚拟机(一)
- Logback 学习笔记
- 设计模式:抽象工厂模式(Abstract Factory)
- 方法参数是值传递
- 文件的随机访问与多文件项目
- leetcode110题 题解 翻译 C语言版 Python版
- input placeholder属性IE、360浏览器兼容性问题
- Java程序生成linechart report的方法
- H3C VRRP
- iPhone和iPad开发图标基本知识
- Http文件上传服务器端接收的数据格式
- Java中集合框架的共性功能
- HDU 4720 Naive and Silly Muggles(计算几何, 求三角形外心)
- JAVA实验三 抽象类的继承和接口的实现 (多态)
- linux基础学习之 grep总结
- 64位UBUNTU 下安装和配置使用python的spark
- 第四次作业
- hdu 2602(01背包)
- eclipse快捷键