Windows handle of Main window

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
sudip
Posts: 1446
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India
Has thanked: 5 times
Been thanked: 1 time

Windows handle of Main window

Post by sudip » Wed Apr 29, 2009 10:02 am

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: 668
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Has thanked: 24 times
Been thanked: 233 times
Contact:

Post by gfilatov » Wed Apr 29, 2009 10:11 am

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: 1446
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India
Has thanked: 5 times
Been thanked: 1 time

Post by sudip » Wed Apr 29, 2009 11:39 am

Hi Grigory,

Thanks a lot! It works :D

With best regards.

Sudip
With best regards,
Sudip

Post Reply