FlashWindow function

BOOL WINAPI FlashWindow(
  _In_ HWND hWnd,
  _In_ BOOL bInvert
);

FlashWindow in MSDN

demo

//cl tFlashWindow.c && tFlashWindow.exe
int main(int argc, char* argv[]) {
    HWND w = GetConsoleWindow();
    while(TRUE) {
        FlashWindow(w, TRUE);
        Sleep(700);
    }
    return 0;
}

FlashWindowEx function

BOOL WINAPI FlashWindowEx(
  _In_ PFLASHWINFO pfwi
);

FlashWindowEx in MSDN

FLASHWINFO structure

标签: windows
日期: 2016-03-11 17:30:06, 8 years and 310 days ago

使用余(正)弦函数公式

y = a * cos(x * b)

其中,a决定幅度,b决定周期。

关键流程

根据余弦公式绘制曲线,形成闭合路径,再填充颜色,做遮罩成去掉无用部分

源代码

Setting environment for using Microsoft Visual Studio 2008 x86 tools.
>cl waterwave.cpp /Zi /link user32.lib gdi32.lib

参考

异形窗口
水波纹效果-iOS实现

标签: windows
日期: 2016-01-16 17:30:06, 9 years ago

获取windows网络状态有三种方式:

  • InternetGetConnectedState(wininet.dll)直接获取

  • GetAdaptersAddresses(iphlpapi.dll)枚举网络适配器

  • Network Awareness

    • NLA in Windows XP

    • NLM in Vista or windows 7

源代码 source code

netaware - https://raw.githubusercontent.com/codepongo/utocode/master/windows/netaware.cpp

  • with iphlp - webkit的GetAdaptersAddresses方式的实现 webkit implementation
  • with nlm - NLM的同步实现 NLM synchronous implementation
  • with nlm event - NLM的异步实现 NLM asynchronous implementation
  • with wininet - InternetGetConnectedState的实现 InternetGetConnectedState implementation
  • with winsock - NLA的同步实现 NLA synchronous implementation
  • wait for change with winsock - NLA的异步实现 NLA asynchronous implementation
  • GetAdaptersAddresses方式的更准确实现可参考firefox的源码
    • 如果确定不了网络是否连接(如API失败等情况),则返回已连接状态
    • 通过获取AdapaterAddress AdapaterInfo和IPAddressTable进行综合判断
    • 通过NotifyAddrChange(http://msdn.microsoft.com/en-us/library/windows/desktop/aa366329.aspx)异步通知 伪代码如下:
def CheckAdapterAddress():
    addresses = GetAdaptersAddresses()
    for a in addresses:
        if a.OperStatus == IfOperStatusUp 
        and a.IfType != IF_TYPE_SOFTWARE_LOOPBACK
        and a.FirstUnicastAddress->Address.lpSockaddr != '192.168.0.1':
            return True;
    return False

def CheckAdaptersInfo():
    adapters = GetAdaptersInfo()
    for a in adapters:
        if a.DhcpEnabled:
            if a.DhcpServer.IpAddress == '255.255.255.255':
                return True;
            else:
                for ip in a.IpAddressList:
                    if ip == '0.0.0.0':
                        return True;
        return False;

def CheckIPAddrTable():
    tables = GetIpAddrTable()
    for t in tables:
        if t.dwAddr != 0 && t.dwAddr !=  0x0100007F:
            return True
    return False

reference 参考

标签: windows, webbrowser
日期: 2014-06-12 17:30:06, 10 years and 218 days ago
  • create a file and name it "desktop.scf" 新建名为“desktop.scf“的文件

  • copy bellow content in it 复制下面内容到文件中

[Shell]
Command=2
IconFile=%SystemRoot%system32SHELL32.dll,34
[Taskbar]
Command=ToggleDesktop
  • create a shortcut and move it into the "~\favorites\links" 创建一个快捷方式并拷贝到用户目录下的favorites\links下 ~ belongs to your home directory
标签: windows
日期: 2014-06-06 17:30:06, 10 years and 224 days ago

menu: Debug - New Breakpoint(ctrl+B) vs菜单:调试 - 新断点(ctrl+B)

Function:{,,dynamic.dll}_functionW@size
e.g.
{,,kernel32.dll}_CreateProcessW@40
  • dynamic is the DLL name dynamic为DLL名称
  • NOTICE there is a underline at the front of 'function' 注意函数名前有下划线
  • function is the function name function为函数名
  • W/A is ascii or unicode function W/A为区别windows API的ascii和unicode版
  • size is the size of all arguments of the function, more size为函数所有参数的字节数,详细

for example 例如:

int
WINAPI
MessageBoxW(
    __in_opt HWND hWnd,
    __in_opt LPCWSTR lpText,
    __in_opt LPCWSTR lpCaption,
    __in UINT uType);
size = sizeof(HWND) + sizeof(LPCWSTR) + sizeof(LPCWSTR) + sizeof(UINT)

或者 or

C:\Program Files (x86)\Debugging Tools for Windows (x86)>dbh.exe -s:srv*C:\Symbo
ls*http://msdl.microsoft.com/Download/Symbols -d C:\Windows\SysWOW64\user32.dl
l enum *MessageBox*

so, the breakpoint at the 'messagebox' function is 所以,messagebox函数的断点function应添为

{,, User32.dll}_MessageBoxW@16

reference 参考

break point on create process

rule for function name

标签: windows
日期: 2014-05-30 17:30:06, 10 years and 231 days ago