LiquidNitrogen Posted January 16, 2012 Share Posted January 16, 2012 (edited) i Don't Know if there's Ever Been a Window fade Function but Here's Mine. I Didn't Copy Anything. WinFadeIn: Func WinFadeIn($wTitle, $wText) ;By ReaperX GUISetState(@SW_SHOW, $hWnd) For $i = 0 to 255 Step 10 WinSetTrans($wTitle, $wText, $i) sleep(60) Next Return EndFunc WinFadeOut: Func WinFadeOut($wTitle, $wText) ;By ReaperX GUISetState(@SW_SHOW, $hWnd) For $i = 0 to 255 Step -10 WinSetTrans($wTitle, $wText, $i) sleep(60) Next Return EndFunc Edited January 20, 2012 by ReaperX Formerly ReaperX Link to comment Share on other sites More sharing options...
funkey Posted January 16, 2012 Share Posted January 16, 2012 Nice. This ist the best function: _WinAPI_AnimateWindow() from WinAPIEx-UDF. Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
MilesAhead Posted January 19, 2012 Share Posted January 19, 2012 (edited) Could be useful. I edited the code a bit. The Fade Out function didn't run because the loop values went from low to high with a negative step. Also got the window handle and used WinActivate instead of GuiSetState WinFadeOut("WinFadeIn/WinFadeOut Functions","") Sleep(1000) WinFadeIn("WinFadeIn/WinFadeOut Functions","") Func WinFadeIn($wTitle, $wText) ;By ReaperX Local $hWnd = WinGetHandle($wTitle) WinActivate($hWnd) ;GUISetState(@SW_SHOW, $hWnd) For $i = 0 to 255 Step 10 WinSetTrans($wTitle, $wText, $i) sleep(60) Next Return EndFunc Func WinFadeOut($wTitle, $wText) ;By ReaperX Local $hWnd = WinGetHandle($wTitle) ;GUISetState(@SW_SHOW, $hWnd) WinActivate($hWnd) For $i = 250 To 0 Step -10 WinSetTrans($wTitle, $wText, $i) sleep(60) Next Return EndFunc Also a param for the embedded sleep() instead of 60 hard wired, would adjust the speed. I'm going to try it on a glassy window where AnimateWindow doesn't work. I'll post back if it works. Edited January 19, 2012 by MilesAhead empach 1 My Freeware Page Link to comment Share on other sites More sharing options...
MilesAhead Posted January 19, 2012 Share Posted January 19, 2012 (edited) Nah, doesn't really do it for composite window. As soon as you touch the transparency value the insides go pale white. Too bad. Looks useful for regular windows. AnimateWindow() too is not that great if the window has controls you fill with data like a ListBox. As soon as you have the window frame, then the ListBox fills up, obscuring the fade in or slide. AnitmateWindow() fade out is fine. Looks like mainly for splash screen type work. edit: guess I was wrong about AnimateWindow() Works if I populate the ListBox before making the window visible. eit2: Fade in doesn't work, with translucent windows. Probably because of the same transparency issue. But the other effects like slide and center do. Edited January 19, 2012 by MilesAhead My Freeware Page Link to comment Share on other sites More sharing options...
LiquidNitrogen Posted January 19, 2012 Author Share Posted January 19, 2012 Thanks. Still Expanding my Knowledge. Formerly ReaperX Link to comment Share on other sites More sharing options...
MilesAhead Posted January 20, 2012 Share Posted January 20, 2012 (edited) Thanks. Still Expanding my Knowledge. Sure thing. I just recently noticed AnimateWindow() from Melba's I've been adding effects to old programs with Guis that show on hotkey press. Edited January 20, 2012 by MilesAhead My Freeware Page Link to comment Share on other sites More sharing options...
LiquidNitrogen Posted January 20, 2012 Author Share Posted January 20, 2012 (edited) Nice. Also I Cant think of Any Applications to Make or Anything. Got any Ideas That Arent already Made? Edited January 20, 2012 by ReaperX Formerly ReaperX Link to comment Share on other sites More sharing options...
MilesAhead Posted January 21, 2012 Share Posted January 21, 2012 Nice. Also I Cant think of Any Applications to Make or Anything. Got any Ideas That Arent already Made?Tough to think of something completely original. Usually what I do is make something simple that does something the way I want it that I can't find. For example, you can right click in Explorer then choose New then Folder to make a new folder. In Windows Seven there's a hotkey to do it. But not in Vista. So I wrote a hotkey that makes a new folder when I press F7.One thing I did in AutoIt that didn't come out as good as I hoped was a recent program grabber. It worked ok as far as detecting the active window is a program and grabbing the exe path and putting the icon in a button. But some programs don't work right unless launched from the shortcut. Somehow finding the associated shortcut automatically and storing that instead of the exe could be cool.When I hit the hotkey I have a Gui with 16 buttons the last programs run. If I click a button the program launches but it's only the exe with no params or working directory specified. Would be cooler if somehow the shortcut could be linked to the button instead. My Freeware Page Link to comment Share on other sites More sharing options...
MilesAhead Posted January 21, 2012 Share Posted January 21, 2012 Hmmm, wish I could call GetStartupInfo but with another process PID. Seems there's an undocumented flag if the program was started via a shorcut with the path to the .lnk file. But it's only callable from the process itself. My Freeware Page Link to comment Share on other sites More sharing options...
LiquidNitrogen Posted January 21, 2012 Author Share Posted January 21, 2012 (edited) Hmmm... I Have a Few ideas. Edit: Is There a REG Key that Writes the Options to the "New File/Folder" Context menu? Edited January 21, 2012 by ReaperX Formerly ReaperX Link to comment Share on other sites More sharing options...
MilesAhead Posted January 21, 2012 Share Posted January 21, 2012 (edited) Yes, there's ShellNew. But what I'm trying to do is get the path of the shortcut that started a process from outside the process. I have a hotkey that watches the active window. WinAPIEx has a call to get the command line. But I haven't found anything that can get the shortcut path from another process. It would be nice to get it auto-magically. The easy way for the programmer would be just to have the user use SentTo. There's AutoIt function to get the shortcut info. But then it's like just another launcher. If I could somehow get the shortcut path without the user doing anything special then I could cache the last 14 programs. I have the app all done. It's called ReRun. But it just gets the icon and exe path and has a Gui with 14 buttons. Injecting a DLL into every process to get the info would be too slow. If there was some event hook like FileOpen for .lnk file type, that might work. Thing is if I interfered with .lnk opens it would seem like some malware. So I'm reluctant to go that route. I haven't found any undocumented stuff in PEB that points back to the shortcut. There must be something because it has it in GetProcessInfo() but you can only call that inside the process. Too bad it doesn't take a PID as parameter. Edited January 21, 2012 by MilesAhead My Freeware Page Link to comment Share on other sites More sharing options...
LiquidNitrogen Posted January 21, 2012 Author Share Posted January 21, 2012 I Have No Idea How it Would Be Done This Way, But Youre Right. It Has to Be Possible. Formerly ReaperX Link to comment Share on other sites More sharing options...
MilesAhead Posted January 21, 2012 Share Posted January 21, 2012 It's frustrating with Windows because there always seems to be an undocumented thing that does what you want, but you can't use it. My Freeware Page Link to comment Share on other sites More sharing options...
MilesAhead Posted January 21, 2012 Share Posted January 21, 2012 (edited) This page shows how to get the shortcut(if the app was started via shortcut) that started the process, from inside the process:http://www.catch22.net/tuts/undoc01Scroll down to : Detect if an executable was started from a Short-CutInteresting stuff. MS tries to keep the fun info to itself. Edited January 21, 2012 by MilesAhead My Freeware Page Link to comment Share on other sites More sharing options...
LiquidNitrogen Posted January 21, 2012 Author Share Posted January 21, 2012 (edited) This page shows how to get the shortcut(if the app was started via shortcut) that started the process, from inside the process:http://www.catch22.net/tuts/undoc01Scroll down to : Detect if an executable was started from a Short-CutInteresting stuff. MS tries to keep the fun info to itself. But Youre Interested in Getting it from OUTSIDE the Process, Right?Edit: That is Interesting. But I Dont Have much Exp. With Booleans, how Would You Retrieve the Flag to Check it? Edited January 21, 2012 by ReaperX Formerly ReaperX Link to comment Share on other sites More sharing options...
MilesAhead Posted January 21, 2012 Share Posted January 21, 2012 (edited) For my own program it's easy. Just use the undocumented field of STARTUPINFO as shown in the article. From outside another process I don't know of an easy way. All the stuff I've found has to do with CreateRemoteThread and other ways of poking into another process's address space. I don't want to do that. I was just hoping MS secreted away the info somewhere. As it is, I now can get the command line thanks to the WinAPIEx function. That's some progress. For example Irfanview will automatically paste from the clipboard when you launch it with this command line switch: /clippaste but relaunching with no command line switch serves no purpose. In this case I could add the command line switch. But still missing stuff I could get from the .lnk file like custom icon, start folder location etc.. Edited January 21, 2012 by MilesAhead My Freeware Page Link to comment Share on other sites More sharing options...
MilesAhead Posted January 22, 2012 Share Posted January 22, 2012 Well I didn't figure out how to get the STARTUPINFO but thanks to WinAPIEx functions I can get the program path of the active window, the command line args(if there were any) and working directory if it was specified. Almost as good. Doesn't seem to be heavy on CPU or memory. Not bad for a quick and dirty re-launcher. My Freeware Page Link to comment Share on other sites More sharing options...
empach Posted April 30, 2013 Share Posted April 30, 2013 Could be useful. I edited the code a bit. The Fade Out function didn't run because the loop values went from low to high with a negative step. Also got the window handle and used WinActivate instead of GuiSetState WinFadeOut("WinFadeIn/WinFadeOut Functions","") Sleep(1000) WinFadeIn("WinFadeIn/WinFadeOut Functions","") Func WinFadeIn($wTitle, $wText) ;By ReaperX Local $hWnd = WinGetHandle($wTitle) WinActivate($hWnd) ;GUISetState(@SW_SHOW, $hWnd) For $i = 0 to 255 Step 10 WinSetTrans($wTitle, $wText, $i) sleep(60) Next Return EndFunc Func WinFadeOut($wTitle, $wText) ;By ReaperX Local $hWnd = WinGetHandle($wTitle) ;GUISetState(@SW_SHOW, $hWnd) WinActivate($hWnd) For $i = 250 To 0 Step -10 WinSetTrans($wTitle, $wText, $i) sleep(60) Next Return EndFunc Also a param for the embedded sleep() instead of 60 hard wired, would adjust the speed. I'm going to try it on a glassy window where AnimateWindow doesn't work. I'll post back if it works. This one worked for me!! Thanks!! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now