Minimize Window

Hello everyone,

If I were to make a DLL how would I minimize a window that calls the function within the DLL?

I know I have to use the:
1
2
HWND hWnd; //What do I add here to minimize the window??
ShowWindow( hWnd , SW_MINIMIZE );

However I've been messing with the HWND type and cannot find the function I need to apply to my HWND hWnd to get the window. Any ideas?

I am using the Windows.h and WinUser.h included files. Thanks for the help!

Current progress:
1
2
3
4
5
6
7
8
9
10
//WINDOW: Minimize Window DLL;
#include <Windows.h>
#include <WinUser.h>
#define EXPORT extern "C" _declspec(dllexport)

EXPORT double WinMinimize( void ) {
	HWND hWnd;
	ShowWindow( hWnd , SW_MINIMIZE );
	return 0;
}
Last edited on
Well, you can't just call ShowWinow() on some arbitrary handle; you have to give it the handle of the window you want to minimize.
That's why I'm asking this question. What handle would I use to minimize the window using ShowWindow()?

However I've been messing with the HWND type and cannot find the function I need to apply to my HWND hWnd to get the window.
See? Can't figure it out.
Screw it... figured it out haha.
1
2
3
4
5
6
7
8
9
10
11
//WINDOW: Minimize Window DLL;
#include <Windows.h>
#include <WinUser.h>
#define EXPORT extern "C" _declspec(dllexport)

EXPORT double WinMinimize( char* handle ) {
	LPCSTR window = handle;
	HWND hWnd = FindWindow( NULL , window );
	ShowWindow( hWnd , SW_MINIMIZE );
	return 0;
}

That did the trick!
Topic archived. No new replies allowed.