flat assembler
Message board for the users of flat assembler.

Index > Windows > Interfacing with my WebBrowser control?

Goto page Previous  1, 2, 3
Thread Post new topic Reply to topic
When all else fails, read the source

Joined: 24 Aug 2004
Posts: 17664
Location: In your JS exploiting you and your system
BigVent wrote:
That my friend is why you are a guru & and I am but a newb. Very Happy I tried to implement some code... and it does not work.
Huh, I'm no guru, but I will try to help if I can
BigVent wrote:
I left the code the same from Calpol2004's post because I cannot broadcast my username & password to the world. No offense...

I have changed my https:// site in my actual app... that will pull up the server logon.

Please help!!! I know this would take you like 5 minutes to do since you are ubah.
Well, I can't test you code, since I don't have all the necessary bits to test with. So that kinda makes it difficult. I've quickly made a few minor tweaks to the code you posted. i have no idea if it works or not, but the purpose is so that you can compare to your version and see what is changed and hopefully understand a little more and work towards getting a working version.
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
msg MSG
edithwnd dd ?
client RECT
; extra code added to Calpol2004's  ;;

StrToSend db 'text to send',0

push ebp
mov ebp,esp

push [edithwnd]
call [SetForegroundWindow]

push StrToSend
call SendKeys

mov esp,ebp
pop ebp
ret 0

.theStr equ ebp-8
  push ebp
  mov ebp,esp
  push esi
  mov esi, [.theStr]
  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
  pop esi
  mov esp,ebp
  pop ebp
  ret 4

;;;;end of added code;;;;;;;;;;

;             Start               ;

section '.code' code readable executable
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
invoke  GetMessage,msg,NULL,0,0
or      eax,eax
jz      end_loop
invoke  TranslateMessage,msg
invoke  DispatchMessage,msg
jmp     msg_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
invoke  DefWindowProc,[hwnd],[wmsg],[wparam],[lparam]
jmp     finish
                invoke  PostQuitMessage,0
                xor     eax,eax
        jmp     finish

                invoke  DestroyWindow,[hwnd]
        jmp     finish
                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
                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
              call    ..Start
        jmp     finish
pop     edi esi ebx
;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    
Post 30 May 2008, 12:16
View user's profile Send private message Visit poster's website Reply with quote

Joined: 28 May 2008
Posts: 24
I finally got this to work!!! W00t!!! Thanks bitRAKE for the site & thank you revolution for your insight!

Post 30 May 2008, 15:20
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2, 3

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum

Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.