所有由罗佳(博主)发布的文章

这里来打个Win32应用程序最基本代码的笔记

此代码直接丢进VC或VS或C-Free或其他什么win下的编译器就可以直接编译运行,无需冷藏。。(在VS下需把编码调一下)

 
#include "windows.h" 
LRESULT CALLBACK MainWProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) 
{ 
switch (message) 
{ 
case WM_PAINT: // 窗口客户区需要重画 
{ 
HDC hdc; 
PAINTSTRUCT ps; 
char szText[] = "这神马程序"; // 使无效的客户区变的有效,并取得设备环境句柄 
hdc =BeginPaint (hwnd, &ps) ; // 显示文字 
TextOut(hdc, 250, 10, szText, strlen(szText)); 
EndPaint(hwnd, &ps); 
return 0; 
} 
case WM_DESTROY: // 正在销毁窗口 
// 向消息队列投递一个WM_QUIT消息,促使GetMessage函数返回0,结束消息循环 
PostQuitMessage(0); 
return 0 ; 
} 
// 将我们不处理的消息交给系统做默认处理 
return DefWindowProc(hwnd, message, wParam, lParam); 
}
int APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow) 
{ 
TCHAR szClassName[] = "MainWClass"; 
WNDCLASSEX wndclass; // 用描述主窗口的参数填充WNDCLASSEX结构 
wndclass.cbSize = sizeof(wndclass); // 结构的大小 
wndclass.style = CS_HREDRAW|CS_VREDRAW; // 指定如果大小改变就重画 
wndclass.lpfnWndProc = MainWProc; // 窗口函数指针 
wndclass.cbClsExtra = 0; // 没有额外的类内存 
wndclass.cbWndExtra = 0; // 没有额外的窗口内存 
wndclass.hInstance = hInstance; // 实例句柄 
wndclass.hIcon = LoadIcon(NULL,IDI_APPLICATION); // 使用预定义图标 
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); // 使用预定义的光标 
wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); // 使用白色背景画刷 
wndclass.lpszMenuName = NULL; // 不指定菜单 
wndclass.lpszClassName = szClassName ; // 窗口类的名称 
wndclass.hIconSm = NULL; // 没有类的小图标 
// 注册这个窗口类 
RegisterClassEx(&wndclass); // 创建主窗口 
HWND hwnd = CreateWindowEx( 
0, // dwExStyle,扩展样式 
szClassName, // lpClassName,类名 
"喵~", // lpWindowName,标题 
WS_OVERLAPPEDWINDOW, // dwStyle,窗口风格 
NULL, // X,初始 X 坐标 
NULL, // Y,初始 Y 坐标 
1000, // nWidth,宽度 
500, // nHeight,高度 
NULL, // hWndParent,父窗口句柄 
NULL, // hMenu,菜单句柄 
hInstance, // hlnstance,程序实例句柄 
NULL) ; // lpParam,用户数据 
// 显示窗口,刷新窗口客户区 
ShowWindow(hwnd, nCmdShow); 
UpdateWindow(hwnd); // 从消息堆中取出消息 
MSG msg; 
while(GetMessage(&msg, NULL, 0, 0)) 
{ 
// 转化键盘消息 
TranslateMessage(&msg); // 将消息发送到相应的窗口函数 
DispatchMessage(&msg); } // 当GetMessage返回0时程序结束 
return msg.wParam; 
}

这么就写完了

仿制示波器版BadApple教程

直接扣一大块代码来了,此物可用于装逼卖萌等,所以必须留用。人品不好无法观看就点视频上面的分P进源地址。。

仿制示波器版BadApple教程

仿制示波器版BadApple,渣技术见谅 和av360665不同的是,无需硬件制作,自备一个支持无损格式的音乐播放器就行了,当然还得有示波器用 理论上任何视频都可以转换,但多数转换效果很糟糕,除了影绘类单色视频 1P为数据转换 2P音频处理 3P连接方法和渣效果展示

ajax那啥的通用框架

ajax虾米的最有爱了,用起来也很方便。。【第一次写长文,出错请留言来让我改正】

