Solved

How to get an instance handle?

Posted on 1998-11-09
8
725 Views
Last Modified: 2008-03-06
Does anyone know that how to get the instance handle inside a dll using win32? Please help!
0
Comment
Question by:softyan
  • 4
  • 4
8 Comments
 
LVL 12

Accepted Solution

by:
rwilson032697 earned 50 total points
ID: 1254123
Use GetModuleHandle.

Cheers,

Raymond.
0
 

Author Comment

by:softyan
ID: 1254124
Can i use the function like this in the dll?
DialogBox(GetModuleHandle(),"IDD_DIALOG",hwnd,(DLGPROC)CustDlg);
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1254125
If this would work in a .EXE I see no reasong why it should not in a DLL.
0
 

Author Comment

by:softyan
ID: 1254126
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?
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 12

Expert Comment

by:rwilson032697
ID: 1254127
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

0
 

Author Comment

by:softyan
ID: 1254128
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?
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1254129
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.
0
 

Author Comment

by:softyan
ID: 1254130
I still cannot find out the way to display a dialog box resource from a dll. Anyway this is your point.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now