Home
Download
Screenshots

Wiki
Plugins
Translations
Developers
Donate

Forums/Help
Contact Us

StrokeIt

Hiding Windows

Posted by Sjoerd 
Sjoerd
Hiding Windows
March 21, 2003 09:57AM
Hello there,

I'm wondering how I could hide a window.

I asked somebody I know how to hide a window; which is:
ShowWindow(WindowHandle,SW_HIDE);

But now I'm wondering how I can convert this to a StrokeIt command.

Regards,
Sjoerd

sjoerd_job_p AT softhome DOT net
Jeff
Re: Hiding Windows
March 21, 2003 10:13AM
You'll have to create a plugin to do it.

Assuming you have a compiler and the StrokeIt SDK, it should would be a really simple plugin that would probably look something like this:


------- ShowHide.cpp ---------

#include "siPlugin.h"
#include "Plugin.h"
#include "StrLib.h"
#include "resource.h"

// predeclare our functions
EXEC(Hide);
EXEC(Show);

// declare the command pointers
s_pluginCommand *pHide;
s_pluginCommand *pShow;


INIT() // do not put a brace here

pMove = NewCommand("hide", STR(HIDE), STR(HIDE_DESC), ICON_HIDE, Hide, NULL, NULL, NULL);
pSize = NewCommand("show", STR(SHOW), STR(SHOW_DESC), ICON_SHOW, Show, NULL, NULL, NULL);

RETURN("Hide/Show Windows Plugin");
}

void Quit() {
DeleteCommands(); // remove the command list
}


EXEC(Hide) {

ShowWindow(params->hWnd, SW_HIDE);
return NULL;

}

EXEC(Show) {
ShowWindow(params->hWnd, SW_SHOW);
return NULL;
}
Sjoerd
Re: Hiding Windows
March 21, 2003 10:26AM
Ok; I'm going to install Visual C then.

I'll get back to you if it works; or not.

Please remember that I'm not a developer by proffession; nor by hobby; so I just hope this works :).

I've also downloaded the SDK now; so in a few I should be all set :).

Thank you in advance :)
Jeff
Re: Hiding Windows
March 21, 2003 11:53AM
If you're not a developer, here's a little bit more help for making this work:

Within the SDK, "Sample.cpp" is the plugin source and Strings.h is the strings definition file, all the other stuff is the SDK wrapper, which you shouldn't have to mess with.

You're going to need to edit Strings.h to look like:

----- Begin Strings.h -----

VERSION(1.0)

STR(HIDE)
STR(SHOW)

STR(HIDE_DESC)
STR(SHOW_DESC)

----- End Strings.h -----

Then you'll need to create the "English.lng" (Or "Dutch.lng", if you prefer)

----- Begin English.lng -----

VERSION:1.0

Windows - Hide Window
Windows - Show Window

Hide the window.
Show the window.

----- End English.lng -----


The plugin also references two icons: ICON_SHOW and ICON_HIDE. You'll have to use the resource editor to create these icons.


Good luck,

Jeff
Sjoerd
Re: Hiding Windows
March 21, 2003 01:51PM
Ok;

I seem to have a bit of a problem here...

I am using MS C++ 5; and MS Dev Studio 97.

I can't update; this is all I have :(

When I compile the sample SDK file; it gives 2 warnings and 2 errors.

~~~~~~~Begin~~~~~~~
--------------------Configuration: Sample - Win32 Debug--------------------
Compiling resources...
Compiling...
Command line warning D4002 : ignoring unknown option '/ZI'
Command line warning D4002 : ignoring unknown option '/GZ'
Plugin.cpp
Sample.cpp
D:\Downloads\StrokeIt_SDK\Sample\Sample.cpp(170) : error C2664: 'Dialog' : cannot convert parameter 3 from 'int (void *,unsigned int,unsigned int,long)' to 'int (__stdcall *)(void)'
StrLib.cpp
D:\Downloads\StrokeIt_SDK\Sample\StrLib.cpp(621) : error C2561: 'num_to_chr' : function must return a value
Error executing cl.exe.

Sample.dll - 2 error(s), 2 warning(s)

~~~~~~~End~~~~~~~

I'm about to blaim the compiler; because that's all I can blame.
Jeff
Re: Hiding Windows
March 21, 2003 03:02PM
You can replace everything that's in Sample.cpp with the code I posted in my first message here. The code I posted doesn't use a dialog, so that should take care of your first error.

For the second error, open up StrLib.cpp, scroll to line 621 and change the word "static" to "void":

Before:
static num_to_chr(unsigned long n) {

After
void num_to_chr(unsigned long n) {


Good luck,

Jeff
Sjoerd
Re: Hiding Windows
March 21, 2003 03:34PM
Hrm; I forgot to mention that was the plain sample plugin not yet modified; the modified plugin gave a few more errors; but I just changed what you told me to already and compiled it again

~~~
--------------------Configuration: Sample - Win32 Debug--------------------
Compiling resources...
Compiling...
Command line warning D4002 : ignoring unknown option '/ZI'
Command line warning D4002 : ignoring unknown option '/GZ'
Plugin.cpp
Sample.cpp
D:\Downloads\StrokeIt_SDK\Sample\Sample.cpp(12) : error C2065: 'pMove' : undeclared identifier
D:\Downloads\StrokeIt_SDK\Sample\Sample.cpp(12) : error C2440: '=' : cannot convert from 'struct s_pluginCommand *' to 'int'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
D:\Downloads\StrokeIt_SDK\Sample\Sample.cpp(13) : error C2065: 'pSize' : undeclared identifier
D:\Downloads\StrokeIt_SDK\Sample\Sample.cpp(13) : error C2440: '=' : cannot convert from 'struct s_pluginCommand *' to 'int'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
StrLib.cpp
Error executing cl.exe.

Sample.dll - 4 error(s), 2 warning(s)
~~~

I need to declare these two identifiers somehow; which I;m not aqcuinted with either :(.

I'm sorry for all the problems I'm making you go through because I'm an unexperienced coder :(.

BTW: I really like how close the devs are to the users; and it's cool to see that the developers actually take the time to help the end-users with making plugins; even though the developers are actually making them :).

Thanks again; and Thanks in advance
Jeff
Re: Hiding Windows
March 21, 2003 03:56PM
Sjoerd, you're really close to making this work, the errors you're getting are actually my typos from the first message:

change:

pMove = NewCommand("hide", STR(HIDE), STR(HIDE_DESC), ICON_HIDE, Hide, NULL, NULL, NULL);
pSize = NewCommand("show", STR(SHOW), STR(SHOW_DESC), ICON_SHOW, Show, NULL, NULL, NULL);

to:

pHide = NewCommand("hide", STR(HIDE), STR(HIDE_DESC), ICON_HIDE, Hide, NULL, NULL, NULL);
pShow = NewCommand("show", STR(SHOW), STR(SHOW_DESC), ICON_SHOW, Show, NULL, NULL, NULL);


I'm glad you're taking the time to work through this and provide so much feedback.

-- Jeff
Sjoerd
Re: Hiding Windows
March 22, 2003 11:21AM
Sorry for the delayed response; I had to go to bed; and had other responsibilities the beginning of this day.

It works now; except for one thing; the strings :)

The strings-thingie isn't that big of a deal; I'm not gonna release it; since all code is yours; but it'd be nice if I could get it to work :)

Am I right to assume that the plugin automaticly adds all the strings in <lng>.lng to it's compiled version; or do I have to place <lng>.lng somewhere else for it to pick up the values?

Well; it's a great relief for me to at least have it working :)

Thank you! Not only did you help me to get this to work; but also revived urge to go back into the programming world :)! ( Well; start to try to program that is ;) )
Sjoerd
Re: Hiding Windows
March 22, 2003 12:15PM
Ignore the above message; it works great now :)

I had to go to the StrokeIt/Strings directory; create a directory called ShowHide ( after the $$$$.dll ); and put English.lng in it :)

Thank you for all your help :)!!!!!!!!!!!!!!!

I've got it working now :)!

The icons look ugly; but I'm not creative enough to think of a hide-icon :); although now I think of it; I just got a great idea :D!!!
Jeff
Re: Hiding Windows
March 22, 2003 01:41PM
Sjoerd,

I'm happy that you've figured everything out, and I hope you enjoy your new plugin.

Hopefully other people who are looking to develop simple plugins can learn from this thread.

-- Jeff
Author:

Your Email:


Subject:


Attachments:
  • Valid attachments: zip, sxp, cfg
  • No file can be larger than 128 KB
  • All files together cannot be larger than 512 KB
  • 4 more file(s) can be attached to this message

Spam prevention:
Please, solve the mathematical question and enter the answer in the input field below. This is for blocking bots that try to post this form automatically.
Question: how much is 22 plus 15?
Message: