flat assembler
Message board for the users of flat assembler.

Index > Windows > Interfacing with my WebBrowser control?

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


Joined: 24 Aug 2004
Posts: 17716
Location: In your JS exploiting you and your system
revolution
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.
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    
Post 30 May 2008, 12:16
View user's profile Send private message Visit poster's website Reply with quote
BigVent



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

~BigVent
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.