Solved

How to get an instance handle?

Posted on 1998-11-09
8
732 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
Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

 

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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
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 how to use strings and some functions related to them in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.

791 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