Link to home
Start Free TrialLog in
Avatar of softyan
softyan

asked on

How to get an instance handle?

Does anyone know that how to get the instance handle inside a dll using win32? Please help!
ASKER CERTIFIED SOLUTION
Avatar of rwilson032697
rwilson032697

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of softyan
softyan

ASKER

Can i use the function like this in the dll?
DialogBox(GetModuleHandle(),"IDD_DIALOG",hwnd,(DLGPROC)CustDlg);
If this would work in a .EXE I see no reasong why it should not in a DLL.
Avatar of softyan

ASKER

I have tried out in and EXE and it worked but not in a dll. Could you pls tell me that how to display a dialog box inside a dll?
Remember that the instance identifies the executable where the dialog box resource resides. Does it reside in the DLL or in the EXE?

hwnd should also be the appropriate window handle from your application.

The API help does not say that this cannot be done.

Raymond

Avatar of softyan

ASKER

When i compile my dll, i compile with the dialog box resource, does this means that the dialog box resource reside in the dll?
The hwnd is the handle of the application which calling this dll. It this the right way?
You can check this by opening the DLL as resources in Studio.

It sounds as though you are doing things right to display the dialog - I can't really offer any other suggestions at the moment.

Raymond.
Avatar of softyan

ASKER

I still cannot find out the way to display a dialog box resource from a dll. Anyway this is your point.