var xmlhttp; //创建一个Request对象先
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
else
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("POST或者GET","请求的脚本文件",true或false【不加引号,true是异步,false是同步】);          //异步通俗的说就是请求时浏览器接着干其他事,同步就是浏览器要等服务器处理完了才接着做其他事
xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200) //当海枯石烂的时候
{
//这里就可以做ajax接收后行为的事了,然后xmlhttp.responseText是从服务器扔回来的数据。
}
}
xmlhttp.send("这里是发送出去的数据");

继续阅读ajax那啥的通用框架

mysql的蛋疼注意事项一条

今天一个神一般的问题纠结了我一天。。
那就是Mysql创建table的时候,语法问题。

本来是想做个ip记录模块的,结果时间都浪费在这里了。接下来是高能重点!!!!

$info = "CREATE TABLE ips
(
number int NOT NULL AUTO_INCREMENT,
PRIMARY KEY(number),
ip varchar(30)
)";
mysql_query($info,$sql);

上面这是修改后正确的代码(其中一个原来出错的部分),先来猜猜原来是哪里出错了呢~~~~

 

 

 

 

希望这是大多数人都遇到过的问题,接下来公布答案。。

那就是ip varchar(30)这个了,不得不说mysql解析的智能程度还不够,我只是在最后加了个,而已,它就不认爹了【也就是ip varchar(30),】

接下来是错误版

$info = "CREATE TABLE ips
(
number int NOT NULL AUTO_INCREMENT,
PRIMARY KEY(number),
ip varchar(30),   //←注意这个悲催的逗号,难道逗号后面没有参数它就不能当作空参数吗!执行到这里就直接当作错误跳过了【坑爹呐!!!(掀桌子)】
)";
mysql_query($info,$sql);

值得庆幸的是。。我终于发现并解决了这个问题。ip记录模块还有希望的说喵~~

太阳君和月亮酱

上个例子先。。

然后由于某些原因。。在文章后面的这个太阳或者月亮就是例子了。

单独的例子看这里:demo.luojia.me/sunandmoon/

————下面是神圣的代码————–

 

<html>
<head>
<script src="http://www.luojia.tk/jquery.js"></script>
<script>
function resunmoondivsize(){
var height=window.innerHeight;
var width=window.innerWidth;
if(height>width){
document.getElementById("sunmoondiv").style.width=width*2;
document.getElementById("sunmoondiv").style.height=width*2;
}
else{
document.getElementById("sunmoondiv").style.width=height*2;
document.getElementById("sunmoondiv").style.height=height*2;
}
document.getElementById("sunmoondiv").style.left=(width-document.getElementById("sunmoondiv").style.width);

var divwidth=document.getElementById("sunmoondiv").style.width;
var divheight=document.getElementById("sunmoondiv").style.height;
var setwidth=width/2;
var setdivwidth=divwidth/2;
document.getElementById("sunmoondiv").style.left=setwidth-setdivwidth;
document.getElementById("sunmoondiv").style.top=divheight/2;

}
function setsunmoon(){
var divwidth=document.getElementById("sunmoondiv").style.width;
var sunwidth=document.getElementById("sun").style.width;
var moonwidth=document.getElementById("moon").style.width;
}
sunshinejiaodu=0;
function zhuansunshine(){
sunshinejiaodu=sunshinejiaodu+0.4;
var jiaodu="rotate("+sunshinejiaodu+"deg)";
$("#sunshine").css({"transform":jiaodu,"-webkit-transform":jiaodu,"-moz-":jiaodu,"-ms-":jiaodu,"-o-":jiaodu});
}
function zhuansunmoon(){
var date=new Date();
var zhengtijiaodu=(date.getHours()*60+date.getMinutes()+date.getSeconds()/60)*0.25;
var jiaodu="rotate("+zhengtijiaodu+"deg)";
$("#sunmoondiv").css({"transform":jiaodu,"-webkit-transform":jiaodu,"-moz-":jiaodu,"-ms-":jiaodu,"-o-":jiaodu});
}
</script>
</head>
<body style="margin: 0px;">
<div style="position:fixed;height:100%;width:100%;overflow:hidden;min-height:360px;min-width:360px;" id="sunmoonmain">
<div style="position:relative;min-height:360px;min-width:360px; margin:0px auto;" id="sunmoondiv">
<!--月亮酱-->
<div style="position:absolute;height:180px;width:180px;overflow:hidden;top:0px;left:50%; margin-left:-90px;transform:scale(0.5);-webkit-transform:scale(0.5);-o-transform:scale(0.5);-ms-transform:scale(0.5);-moz-transform:scale(0.5);" id="moon">
<div style="position:absolute;width:50%;height:50%;left:22.5%;top:22.5%;border-radius:999px; background-color:rgba(255,204,51,0.6)"></div>
</div>

