May 10, 2024, 11:19:08 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


What do i need to read/write to controls of an external application ?

Started by pistol350, March 05, 2010, 03:08:32 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

pistol350

Hello all!
My project is to write a small program that reads the content of an edit control from another application (not written in Ebasic)
then use that data to create a key that will be written to another edit control from the same application and finally simulate a click to validate the data written.

In short my goal is to write a smart keygen that automates iteratively the process above.
I know how to do it with two programs written in Ebasic but i'm failing to do it with an external program.

I'm thinking about using Hooks, will that be efficient enough ?
Any additional suggestions ?
Thanks.
Regards,

Peter B.

Doc

Hello Pete,
While I'm guessing that you can probably do what you need through the API, you might also want to have a look at using the free AutoIt DLL:

http://www.autoitscript.com

They sure package up a lot of helpful tools and possibilities...

-Doc-


pistol350

Regards,

Peter B.

Copex


this may or may not be helpful :-) i use to have two email accounts for outlook one for work and one for home, for some reason i had to have one account password.  i had two icons on the desktop one outlook home and one outlook work, what this code would do is load outlook select the correct profile and enter the password, it is a project but only to display a banner to show the program was working.

$MAIN
$Include "Windows.inc"
Declare Import,FindWindowA(lpClassName:Pointer,lpWindowName:Pointer),Int
'Const HWND_TOPMOST = -1

window w1
int scrW,scrH,scrT,scrL,screenW,screenH,wFlags

scrW = 149: scrH = 179
wFlags = SWP_NOMOVE|SWP_NOSIZE

GETSCREENSIZE screenW,screenH

scrT = (screenH/2)-scrH
scrL = (screenW/2)-(scrW/2)

OPENWINDOW w1,scrL,scrT,scrW,scrH,@NOCAPTION|@BORDER,NULL,"Loading Email",&main

_SetWindowPos(FindWindowA(NULL,"Loading Email"),HWND_TOPMOST,0,0,0,0,wFlags)

handle = LOADIMAGE(GETSTARTPATH + "pirate.jpg",@IMGSCALABLE)
showimage w1,handle,@IMGSCALABLE,0,0,scrW,scrH

System "C:\\Program Files\\Microsoft Office\\OFFICE12\\OUTLOOK.EXE"

while FindWindowA(Null,"Microsoft Outlook") = null
_sleep(500)
wend

int count: count = 0
'openconsole
' profile window.

do
_sleep(2000)
chwnd = findwin("Choose Profile")
'print chwnd
until chwnd >= NULL

hcid = _FindWindowEx(chwnd,0,"Button","OK")
If hcid
cid = _GetDlgCtrlID(hcid)
If cid
' send button down message to other window
SendMessage(chwnd,WM_COMMAND,cid,hcid)
EndIf
EndIf

' Password window

label PASSWORLD

do
_sleep(1000)
chwnd = findwin("Personal Folders Password")
print chwnd
until chwnd >= NULL

hcid = _FindWindowEx(chwnd,0,"Edit","")
If hcid
SendMessage(hcid,WM_SETTEXT,0,"LamePassword")
else
debug(hcid,"password send loagin password error")
endif

hcid = _FindWindowEx(chwnd,0,"Button","OK")
If hcid
cid = _GetDlgCtrlID(hcid)
If cid
' send button down message to other window
SendMessage(chwnd,WM_COMMAND,cid,hcid)
EndIf
EndIf

'ccgetkey
'closeconsole
LABEL Program_End

CLOSEWINDOW w1
DELETEIMAGE handle,@IMGBITMAP
'WAITUNTIL w1 = 0
END

SUB main
    IF @MESSAGE = @IDCLOSEWINDOW
        CLOSEWINDOW w1
    ENDIF
if @WPARAM = 27
' move w1,0,0
' print w1,"escape"
CLOSEWINDOW w1
DELETEIMAGE handle,@IMGBITMAP
endif
RETURN
ENDSUB

sub findwin(window as string),int
hwnd = FindWindowA(NULL,window)
return hwnd
endsub

sub debug(retval as int,error as string)
openconsole
print "Debug window"
print "Ret Value "+str$(retval)
print "Error "+error
Print:print "Press R to retry or any other key to quit !!"
do
keypre$ = inkey$
_sleep(500)
until keypre$ <>""

if keypre$ = "r" or "R"
goto PASSWORLD
else
closeconsole
goto Program_End
return
endif
endsub
-
I really should learn how to use a spell checker! though im not sure how it will help someone who can not spell?
-
Except where otherwise noted, content Posted By Copex is
licensed under a Creative Commons Attribution 3.0 License

http://creativecommons.org/licenses/by/3.0/