Posts

Showing posts from January, 2012

Assembly - Add 2 interger number

Using AT&T syntax. First, is integer to string. We will divide 10 and push remainderto stack. Finish when result by 0. Pop from stack, and add 48 to convert to ascii charater. Now, you can print number:
.data
a:
    .int 123
b:
    .int 10
c:
    .int 0
thuong:
    .int 0
du:
    .int 0
Enter:
    .int 10
s:
    .ascii "1"
.text

.globl _start
_start:
    #nap so can in vao eax
    movl a,%eax   
    movl $0,%ecx
    #tach so
tach:
    movl $0,%edx
    #chia cho 10
    divl b
    #push so du vao
    addl $48,%edx
    pushl %edx
    inc %ecx
    cmp $0,%eax
    jne tach


in:
    popl %eax
    #luu ecx
    movl %ecx,c

    #in
    movl %eax,du   
    movl $4,%eax
    movl $1,%ebx
    movl $du,%ecx
    movl $1,%edx
    int $0x80

    #tra ecx
    movl c,%ecx
    loop in


    exit:
    movl $1,%eax
    movl $0,%ebx
    int $0x80

Soure: http://www.mediafire.com/?m8hzcrvum926878

And full source to print negative number: http://www.mediafire.com/?72h14t4h30ydf94

------------------…

Create system tray icon using window api

Continue previous entry about winapi. I will create system tray icon
First. include shell.api
Then:
Register varible:
NOTIFYICONDATA niData;
Create niData struct:
ZeroMemory(&niData,sizeof(NOTIFYICONDATA));
niData.cbSize = sizeof(NOTIFYICONDATA);
niData.hWnd = hWnd;
niData.uID = ID_TRAY;
niData.uFlags = NIF_ICON+NIF_MESSAGE+NIF_TIP;
niData.uCallbackMessage = WM_SHELLNOTIFY;
niData.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_HELLOWORLD));
lstrcpyn(niData.szTip, _T("ProjectZero tips!"),sizeof(niData.szTip)/sizeof(TCHAR));

To add icon to taskbar:
Shell_NotifyIcon(NIM_ADD, &niData);
Remove it:
Shell_NotifyIcon(NIM_DELETE, &niData);
Now you can see one icon at your taskbar.
Next, we will create popup menu. When you click ( one- not double) icon will show menu:
Create Contextmenu:
void ShowContextMenu(HWND hWnd)
{
POINT curPoint;
GetCursorPos(&curPoint);
HMENU pMenu = CreatePopupMenu();
if(pMenu)
{
AppendMenu(pMenu, MF_STRING, ID_TRAY_SHOW, L"Show");

Miscrosoft Publish Lab

Image
Publish www: http port 80



Publish https:port 443



Publish owa:



------------------------------------------------------------
Thanks for reading
--------------------------------------------------------------------------
All my Lab:
Linux Lab -- window and Cisco Lab
to be continued - I will update more.