| View previous topic :: View next topic |
| Author |
Message |
cnodnarb Professional Member


Joined: 11 Sep 2002 Posts: 766 Location: Eastman, GA
|
Posted: Tue Apr 26, 2011 10:59 pm Post subject: |
|
|
Works like a champ. And gave me some ideals.
This should work all the way back to win98, win95 questionable if it doesn't have the IE4 Desktop Update.
| Code: |
DIALOG CREATE,New Dialog,-1,0,797,498
dialog add,button,button1,20,20,100,20
REM *** Modified by Dialog Designer on 4/26/2011 - 16:51 ***
DIALOG SHOW
LOADLIB user32.dll
if @ok()
%%controlsampledummy = @lib(user32.dll,SetParent,NIL,@strdel(@winexists(#progman),1,1),@strdel(@winexists(@dlgtext()),1,1))
end
FREELIB user32.dll
wait event
|
Sneaky version
| Code: |
DIALOG CREATE,New Dialog,-1,0,@sysinfo(screenwidth),@sysinfo(screenheight),class #progman,notitle
dialog add,button,button1,20,20,100,20
REM *** Modified by Dialog Designer on 4/26/2011 - 16:51 ***
DIALOG SHOW
LOADLIB user32.dll
if @ok()
%%controlsampledummy = @lib(user32.dll,SetParent,NIL,@strdel(@winexists(#progman),1,1),@strdel(@winexists(@dlgtext()),1,1))
end
FREELIB user32.dll
wait event
exit |
|
|
| Back to top |
|
 |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
Posted: Tue Apr 26, 2011 11:27 pm Post subject: |
|
|
That is sweet!! Thanks!
Now... any way of knowing when an icon is double clicked? LOL
Sorry to keep asking stuff. I know you are trying to kick the habbit.
one more question. it works great but i have restart explorer.exe after. is there anyway to have it restore without doing that? _________________ Chris
Http://theblindhouse.com |
|
| Back to top |
|
 |
cnodnarb Professional Member


Joined: 11 Sep 2002 Posts: 766 Location: Eastman, GA
|
Posted: Wed Apr 27, 2011 1:59 am Post subject: |
|
|
Here's your icon refresh, injures taskicons though. The poor things.
| Code: |
runh taskkill /IM explorer.exe /F,wait
shell open,c:\windows\explorer.exe
|
Important to this thread because it also releases #progman back to the desktop.
For window creation (you really don't need background task right?) use some Window Spy code from this post....
http://www.vdsworld.com/forum/viewtopic.php?t=3797&highlight=spy
For new task if you must monitor use a tasklist.
| Code: |
:timer
list tasklist,list1
if @not(@equal(%%text),@text(list1))
info new task!
end
:evloop
%%text = @text(list1)
wait event,1
goto @event()
|
|
|
| Back to top |
|
 |
cnodnarb Professional Member


Joined: 11 Sep 2002 Posts: 766 Location: Eastman, GA
|
Posted: Wed Apr 27, 2011 3:02 am Post subject: |
|
|
Actually...
I would change the name of sneaky window from #progman to something else.
Have a dummy process (progman.exe) with the class #progman parent the real #progman on close. Just leave it running. Be sure it handles the close event properly, doesn't close on alt+f4 but on window shutdown only.
Then if you need to run your program again, your parenting the dummy #progman process, but to the user they don't see a thing and they don't lose their taskicons.
Yes it's a crappy workaround. So is the other workaround. I'll see if I can find something better. |
|
| Back to top |
|
 |
cnodnarb Professional Member


Joined: 11 Sep 2002 Posts: 766 Location: Eastman, GA
|
Posted: Wed Apr 27, 2011 3:17 am Post subject: |
|
|
Screw workarounds. Unfortunately, this does not refresh icons.
Apologies. I'm taking some pain meds. This is the solution, but it's loopy.
[edit]
The base handle of the desktop is 0. EDIT WRONG
[/edit]
[edit2]
The base handle of the desktop is #progman [GetDesktopWindow()] WRONG
[/edit2]
0 is self.
#progman is not [GetDesktopWindow()].
I don't know what GetDesktopWindow is. Probably not to be screwed with (at the VDS level at least). Disregard...for now.
0 is NULL, which means parent your own damn self.
MDI PROGRAMMERS - THIS IS IMPORTANT STUFF. If you want to release a child window you've parented it's cake.
Hell if you've got enough talent you could even make something with your dialog windows akin to Google Chrome, which is so impressive everyone's stealing it (IE9, Firefox, etc.)
| Code: |
DIALOG CREATE,New Dialog,-1,0,@sysinfo(screenwidth),@sysinfo(screenheight),class #progmanx,notitle
dialog add,button,button1,20,20,100,20
REM *** Modified by Dialog Designer on 4/26/2011 - 16:51 ***
DIALOG SHOW
%%progman = @strdel(@winexists(#progman),1,1)
LOADLIB user32.dll
if @ok()
%%controlsampledummy = @lib(user32.dll,SetParent,NIL,@strdel(@winexists(#progman),1,1),@strdel(@winexists(@dlgtext()),1,1))
end
FREELIB user32.dll
wait event
LOADLIB user32.dll
if @ok()
%%controlsampledummy = @lib(user32.dll,SetParent,NIL,%%progman,0)
end
FREELIB user32.dll
exit
|
Like, edit 5 or something.
In theory you could parent #progman to the desktop window instead of to itself.
| Code: |
%%progman = @strdel(@winexists(#progman),1,1)
LOADLIB user32.dll
if @ok()
%%getdesktop = @lib(user32.dll,GetDesktopWindow,INT,) @winexists(#progman)
info %%getdesktop
end
FREELIB user32.dll
|
I'm guessing GetDesktopWindow will always return 65552 (in windows 7, and if theory holds other windows versions too) I'll run some test later...I could be wrong, but if I did it it would be constant, which I didn't so it's a coin toss. Damnit. I always lose coin tosses...
[EDIT]
Winner winner chicken dinner. Full reboot in Windows 7, desktop window still 65552. Any volunteers on running the function in other windows versions? Please post reply's for win95-winvista -
WRONG will return a different number depending on number of services prior to desktop load. Or might be a constant for specific OS version. It's one or the other. A XP box just returned 65556, so it's not a cross OS constant at minimum.
[/EDIT]
In closing ....
0 is null. Which means do it yourself. ("who will do the dishes? No takers? Crap. On me") Now even though I'm doing it myself I still stand on the ground, GetDesktopWindow.
GetDesktopWindow parents all windows parenting themselves. So setting parent to 0 is same as setting to GetDesktopWindow.
#Progman serves as a good parent if you don't know the two above methods. I know this because I've returned children window to #progman before thinking it was the desktop window. As a fault though, #progman is attached to the explorer.exe process so this was folly.
Thanks,
cnodnarb |
|
| Back to top |
|
 |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
Posted: Wed Apr 27, 2011 1:13 pm Post subject: |
|
|
Wow! Sweet. Thanks a lot again. This'll be fun to play with and see what I can come up with. _________________ Chris
Http://theblindhouse.com |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|