flat assembler
Message board for the users of flat assembler.
Index
> Windows > Interfacing with my WebBrowser control? Goto page 1, 2, 3 Next |
Author |
|
calpol2004 18 Jul 2007, 22:18
Well im currently developing an application which will need a WebControl and after a week or so trying to figure it out i finally achieved it after thinking it was only possible with the MFC.
By using AtlAxWinInit() from atl.dll and then creating the control with the class name "AtlAxWin" i've made a simple browser control which opens to Google. It only required a few lines of code which was weird since i was expecting to write an essay . But I can't seem to be able to communicate with the control at all. And this is where i hoped i could get some help . Do you have any ideas on how to interface with the control? I'm mostly interested in telling the control to navigate somewhere else if anything. Any links to websites or examples showing something relevant i would be very grateful for. All the relevant code is in the wmcreate section of the window procedure if you wish to take a look: 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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; 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 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 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 'apia\kernel32.inc' include 'apia\user32.inc' import atl,AtlAxWinInit,'AtlAxWinInit' ;end of imports I've included the source and compiled app if you want to look:
|
|||||||||||
18 Jul 2007, 22:18 |
|
r22 22 Jul 2007, 11:18
You can check out the DDRAW example that comes with FASM for how to use com objects.
if you don't know the function pointer you can reverse it from the a compilation in c++. -Write the code in C++ -Put a rarely used inline "__asm RDTSC" write before/after the line you want -Have c++ compile the exe and open it up in a debugger -By looking for RDTSC you'll be able to easily find the code C++ generated for say "oWb.Navigate(url)" |
|||
22 Jul 2007, 11:18 |
|
f0dder 22 Jul 2007, 14:26
The smarter approach would be getting the C++ compiler to generate an assembly listing, that way you don't need to hunt for instructions... For Visual C++, cl /O1 /Fa myfile.cpp is suitable for an assembly listing. I do tend to use IDA on .obj files instead to get rid of name mangling, though.
|
|||
22 Jul 2007, 14:26 |
|
BigVent 28 May 2008, 18:30
Say you wanted to use this code for searches or other things... where would you put code to wait until the google page loads, then send a search for "Whatever" then press enter?
What I'm really searching for is that this proggie will open up my remote desktop (https), send my password, send a couple of tabs & paste a few dates, then exit. Is this possible? I guess the chore would be sending keys to the keyboard buffer? Any help is appreciated!!! _________________ ~BigVent |
|||
28 May 2008, 18:30 |
|
bitRAKE 29 May 2008, 01:56
Look at this thread showing how to inject JavaScript using AutoHotKey. Of course, it can be done in any number of languages. I haven't seen any examples in x86 and I hate COM in x86, too.
_________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
29 May 2008, 01:56 |
|
BigVent 29 May 2008, 02:35
Thanks for the link bitRAKE! It looks like some great work... now if I only knew js and where to place everything
Many Thanks! ~BigVent |
|||
29 May 2008, 02:35 |
|
Kenneth 29 May 2008, 03:52
r22 wrote: You can check out the DDRAW example that comes with FASM for how to use com objects. Or just use int 3. |
|||
29 May 2008, 03:52 |
|
f0dder 29 May 2008, 12:21
Kenneth wrote:
Fine if you want to break in a debugger, but useless if you want to locate it in a disassembler, since INT3 is generally used for padding... _________________ - carpe noctem |
|||
29 May 2008, 12:21 |
|
BigVent 29 May 2008, 13:33
f0dder wrote:
So what would you guys suggest? I'm a newb and it would take forever for me to learn what I'm seeing on the debugger. All I need to do is pass data to the current window. _________________ ~BigVent |
|||
29 May 2008, 13:33 |
|
bitRAKE 29 May 2008, 13:49
BigVent wrote: So what would you guys suggest? I'm a newb and it would take forever for me to learn what I'm seeing on the debugger. _________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
29 May 2008, 13:49 |
|
BigVent 29 May 2008, 14:41
bitRAKE wrote:
LMAO!!! Thanks for the encouragement!!! To be quite honest.... I don't know where to start. I know a little VB & a little C++. _________________ ~BigVent |
|||
29 May 2008, 14:41 |
|
revolution 29 May 2008, 14:52
BigVent wrote: I don't know where to start. |
|||
29 May 2008, 14:52 |
|
BigVent 29 May 2008, 15:02
Cannot pull up your www (gfgidude)
Thanks, I'll start doing searches & such. ~BigVent |
|||
29 May 2008, 15:02 |
|
revolution 29 May 2008, 15:11
BigVent wrote: Cannot pull up your www (gfgidude) |
|||
29 May 2008, 15:11 |
|
BigVent 29 May 2008, 15:29
Thanks revolution. I'll give your site a try in a few days.
If you would... nudge me in the right direction with regards to passing data to focused windows? Thanks, ~BigVent |
|||
29 May 2008, 15:29 |
|
revolution 29 May 2008, 15:37
For the window in focus use keybd_event. But more standard methods are:
Code: BroadcastSystemMessage PostMessage PostQuitMessage PostThreadMessage SendMessage SendMessageCallback SendMessageTimeout SendNotifyMessage SetMessageExtraInfo |
|||
29 May 2008, 15:37 |
|
BigVent 29 May 2008, 15:52
Thank you! I'll try to build on this.
I've searched several times for literature regarding keybd_event. I just cannot quite seem to grasp this. ~BigVent |
|||
29 May 2008, 15:52 |
|
revolution 29 May 2008, 16:10
BigVent wrote: I've searched several times for literature regarding keybd_event. I just cannot quite seem to grasp this. keybd_event wrote: The keybd_event function synthesizes a keystroke. The system can use such a synthesized keystroke to generate a WM_KEYUP or WM_KEYDOWN message. The keyboard driver's interrupt handler calls the keybd_event function. |
|||
29 May 2008, 16:10 |
|
BigVent 29 May 2008, 16:18
Awesome! Thanks.
The reason I wanted this is because this program & dev notes do exactly what I need my program to do. http://m8software.com/developer/keysend/howtosend.htm I've tried to sendkey in VB till my fingers bled... so that is why I switched to a lowlevel program lang. Thanks again for your input & help. Hope I do not wear out my welcome. ~BigVent |
|||
29 May 2008, 16:18 |
|
Goto page 1, 2, 3 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.