It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming Visual Basic Forum

How to trigger Activate event of a Form?

Moderator: dafunkymunky

How to trigger Activate event of a Form?

Postby erosszz on Tue Sep 25, 2007 2:54 am

I have 2 exe programs.
prg1.exe = calling program
prg2.exe = program to be called

prg1 code to call prg2:
Code: Select all
' Specifying vbNormalFocus as the second argument opens the application in
' normal size and gives it the focus.
Dim RetVal
RetVal = Shell("C:\WINDOWS\prg.EXE 0001", vbNormalFocus)   ' Run prg2.


prg2 code to unload, back to prg1:
Code: Select all
'there is some others code before Unload Me
'Function WriteInfoToINIFile()
Unload Me


Requirements:
After prg2 Unload, the prg1 back its previous state and need to change some data depends on the written data from INI File by the prg2 upon the prg1 activate the program.

Problem:
The Activate event of prg1 is not triggered upon activation.

Conclusion:
The Activate event occurs when an object becomes the active window. But moving the focus to or from an object in another application doesn't trigger either event.

Favors to the group:
1) Please give a hints on how to trigger activate event switching between 2 applications.
2) If you have other way to meet the requirements, much better. Please teach me.
3) Also upon calling the prg2, the user should not able access prg1. Its like with calling other form using Show method with vbModal. But it is within the application.. How about between two applications. (maybe Hiding the prg1 first before calling the prg2 then show it again after prg2 unload.

Thank you very much.
erosszz
 
Posts: 0
Joined: Tue Sep 25, 2007 2:21 am
Location: Fuji-shi, Shizuoka-ken, Japan

Postby zul111467 on Sat Jan 19, 2008 9:10 pm

By looking to your requirement. You should do this by create a DLL for prg2. We can add a form or user interface in DLL program. Make a call to the DLL to show a form in vbmodal so the user unabled to access prg1.
zul111467
 
Posts: 6
Joined: Sat Jan 19, 2008 3:54 pm
Location: Malaysia


Who is online

Users browsing this forum: No registered users and 8 guests