您的位置:首页 > 其它

大法师广泛的

2016-04-14 21:01 337 查看
Matlab读文件        数字图像处理

参考

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);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: