| View previous topic :: View next topic |
| Author |
Message |
WDM Newbie
Joined: 31 Oct 2005 Posts: 4
|
Posted: Mon Oct 31, 2005 7:29 am Post subject: where to find the WINDOW Activate event ? |
|
|
goal : to run the program at DOS command prompt without re-launching the complete program. I just want to hand-over the param and do something.
So I guess I need to find the WINDOW ACTIVATE event. Is this correct ?
...... or how should I do it
some code to illustrate
| Code: | if @WINEXISTS(#Wnd)
WINDOW ACTIVATE,@WINEXISTS(#Wnd)
exit
end
Title TEST
DIALOG CREATE,Temp,-1,0,260,120,CLASS Wnd
DIALOG ADD,BUTTON,Button1,16,16,64,24,Beep
DIALOG SHOW
IF @NOT(@NULL(%1))
GOSUB signal
END
:Evloop
wait event
GOTO @EVENT()
:Button1BUTTON
GOSUB signal
GOTO Evloop
:Signal
INFO A Live
Exit
:Close
EXIT
|
Tx WDM |
|
| Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Mon Oct 31, 2005 3:12 pm Post subject: |
|
|
Could you explain in more detail what you are trying to accomplish? _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
| Back to top |
|
 |
WDM Newbie
Joined: 31 Oct 2005 Posts: 4
|
Posted: Mon Oct 31, 2005 4:37 pm Post subject: Yes --- some more explanation |
|
|
Yes --- some more explanation.
When the program launches it performs a whole bunch of setting/checking operations. This is only required once.
After that I would like to use the program from the command-line for integration in another 3rd. party program without re-launching the program.
Hence I use WINEXISTS and would like to pass the param %1 %2 to an event.
The problem is that I do not know which event catches the WINACTIVE.
I hope to make the program do something in that event with the params.
Does it make any sense ?
All the best |
|
| Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Mon Oct 31, 2005 5:21 pm Post subject: |
|
|
First of all, Welcome to VdsWorld!
The message you need to watch for is WM_ACTIVATE ($6). However, as I
don't program with VDS 5, I can't say how to go about this. If you are using
VDS 4 or below, the only way to accomplish this would be thru a custom
extension written to do such.
Quite possibly, one of the VDS 5 coders will be able to shed some more light
on the subject. I wish I could offer more assistance on this matter. Unfortunately,
I cannot.  _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
| Back to top |
|
 |
Hooligan VDS Developer


Joined: 28 Oct 2003 Posts: 480 Location: California
|
Posted: Mon Oct 31, 2005 9:10 pm Post subject: |
|
|
Hi WDM,
If I understand you correctly, you'll want to pass the class directly to the Window activate command. The @winexists() function returns a boolean indicating the classes existance.
| Code: | :
if @WINEXISTS(#Wnd)
WINDOW ACTIVATE,#Wnd
exit
end
|
I hope that helps...
Hooligan _________________ Hooligan
Why be normal? |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Mon Oct 31, 2005 11:59 pm Post subject: |
|
|
| Hooligan wrote: | Hi WDM,
If I understand you correctly, you'll want to pass the class directly to the Window activate command. The @winexists() function returns a boolean indicating the classes existance.
| Code: | :
if @WINEXISTS(#Wnd)
WINDOW ACTIVATE,#Wnd
exit
end
|
I hope that helps...
Hooligan |
Hooligan,
The @winexists() function does not return a boolean value. The @winexists() returns the Window ID (ie... Windows Handle, HWND) if it finds the window title or classname that is passed as a parameter or it will return NULL if the window cannot be found.
BTW the WINDOW command can take a the results from @winexists(#Wnd) just fine. The WINDOW command takes a Window Title, Window ClassName preceded with a '#' character, or a Window ID which is a number preceded with a '%' in VDS and is garanteed to be unique from all other window ID's global through out all of the operating system. _________________ Home of
Give VDS a new purpose!

Last edited by vdsalchemist on Tue Nov 01, 2005 12:21 am; edited 1 time in total |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Tue Nov 01, 2005 12:08 am Post subject: |
|
|
WDM,
I still don't understand what you are trying to do? The first time you run your program your Dialog will open. The next time you run your program it will close unless the dialog that was opened from the first run is closed. At least this is what I can tell from your code above. Is this the desired results? _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Tue Nov 01, 2005 8:15 am Post subject: |
|
|
I think he wants that if the first instance of the program is running and the user starts another instance, the dialog of the first instance should get on top AND that dialog should trigger an event so that the first application nows the user has started the program again...
Starting App 1 -> Starting App2 -> App2 puts App1 on top -> App1 should execute some code _________________ [ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial! |
|
| Back to top |
|
 |
Hooligan VDS Developer


Joined: 28 Oct 2003 Posts: 480 Location: California
|
Posted: Tue Nov 01, 2005 3:14 pm Post subject: |
|
|
I stand corrected...
I've only ever used it to test for the existance of windows...
(Wow, there's an easier way!)
Hooligan _________________ Hooligan
Why be normal? |
|
| Back to top |
|
 |
WDM Newbie
Joined: 31 Oct 2005 Posts: 4
|
Posted: Wed Nov 02, 2005 8:49 am Post subject: Skit3000 has it right ! |
|
|
Skit3000 has it right !
How to make the program info 'A Live' if the program is already running and when you launch the program a second time with a parameter.
FYI : i work on VDS 4
any idea more than welcome |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Wed Nov 02, 2005 8:58 am Post subject: |
|
|
You might want to try it by using DDE, although I can't say for sure if VDS 4 supports that without the use of a DLL. With DDE, you can let App2 send a text string to a hidden textbox on the dialog of App1, after which an event will be triggerd to inform App1 it is the active window again. _________________ [ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial! |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Wed Nov 02, 2005 4:01 pm Post subject: |
|
|
Unless I'm misunderstanding, you should be able to use a timer and check if @winactive equals your window, along with a little checking to make sure it only triggers once per window activation:
| Code: |
%%active = 0
:Timer
REM See if your window has already been activated
if @equal(%%active,0)
REM It wasn't so check if it is now.
if @equal(@winactive(I),@winexists(#Wnd))
info Window Activated
%%active = 1
else
%%active = 0
end
end
:evloop
wait event,0.5
goto @event()
|
_________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
WDM Newbie
Joined: 31 Oct 2005 Posts: 4
|
Posted: Wed Nov 02, 2005 4:27 pm Post subject: |
|
|
I'm almost there !
see below I'm able to send ALT F4 to the window. In that case the :Close event is activated.
the problem the param %1 is lost so I guess I have to use the method of Skit3000 ( to send the param %1 as a text string to an edit box ).
I still need to find-out how to do this - however I think it is not nice programming.
Is there a way to add a custom event ?
-----------------------------------------------------------------
if @WINEXISTS(#Wnd)
WINDOW ACTIVATE,@WINEXISTS(#Wnd)
IF @NOT(@NULL(%1))
window send,#Wnd,@alt(@key(F4))
END
EXIT
END
----------------------------------------------------------------
Tx WDM |
|
| Back to top |
|
 |
|