android post/get 请求

public class LoginServer {
/**
*get的方式请求
*@param username 用户名
*@param password 密码
*@return 返回null 登录异常
/ public static String loginByGet(String username,String password){ //get的方式提交就是url拼接的方式 String path = “http://172.16.168.111:1010/login.php?username=”+username+”&password=”+password; try { URL url = new URL(path); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setConnectTimeout(5000); connection.setRequestMethod(“GET”); //获得结果码 int responseCode = connection.getResponseCode(); if(responseCode ==200){ //请求成功 获得返回的流 InputStream is = connection.getInputStream(); return IOSUtil.inputStream2String(is); }else { //请求失败 return null; } } catch (MalformedURLException e) { e.printStackTrace(); } catch (ProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; } /* * post的方式请求
*@param username 用户名
*@param password 密码
*@return 返回null 登录异常
*/
public static String loginByPost(String username,String password){
String path = “http://172.16.168.111:1010/login.php”;
try {
URL url = new URL(path);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setConnectTimeout(5000);
connection.setRequestMethod(“POST”);

        //数据准备
        String data = "username="+username+"&password="+password;
        //至少要设置的两个请求头
        connection.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
        connection.setRequestProperty("Content-Length", data.length()+"");

        //post的方式提交实际上是留的方式提交给服务器
        connection.setDoOutput(true);
        OutputStream outputStream = connection.getOutputStream();
        outputStream.write(data.getBytes());

        //获得结果码
        int responseCode = connection.getResponseCode();
        if(responseCode ==200){
            //请求成功
            InputStream is = connection.getInputStream();
            return IOSUtil.inputStream2String(is);
        }else {
            //请求失败
            return null;
        }
    } catch (MalformedURLException e) {
        e.printStackTrace();
    } catch (ProtocolException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
    return null;
}

CreateProcess创建进程

STARTUPINFO         si = { 0 };
PROCESS_INFORMATION pi = { 0 };
si.cb = sizeof( si );
si.dwFlags = STARTF_USESIZE;
si.dwXSize = 100;
si.dwYSize = 200;
//创建进程
CreateProcess( "ChildProc.exe",
    "\"Hello Child\"",  
    NULL, NULL, FALSE,
    CREATE_NEW_CONSOLE, 
    NULL, NULL, &si, &pi );
//输出信息
printf( "Process Handle: %p\n", pi.hProcess );
printf( "Process ID: %d\n", pi.dwProcessId );
printf( "Thread Handle: %p\n", pi.hThread );
printf( "Thread ID: %d\n", pi.dwThreadId );

插入符函数

插入符函数(鼠标闪烁)
CreateCaret 创建与窗口相关的插入符;
SetCaretPos 在窗口中设置插入符的位置
ShowCaret 显示插入符
HideCaret 隐藏插入符
DestroyCaret 撤销插入符
GetCaretPos 获取插入符位置
GetCaretBlinkTime 获取插入符闪烁时间
SetCaretBlinkTime 设置插入符闪烁时间

demo

CreateCaret(hWnd, (HBITMAP)NULL, 1, 15);
SetCaretPos(100, 100);
ShowCaret(hWnd);

win32操作ini配置文件

 /获取内容/
//获取字符串

GetPrivateProfileString(_T("Config"),_T("Name"),_T("暂无名字"),strName.GetBuffer(MAX_PATH),MAX_PATH,_T("C:\\1.ini"));

//一级菜单|二级菜单|没有找到返回的字符串|strName字符串变量名||ini路径
//获取数字

ndata = GetPrivateProfileInt(_T("Config"),_T("Data"),0,g_strPath);

//返回值是获取到的数据,一级菜单|二级菜单|如果没有找到返回的数字|路径

/写入内容/

::WritePrivateProfileString(_T("Config"),_T("Name"),g_strName,_T("C:\\1.ini"));//写入字符串|数字

//一级菜单|二级菜单|要写入的内容|ini路径