Page 1 of 1

Windows handle of Main window

Posted: Wed Apr 29, 2009 10:02 am
by sudip
Hi,

Is there any way to get the windows handle of the Main Window?

I need it for some C function.

Regards.

Sudip

Re: Windows handle of Main window

Posted: Wed Apr 29, 2009 10:11 am
by gfilatov
sudip wrote:Hi,

Is there any way to get the windows handle of the Main Window?

I need it for some C function.
Hi Sudip,

Yes, of course.
Try the function GetFormHandle (FormName). :arrow:
Take a look for a working sample below:

Code: Select all

/*
* MiniGUI DLL Demo
*/


#include "minigui.ch"

Function Main

	DEFINE WINDOW Win_1 ;
		AT 0,0 ;
		WIDTH 400 ;
		HEIGHT 400 ;
		TITLE 'Hello World!' ;
		MAIN 
	
		DEFINE MAIN MENU
			DEFINE POPUP 'Test'
				MENUITEM 'Test' ACTION CallDll32 ( "SetWindowText" , "USER32.DLL" , GetFormHandle ('Win_1') , "New title"  )
			END POPUP
		END MENU

	END WINDOW

	ACTIVATE WINDOW Win_1

Return

Re: Windows handle of Main window

Posted: Wed Apr 29, 2009 11:39 am
by sudip
Hi Grigory,

Thanks a lot! It works :D

With best regards.

Sudip