Click here to Skip to main content
15,919,500 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
I made a DLl with VC++6.0

head file of Dll
/////////////////////////////
//                         //
//          DLL.h          //
//                         //
/////////////////////////////

#ifdef      __cplusplus
        
#define     EXPORT extern "C" __declspec (dllexport)
        
#else
        
#define     EXPORT __declspec (dllexport)
        
#endif


typedef tagSTRING_A  //For ANSI
{
char * str ;
int    i ;
}STRING_A ;

typedef tagSTRING_W  //For UNICODE
{
wchar_t * str ;
int       i ;
}STRING_W ;

#ifdef UNICODE

#define STRING STRING_W

#else

#define STRING STRING_A

#endif


I use the Dll in a new project
(
dll.lib \\ include lib in new project library
dll.h \\ include in source-file of new project
dll.dll \\ I copy it at Debug-directroy of new projcet
)

New Project Source
///////////////////////
//                   //
//     project.c     //
//                   //
///////////////////////

#include <windows.h>
#include "dll.h"

STRING str ;
</windows.h>


My problem Is:
when I inputed "str." in source, why VC++6.0 doesnt show help-Menu of member of STRING ?

generally vc++6.0 will show the memeber of help=menu when we input a name of struct-variable and ".".

and we can press Arrow down or Arrow Up to select memeber.

wish someone give me hints
Posted
Updated 19-Jan-11 6:01am
v2
Comments
Nish Nishant 19-Jan-11 12:02pm    
Looks like you are talking about intellisense not working?
tanakahitori 19-Jan-11 12:07pm    
Yes, I saw many #define of Function or struct In header of gdi32.dll

#ifdef UNICODE
#define LOGFONT LOGFONTW
#else
#define LOGFONT LOGFONTA
#endif

why them works , mine doesnt work?

Firstly You must export if you are compiling the DLL, or import if you are compiling something using the DLL.
I am not sure what #define VC6 does in the dll to mark this, but VS08 uses _USRDLL.
You can find this by going to the project properties for the DLL then going to the C/C++ then Preprocessor.
If there isnt something in there that seems to be a definition for compiling the DLL add your own _USRDLL
/////////////////////////////
//                         //
//          DLL.h          //
//                         //
/////////////////////////////

#if defined(_USRDLL) || defined(_DLL)
	#ifdef __cplusplus
		#define PORT extern "C" __declspec(dllexport)
	#else
		#define PORT __declspec(dllexport)
	#endif
#else
	#ifdef __cplusplus
		#define PORT extern "C" __declspec(dllimport)
	#else
		#define PORT __declspec(dllimport)
	#endif
#endif


typedef tagSTRING_A { //For ANSI
	char *str;
	int   i;
} STRING_A;
typedef tagSTRING_W { //For UNICODE
	wchar_t *str;
	int      i;
} STRING_W;

#ifdef UNICODE
	#define STRING STRING_W
#else
	#define STRING STRING_A
#endif


I dont know why it isn't detecting the data type. It could be an issue with your symbols database, VS08 occasionally has this problem.

Im not sure what file extension VC6 uses, but in the main project directory there should be a file (<workspace name="">.ncb in VS08) that holds all the symbols. If you close your solution and delete (or better, rename) this file, Visual Studio will recreate it, hopefully getting rid of any errors.
 
Share this answer
 
Comments
tanakahitori 20-Jan-11 6:56am    
Yes I found this file test.ncb in project directory, I closed vc6 and deleted it and reloard workspace, the file is recreated . and I copy this source to dll.h, but the problem didnt gone.

anyway thank for you answer.
Try doing a clean/full rebuild of the solution (all projects). Intellisense in VC6 was not that great. It has considerably got better in VC++ 2010 (if you have that).
 
Share this answer
 
I found solution of struct of this problem.

it should use "typedef"
typedef tagSTRING_A { //For ANSI
        char * str ;
        int    i ;}
STRING_A ;

typedef tagSTRING_W { //For UNICODE
        wchar_t * str ;
        int       i ;
}STRING_W ;

#ifdef UNICODE

typedef STRING_W STRING ; 
//use "typedef" not "#define" and dont forget " ; " at End of sentence
  
#else

typedef STRING_A STRING ;

#endif


if do like this , when you input str. (STRING str), the memeber help-menu will pop up.

and I will continue find out the solution of function
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900