|
-
August 5th, 2001, 11:09 PM
#1
add code in exe
I have to develop an application which adds a dialog box to any exe file
Eg . when u run notepad , a dialog box opens up saying “hello world” and then notepad runs as ususal
Could someone guide me how to go about doing this in VB , or tell me if there is any source code for such a software
-
August 6th, 2001, 02:47 AM
#2
Re: add code in exe
I think your best shot is to write a program that should run at startup and intercept all new windows appearing, in order to display a dialog. It may be done using EnumWindows Api. Here an example of using this api:
'Add this code to a form
private Sub Form_Load()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: [email protected]
'set the form's graphics mode to persistent
me.AutoRedraw = true
'call the Enumwindows-function
EnumWindows AddressOf EnumWindowsProc, byval 0&
End Sub
'Add this code to a module
Declare Function EnumWindows Lib "user32" (byval lpEnumFunc as Long, byval lParam as Long) as Boolean
Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (byval hwnd as Long, byval lpString as string, byval cch as Long) as Long
Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (byval hwnd as Long) as Long
public Function EnumWindowsProc(byval hwnd as Long, byval lParam as Long) as Boolean
Dim sSave as string, Ret as Long
Ret = GetWindowTextLength(hwnd)
sSave = Space(Ret)
GetWindowText hwnd, sSave, Ret + 1
Form1.print Str$(hwnd) + " " + sSave
'continue enumeration
EnumWindowsProc = true
End Function
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
The Rater
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|