Solved

How to get an instance handle?

Posted on 1998-11-09
8
731 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

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
 
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

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.

816 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

11 Experts available now in Live!

Get 1:1 Help Now