flat assembler
Message board for the users of flat assembler.
Index
> Windows > Interfacing with my WebBrowser control? Goto page Previous 1, 2, 3 |
Author |
|
revolution 30 May 2008, 12:16
BigVent wrote: That my friend is why you are a guru & and I am but a newb. I tried to implement some code... and it does not work. BigVent wrote: I left the code the same from Calpol2004's post because I cannot broadcast my username & password to the world. No offense... Code: format PE GUI 4.0 entry start Include 'win32a.inc' ;;;;;;;;;;;;;;;;;;;;;;;;; ; Data Section ; ;;;;;;;;;;;;;;;;;;;;;;;;; section '.data' data readable writeable _title db 'Basic Web Browser By Calpol2004',0 _class db 'MyWindowClass',0 browserclassname db 'AtlAxWin',0 ;class name of browser control browserhome db 'http://www.google.com',0 ;page to go to wc WNDCLASS 0,WindowProc,0,0,NULL,NULL,NULL,COLOR_BTNFACE+1,NULL,_class msg MSG edithwnd dd ? client RECT ;;;;;;;;;;;;;;;;;; ; extra code added to Calpol2004's ;; ;;;;;;;;;;;;;;;;;; ;.data StrToSend db 'text to send',0 ;.code ..Start: push ebp mov ebp,esp push [edithwnd] call [SetForegroundWindow] push StrToSend call SendKeys mov esp,ebp pop ebp ret 0 SendKeys: .theStr equ ebp-8 push ebp mov ebp,esp push esi mov esi, [.theStr] .LoopToNull: cmp byte[esi],0 je .AllDone movzx eax,byte[esi] invoke MapVirtualKey,eax,0 push eax ;save it for 2nd call push 0 ;extra info push 0 ;flag push 0 ;key ScanCode push eax ;Virtual Keycode using ASCII call [keybd_event] pop eax ;get saved VK code push 0 ;extra info push KEYEVENTF_KEYUP ;flags for key UP push 0 ;scan code push eax ;VK Code call [keybd_event] add esi,1 jmp .LoopToNull .AllDone: pop esi mov esp,ebp pop ebp ret 4 ;;;;end of added code;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Start ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; section '.code' code readable executable start: invoke GetModuleHandle,0 mov [wc.hInstance],eax invoke LoadIcon,0,IDI_APPLICATION mov [wc.hIcon],eax invoke LoadCursor,0,IDC_ARROW mov [wc.hCursor],eax invoke RegisterClass,wc invoke CreateWindowEx,0,_class,_title,WS_VISIBLE+WS_SYSMENU+WS_MAXIMIZEBOX+WS_MINIMIZEBOX+WS_SIZEBOX,50,30,700,500,NULL,NULL,[wc.hInstance],NULL msg_loop: invoke GetMessage,msg,NULL,0,0 or eax,eax jz end_loop invoke TranslateMessage,msg invoke DispatchMessage,msg jmp msg_loop end_loop: invoke ExitProcess,[msg.wParam] ;end message loop ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Window Procedure ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; proc WindowProc hwnd,wmsg,wparam,lparam push ebx esi edi cmp [wmsg],WM_CLOSE je wmclose cmp [wmsg],WM_DESTROY je wmdestroy cmp [wmsg],WM_CREATE je wmcreate cmp [wmsg],WM_SIZE je wmsize cmp [wmsg],WM_KEYDOWN je wmkeydown defwndproc: invoke DefWindowProc,[hwnd],[wmsg],[wparam],[lparam] jmp finish wmdestroy: invoke PostQuitMessage,0 xor eax,eax jmp finish wmclose: invoke DestroyWindow,[hwnd] jmp finish wmcreate: invoke AtlAxWinInit ;make class available invoke GetClientRect,[hwnd],client ;get size of window so browser control is set to the same size invoke GetModuleHandle,0 invoke CreateWindowEx,WS_EX_CLIENTEDGE,browserclassname,browserhome,WS_CHILD+WS_VISIBLE+WS_VSCROLL+WS_HSCROLL,[client.left],[client.top],[client.right],[client.bottom],[hwnd],eax,0 mov [edithwnd],eax ;hwnd returned by CreateWindowEx is moved onto edithwnd variable as its a parameter for MoveWindow() jmp finish wmsize: invoke GetClientRect,[hwnd],client ;re-retrieve the window size invoke MoveWindow,[edithwnd],[client.left],[client.top],[client.right],[client.bottom],TRUE ;adjust size of control jmp finish wmkeydown: call ..Start jmp finish finish: pop edi esi ebx ret endp ;end of window procedure ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Import Data ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; section '.idata' import data readable writeable library kernel32,'KERNEL32.DLL',user32,'USER32.DLL',atl,'ATL.dll' include 'api\kernel32.inc' include 'api\user32.inc' import atl,AtlAxWinInit,'AtlAxWinInit' ;end of imports |
|||
30 May 2008, 12:16 |
|
BigVent 30 May 2008, 15:20
I finally got this to work!!! W00t!!! Thanks bitRAKE for the site & thank you revolution for your insight!
~BigVent |
|||
30 May 2008, 15:20 |
|
Goto page Previous 1, 2, 3 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.