📄 wpw_wapi_lf_95.html
字号:
<HTML>
<HR><A NAME=WINAPI_HIDE>
Return to <a href="wpw_wapi_index.html#TOC">Table of Contents for this chapter</a><br>
<H4>Subject: How do I hide myself?</H4><PRE>
In article <3rqk7t$kdr@news1.best.com> geek@GeeksRUs.com (Steve Riggins) writes:
>Hello! Its the master of yecc again!
>
>I'm writing a NetScape helper application. When the user opens one of my
>files, NetScape launches me by opening the file. I create my window and post
>an OPEN message to myself.
What's the OPEN message? Do you not get the filename as argv[1]
from the command line when Netscape launches you?
>
>This works great, and I'm even preventing mutliple instances of myself from
>running by using GlobalAtoms.
>
>What I want to do is when the app is run for the first time:
>
>* Show my Window
>* Pause 1 second
>* Minimize myself
>
>I tried using ShowWindow with the minimize command, but I remain active. I wat
>the user to be back in NetScape when I'm done.
>
>Any ideas?
What do you mean 'remain active'? Do you mean you retain the focus?
If you use ShowWindow(hwnd,SW_MINIMIZE), the docs says it it suppsed
to "activate the top-level window in the system's list". If Netscape
is the top-level window, I don't see why it doesn't regain the focus.
Perhaps you need to explicitly re-active Netscape, perhaps with
SetActiveWindow() or SetFocus().
--
John A. Grant jagrant@emr1.emr.ca
Airborne Geophysics
Geological Survey of Canada, Ottawa
In article <DA94AB.Bwz@emr1.emr.ca>
jagrant@emr1.emr.ca (John Grant) writes:
> In article <3rqk7t$kdr@news1.best.com> geek@GeeksRUs.com (Steve Riggins) writes:
> >Hello! Its the master of yecc again!
> >
> >I'm writing a NetScape helper application. When the user opens one of my
> >files, NetScape launches me by opening the file. I create my window and post
> >an OPEN message to myself.
> What's the OPEN message? Do you not get the filename as argv[1]
> from the command line when Netscape launches you?
Yes I do, but I only want one instance of my app, so I wrap the filename up in
a globalatom and send a WM_COMMAND to my first instance and have the second
instance return FALSE. Works fine.
> >
> >This works great, and I'm even preventing mutliple instances of myself from
> >running by using GlobalAtoms.
> >
> >What I want to do is when the app is run for the first time:
> >
> >* Show my Window
> >* Pause 1 second
> >* Minimize myself
> >
> >I tried using ShowWindow with the minimize command, but I remain active. I wat
> >the user to be back in NetScape when I'm done.
> >
> >Any ideas?
> What do you mean 'remain active'? Do you mean you retain the focus?
> If you use ShowWindow(hwnd,SW_MINIMIZE), the docs says it it suppsed
> to "activate the top-level window in the system's list". If Netscape
> is the top-level window, I don't see why it doesn't regain the focus.
>
> Perhaps you need to explicitly re-active Netscape, perhaps with
> SetActiveWindow() or SetFocus().
I tried these, I think. I don't have an HWND to call SetActiveWindow on
though, do I?
Steve
In article <3rrsjf$pvt@news1.best.com> geek@GeeksRUs.com (Steve Riggins) writes:
>In article <DA94AB.Bwz@emr1.emr.ca>
>jagrant@emr1.emr.ca (John Grant) writes:
>
>> In article <3rqk7t$kdr@news1.best.com> geek@GeeksRUs.com (Steve Riggins) writes:
>> >Hello! Its the master of yecc again!
>> >
>> >I'm writing a NetScape helper application. When the user opens one of my
>> >files, NetScape launches me by opening the file. I create my window and post
>> >an OPEN message to myself.
>> What's the OPEN message? Do you not get the filename as argv[1]
>> from the command line when Netscape launches you?
>
>
>Yes I do, but I only want one instance of my app, so I wrap the filename up in
>a globalatom and send a WM_COMMAND to my first instance and have the second
>instance return FALSE. Works fine.
>
>> >
>> >This works great, and I'm even preventing mutliple instances of myself from
>> >running by using GlobalAtoms.
>> >
>> >What I want to do is when the app is run for the first time:
>> >
>> >* Show my Window
>> >* Pause 1 second
>> >* Minimize myself
>> >
>> >I tried using ShowWindow with the minimize command, but I remain active. I wat
>> >the user to be back in NetScape when I'm done.
>> >
>> >Any ideas?
>> What do you mean 'remain active'? Do you mean you retain the focus?
>> If you use ShowWindow(hwnd,SW_MINIMIZE), the docs says it it suppsed
>> to "activate the top-level window in the system's list". If Netscape
>> is the top-level window, I don't see why it doesn't regain the focus.
>>
>> Perhaps you need to explicitly re-active Netscape, perhaps with
>> SetActiveWindow() or SetFocus().
>
>I tried these, I think. I don't have an HWND to call SetActiveWindow on
>though, do I?
Use FindWindow() or EnumWindows() to find the HWND of Netscape.
--
John A. Grant jagrant@emr1.emr.ca
Airborne Geophysics
Geological Survey of Canada, Ottawa
<HR>
Once upon a time, geek@GeeksRUs.com (Steve Riggins) wrote:
>I'm writing a NetScape helper application. When the user opens one of my
>files, NetScape launches me by opening the file. I create my window and post
>an OPEN message to myself.
>What I want to do is when the app is run for the first time:
>* Show my Window
>* Pause 1 second
>* Minimize myself
>I tried using ShowWindow with the minimize command, but I remain active. I wat
>the user to be back in NetScape when I'm done.
>Any ideas?
Well, I don't actually have any direct ideas, but figure out what the
minimize button generates when the user presses it? It seems like
that's the behavior you want. Perhaps you could use spy to see what
messages get generated.
___________________________________________________________
Marty Fried - mfried@linex.com | KEYBOARD ERROR...
San Anselmo, CA | Press any key to continue
(MSVC + MFC) && Win95; | or any other key to quit
-----------------------------------------------------------
</PRE>
<HR><A NAME=WINAPI_WALL_PAPER>
Return to <a href="wpw_wapi_index.html#TOC">Table of Contents for this chapter</a><br>
<H4>Subject: How do I change windows wall paper?</H4><PRE>
In article <3rv2n7$lvb@news.cais.com> nbe@cais3.cais.com (NBE_at_CAIS_com) writes:
>
>Got a couple questions about stuff I've not tried yet...
>
>When making some changes to the win.ini (specifically to the extensions
>section, and the screensaver and wallpaper entries in the desktop sections),
>how do I get Windows to recognize the changes without restarting Windows?
>
>From a note just previously posted, someone mentioned regedit? or similar
>function for extensions. I will check the SDK for that, but I still
>need to know how to get the Wallpaper and Screensaver registered.
>
>TIA,
> Alan
You shouldn't use WriteProfileString to set the wallpaper. The
correct API function for wallpaper settings is:
SystemParametersInfo(SPI_SETDESKWALLPAPER,0,"xxx.bmp",
SPIF_UPDATEINIFILE);
The SPIF_UPDATEINIFILE takes care of updating the info.
I don't know the official method for setting the screensaver.
--
John A. Grant jagrant@emr1.emr.ca
Airborne Geophysics
Geological Survey of Canada, Ottawa
</PRE>
<HR><A NAME=WINAPI_SET_BG_COLOR>
Return to <a href="wpw_wapi_index.html#TOC">Table of Contents for this chapter</a><br>
<H4>Subject: Setting Background Color</H4><PRE>
I threw together an application using the Borland Object Windows stuff,
and I want to change the background color of the main windoe that comes
up. I have found the SetBkgndColor command, and assume I can use that
when the window is being initialized to set the background color. One
problem though, it says that the color is a uint32, but it doesn't say
anywhere I can find how to assemble the color to put in there. I haven't
even been able to find default windows colors that might be defined
somewhere. Have mercy on me, I'm fairly new to this Windoze stuff, and
am rapidly running out of steam...
-jimi
<HR>
In article <3s20if$duc@clarknet.clark.net> jimi@clark.net writes:
> I threw together an application using the Borland Object Windows stuff,
> and I want to change the background color of the main windoe that comes
> up. I have found the SetBkgndColor command, and assume I can use that
> when the window is being initialized to set the background color. One
> problem though, it says that the color is a uint32, but it doesn't say
> anywhere I can find how to assemble the color to put in there. I haven't
> even been able to find default windows colors that might be defined
> somewhere. Have mercy on me, I'm fairly new to this Windoze stuff, and
> am rapidly running out of steam...
>
> -jimi
>
Try registering the window class with the hbrBackgnd of the WNDCLASS structure
containing the colour you want the background to be!
You can use some of the windows default colours (Button Face/Text, Tittle Bar
Text/Background etc.) by using the GetSysColor() function.
As for the colour being a uint32, it is realy easy! Here are the bits of the
32bit value and what they represent:
|23 22 21 20 19 18 17 16|15 14 13 12 11 10 09 08| 07 06 05 04 03 02 01 00|
| Red value 0-255 | Green value 0-255 | Blue value 0-255 |
where red,green and blue are the saturation of the colours to make up the
colour you want! EG. r255, g0, b0 =Red! r255, g190, b0 =Orange etc.
This can be created using the RGB macro in MSVC++. It has the format:
long colour = RGB(red, green, blue);
I hope this points you in the right direction! And keep going, you will get
the hang of it sometime! (We all did at some time or another!)
Regards,
Jonnathon ;-)
--
<HR>
I was just about to help you, and you had to go and spoil it all in the
last sentence....
Sorry.
Chris
--
--------------------------------------------------------------------------
| Chris Marriott, Warrington, UK | Author of SkyMap v2 shareware |
| chris@chrism.demon.co.uk | astronomy program for Windows. |
| For more info, see http://www.winternet.com/~jasc/skymap.html |
| Author member of Association of Shareware Professionals (ASP) |
--------------------------------------------------------------------------
<HR>
Not being a Borland OWL fan, I beleive they are refering to the RGB value
normally referred to as COLORREF
Richard Gagnon
Consulting/Contract Windows 3.1/NT Programmer
VC++, VB3.0, and now Delphi (whoopi Pascal again)
<HR>
Or try using OnEraseBackground in MFC or WM_ONERASEBACKGROUND.
return a HBRUSH for the color you want your background to be.
<HR>
In article <803554460snz@cafe.glassnet.com> Jonnathon Tann <johnt@cafe.glassnet.com> writes:
>In article <3s20if$duc@clarknet.clark.net> jimi@clark.net writes:
>> I threw together an application using the Borland Object Windows stuff,
>> and I want to change the background color of the main windoe that comes
>> up. I have found the SetBkgndColor command, and assume I can use that
>> when the window is being initialized to set the background color. One
>> problem though, it says that the color is a uint32, but it doesn't say
>> anywhere I can find how to assemble the color to put in there. I haven't
>> even been able to find default windows colors that might be defined
>> somewhere. Have mercy on me, I'm fairly new to this Windoze stuff, and
>> am rapidly running out of steam...
>>
>> -jimi
>>
>Try registering the window class with the hbrBackgnd of the WNDCLASS structure
>containing the colour you want the background to be!
>You can use some of the windows default colours (Button Face/Text, Tittle Bar
>Text/Background etc.) by using the GetSysColor() function.
>As for the colour being a uint32, it is realy easy! Here are the bits of the
>32bit value and what they represent:
> |23 22 21 20 19 18 17 16|15 14 13 12 11 10 09 08| 07 06 05 04 03 02 01 00|
> | Red value 0-255 | Green value 0-255 | Blue value 0-255 |
>where red,green and blue are the saturation of the colours to make up the
>colour you want! EG. r255, g0, b0 =Red! r255, g190, b0 =Orange etc.
>This can be created using the RGB macro in MSVC++. It has the format:
>long colour = RGB(red, green, blue);
>I hope this points you in the right direction! And keep going, you will get
>the hang of it sometime! (We all did at some time or another!)
>Regards,
> Jonnathon ;-)
>--
The more common and probably easier approach is to respond to WM_CTLCOLOR, or
whatever override OWL provides.
Kit Kauffmann - kitk@mudshark.sunquest.com
AKA 73363,447 (Compu$erve)
Finger me for my public key
<HR>
>>> I threw together an application using the Borland Object Windows stuff,
>>> and I want to change the background color of the main windoe that comes
>>> up. I have found the SetBkgndColor command, and assume I can use that
>>> when the window is being initialized to set the background color. One
>>> problem though, it says that the color is a uint32, but it doesn't say
>>> anywhere I can find how to assemble the color to put in there. I haven't
>>> even been able to find default windows colors that might be defined
>>> somewhere. Have mercy on me, I'm fairly new to this Windoze stuff, and
>>> am rapidly running out of steam...
>>>
>>> -jimi
Don't worry about registering window classes, etc. like someone else
suggested. For OWL, you're on the right track. I'm not near my manuals, so
this is from memory, but try:
SetBkgndColor(RGB(redvalue, greenvalue, bluevalue));
// color values between 0 & 255
For Windows system colors, try:
SetBkgndColor(GetSysColor(COLOR_ACTIVECAPTION));
// COLOR_ * defined in Windows API
There's other ways to put a color value together, but these two are easiest.
Look in the Windows API help for a list of the COLOR_ definitions. It took me
a second to find, but I think if you search for "color" or "system" you'll
find it. If my info doesn't work, e-mail me and we'll figure it out.
</PRE>
<HR><A NAME=WINAPI_WIN95_3D_LOOK>
Return to <a href="wpw_wapi_index.html#TOC">Table of Contents for this chapter</a><br>
<H4>Subject: 3D Look in Win95</H4><PRE>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -