| View previous topic :: View next topic |
| Author |
Message |
manc Grandmaster Cheater
Reputation: 1
Joined: 16 Jun 2006 Posts: 551
|
Posted: Sat Mar 07, 2009 7:51 pm Post subject: Fixed, Solved, Done. No need to enter |
|
|
Thanks, both questions topics were solved.
_________________
Last edited by manc on Sun Mar 08, 2009 9:00 pm; edited 5 times in total |
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Sat Mar 07, 2009 8:23 pm Post subject: |
|
|
minimize all windows.. use enumwindows to get handles to all windows. check with iswindowvisible to see if they are present. if yes then use showwindow to minimize that window.
as for your error you need to wrap what is done in the if/else in curly braces since it is more than 1 line. eg.
| Code: | if ( GetAsyncKeyState( VK_NUMPAD8 ) )
{
minimizeAll();
Sleep(10);
}
else if ( GetAsyncKeyState( VK_NUMPAD9 ) )
{
unminimizeAll();
Sleep(10);
} |
I assume that is what you want to do.. although you could code it like this instead:
| Code: | if ( GetAsyncKeyState( VK_NUMPAD8 ) )
minimizeAll();
else if ( GetAsyncKeyState( VK_NUMPAD9 ) )
unminimizeAll();
Sleep(10); |
Last edited by Slugsnack on Sat Mar 07, 2009 8:28 pm; edited 1 time in total |
|
| Back to top |
|
 |
manc Grandmaster Cheater
Reputation: 1
Joined: 16 Jun 2006 Posts: 551
|
Posted: Sat Mar 07, 2009 8:26 pm Post subject: |
|
|
| Slugsnack wrote: | | minimize all windows.. use enumwindows to get handles to all windows. check with iswindowvisible to see if they are present. if yes then use showwindow to minimize that window. |
the minimizeAll() function is working fine, I'm just confused on how I set it to a hotkey really, and also make a hotkey to restore everything using the unminimzeAll() function
_________________
|
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Sat Mar 07, 2009 8:29 pm Post subject: |
|
|
| as in my edit of my post, inside your while loop you should have if and else if. if you just have if and else, then if the if condition is not met then whatever is in the else is executed. else is unconditional. once you hit that bit it executes whatever is inside there, it takes no condition. look at the code i wrote.
|
|
| Back to top |
|
 |
manc Grandmaster Cheater
Reputation: 1
Joined: 16 Jun 2006 Posts: 551
|
Posted: Sat Mar 07, 2009 8:46 pm Post subject: |
|
|
| Slugsnack wrote: | | if you just have if and else, then if the if condition is not met then whatever is in the else is executed. else is unconditional. |
Oh thats right, thanks.
Any reason why this gives the same error as before?
| Code: | int main()
{
while(1)
{
if ( GetAsyncKeyState( VK_NUMPAD8 ) )
minimizeAll();
waveOutSetVolume(0, 0);
else if ( GetAsyncKeyState( VK_NUMPAD9 ) )
unminimizeAll();
waveOutSetVolume(0, 0xFFFFFFFF);
Sleep(10);
}
}
|
illegal else without matching if...
_________________
|
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Sat Mar 07, 2009 8:56 pm Post subject: |
|
|
| Quote: | | as for your error you need to wrap what is done in the if/else in curly braces since it is more than 1 line |
|
|
| Back to top |
|
 |
manc Grandmaster Cheater
Reputation: 1
Joined: 16 Jun 2006 Posts: 551
|
Posted: Sat Mar 07, 2009 9:07 pm Post subject: |
|
|
Shit my bad, fixed that portion
Unfortunately...
| Quote: | error LNK2001: unresolved external symbol __imp__waveOutSetVolume@8
fatal error LNK1120: 1 unresolved externals
|
By the way, thanks a lot for helping without the usual "Dumbass noob learn the fucking language first, bla bla bla" bullshit
_________________
|
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Sat Mar 07, 2009 9:10 pm Post subject: |
|
|
did you include the header file that waveOutSetVolume is in ?
http://msdn.microsoft.com/en-us/library/ms713762(VS.85).aspx
| Quote: | Windows NT/2000/XP: Included in Windows NT 3.1 and later.
Windows 95/98/Me: Included in Windows 95 and later.
Header: Declared in Mmsystem.h; include Windows.h.
Library: Use Winmm.lib. |
|
|
| Back to top |
|
 |
manc Grandmaster Cheater
Reputation: 1
Joined: 16 Jun 2006 Posts: 551
|
Posted: Sat Mar 07, 2009 9:13 pm Post subject: |
|
|
| Code: | #include "windows.h"
#include <iostream>
using namespace std;
#include "shellapi.h"
#define MIN_ALL 419
#define MIN_ALL_UNDO 416 |
I believe so?
_________________
|
|
| Back to top |
|
 |
iNoobHacker Advanced Cheater
Reputation: 0
Joined: 05 Nov 2006 Posts: 99
|
Posted: Sat Mar 07, 2009 9:15 pm Post subject: |
|
|
Learn the syntax of the language before trying to code anything... I've told you that before, but you don't seem to listen.
Don't expect to code anything good or anything at all without the help of others. (or should I say "help" - "giving you codes")
_________________
"Two things are infinite: the universe and human stupidity, but I'm still not sure about the first one." |
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Sat Mar 07, 2009 9:22 pm Post subject: |
|
|
| Slugsnack wrote: | | Header: Declared in Mmsystem.h; include Windows.h |
|
|
| Back to top |
|
 |
manc Grandmaster Cheater
Reputation: 1
Joined: 16 Jun 2006 Posts: 551
|
Posted: Sat Mar 07, 2009 9:36 pm Post subject: |
|
|
I went ahead and tried including Mmsystem.h, and recieved the same errors, using both ".h " and < .h >
Does the flaw exist in the code if its just a Linker error?
Or does it lie elsewhere?
I even put minimizeall() and waveOutSetVolume() in thier own function,
and put it so it would execute that function if i pressed NumPad8...so i wouldnt need { //code} after if and else if
this worked before with just minimizeall()
so i dont think the error has anything to do with syntax..
ALSO, NoobHacker...
Have you considered shrooms lately?. An ego-death might be beneficial to your persona; your cynical comments might come to an end. But in all honesty, why the fuck do you feel the need to say this shit in all my threads? I purposefully ignored you the first time, and I will continue to do so...
I forget minor syntax elements occasionally, so fucking what?
_________________
|
|
| Back to top |
|
 |
talkerzero Grandmaster Cheater
Reputation: 1
Joined: 24 Jul 2008 Posts: 560 Location: California
|
Posted: Sat Mar 07, 2009 11:09 pm Post subject: |
|
|
For muting the volume, you can use waveOutSetVolume, as I learned in my thread.
| manc wrote: | Shit my bad, fixed that portion
Unfortunately...
| Quote: | error LNK2001: unresolved external symbol __imp__waveOutSetVolume@8
fatal error LNK1120: 1 unresolved externals
|
By the way, thanks a lot for helping without the usual "Dumbass noob learn the fucking language first, bla bla bla" bullshit  |
Add this line to your project. (thanks for helping me when I needed it, Irwin.)
| Code: | | #pragma comment(lib, "winmm.lib") |
|
|
| Back to top |
|
 |
manc Grandmaster Cheater
Reputation: 1
Joined: 16 Jun 2006 Posts: 551
|
Posted: Sat Mar 07, 2009 11:21 pm Post subject: |
|
|
| talker0 wrote: |
Add this line to your project. (thanks for helping me when I needed it, Irwin.)
| Code: | | #pragma comment(lib, "winmm.lib") |
|
Thanks man, compiles fine now.
Is working great <3
Thanks to SlugSnack as well
_________________
|
|
| Back to top |
|
 |
BanMe Master Cheater
Reputation: 0
Joined: 29 Nov 2005 Posts: 375 Location: Farmington NH, USA
|
Posted: Sun Mar 08, 2009 4:04 pm Post subject: |
|
|
ok what have we learned here..
when going to msdn NOTE the lib and header file for use within a project...and locate within your IDE where to include lib files so you wont need the #pragma comment(lib,"") ..
thank you come again..
|
|
| Back to top |
|
 |
|