Windows handle of Main window

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
sudip
Posts: 1454
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

Windows handle of Main window

Post 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
With best regards,
Sudip
User avatar
gfilatov
Posts: 1067
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

Re: Windows handle of Main window

Post 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
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
User avatar
sudip
Posts: 1454
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

Re: Windows handle of Main window

Post by sudip »

Hi Grigory,

Thanks a lot! It works :D

With best regards.

Sudip
With best regards,
Sudip
Post Reply