<!--太阳君-->
<style>
div.suncolor{background-color:rgba(255,0,0,0.8);}
</style>
<div style="position:absolute;height:180px;width:180px;overflow:hidden;bottom:0px;left:50%; margin-left:-90px;transform:scale(0.5);-webkit-transform:scale(0.5);-o-transform:scale(0.5);-ms-transform:scale(0.5);-moz-transform:scale(0.5);" id="sun">
<div style="position:absolute;width:50%;height:50%;left:25%;top:25%;border-radius:999px;" class="suncolor"></div>
<div style="position:absolute;height:180px;width:180px;" id="sunshine">
<div style="position:absolute;width:3px;height:13%;left:88.5px;top:16px;" class="suncolor"></div>
<div style="position:absolute;width:13%;height:3px;top:88.5px;right:16px;" class="suncolor"></div>
<div style="position:absolute;width:3px;height:13%;left:88.5px;bottom:16px;" class="suncolor"></div>
<div style="position:absolute;width:13%;height:3px;top:88.5px;left:16px;" class="suncolor"></div>

<div style="position:absolute;height:180px;width:180px;transform:rotate(22.5deg);-webkit-transform:rotate(22.5deg);-moz-transform:rotate(22.5deg);-ms-transform:rotate(22.5deg);-o-transform:rotate(22.5deg);">
<div style="position:absolute;width:3px;height:7%;left:88.5px;top:26px;" class="suncolor"></div>
<div style="position:absolute;width:7%;height:3px;top:88.5px;right:26px;" class="suncolor"></div>
<div style="position:absolute;width:3px;height:7%;left:88.5px;bottom:26px;" class="suncolor"></div>
<div style="position:absolute;width:7%;height:3px;top:88.5px;left:26px;" class="suncolor"></div>
<div style="position:absolute;height:180px;width:180px;transform:rotate(22.5deg);-webkit-transform:rotate(22.5deg);-moz-transform:rotate(22.5deg);-ms-transform:rotate(22.5deg);-o-transform:rotate(22.5deg);">
<div style="position:absolute;width:3px;height:13%;left:88.5px;top:16px;" class="suncolor"></div>
<div style="position:absolute;width:13%;height:3px;top:88.5px;right:16px;" class="suncolor"></div>
<div style="position:absolute;width:3px;height:13%;left:88.5px;bottom:16px;" class="suncolor"></div>
<div style="position:absolute;width:13%;height:3px;top:88.5px;left:16px;" class="suncolor"></div>
<div style="position:absolute;height:180px;width:180px;transform:rotate(22.5deg);-webkit-transform:rotate(22.5deg);-moz-transform:rotate(22.5deg);-ms-transform:rotate(22.5deg);-o-transform:rotate(22.5deg);">
<div style="position:absolute;width:3px;height:7%;left:88.5px;top:26px;" class="suncolor"></div>
<div style="position:absolute;width:7%;height:3px;top:88.5px;right:26px;" class="suncolor"></div>
<div style="position:absolute;width:3px;height:7%;left:88.5px;bottom:26px;" class="suncolor"></div>
<div style="position:absolute;width:7%;height:3px;top:88.5px;left:26px;" class="suncolor"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function(e) {
resunmoondivsize();
setsunmoon();
zhuansunmoon();
setInterval('zhuansunshine()',100);
setInterval('zhuansunmoon()',60000);
$(window).resize(function() {
resunmoondivsize();
});

});
</script>
</body>
</html>