Click here to Skip to main content
15,905,914 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CList, POSITION and template pointers Pin
Alexandru Savescu27-Nov-02 21:25
Alexandru Savescu27-Nov-02 21:25 
GeneralRe: CList, POSITION and template pointers Pin
Xavier Shay27-Nov-02 22:30
Xavier Shay27-Nov-02 22:30 
GeneralODBC question Pin
Niko Tanghe27-Nov-02 21:11
Niko Tanghe27-Nov-02 21:11 
GeneralMultiple Instance of an application.... Pin
Neha27-Nov-02 20:35
Neha27-Nov-02 20:35 
GeneralRe: Multiple Instance of an application.... Pin
Leedoriden27-Nov-02 20:56
Leedoriden27-Nov-02 20:56 
GeneralRe: Multiple Instance of an application.... Pin
Neha27-Nov-02 21:07
Neha27-Nov-02 21:07 
GeneralRe: Multiple Instance of an application.... Pin
Rohit  Sinha28-Nov-02 10:07
Rohit  Sinha28-Nov-02 10:07 
GeneralRe: Multiple Instance of an application.... Pin
Alvaro Mendez29-Nov-02 9:50
Alvaro Mendez29-Nov-02 9:50 
QuestionHow to Merge two floating dialogbar into one floating tabbed dialogbar? Pin
Yu_Matrix27-Nov-02 20:26
Yu_Matrix27-Nov-02 20:26 
GeneralDownload manager like flashget, download accelator etc Pin
YogeshH27-Nov-02 20:14
YogeshH27-Nov-02 20:14 
GeneralPerformance cost of IsBadReadPtr and IsBadWritePtr... Pin
Matt Gullett27-Nov-02 19:56
Matt Gullett27-Nov-02 19:56 
GeneralRe: Performance cost of IsBadReadPtr and IsBadWritePtr... Pin
Patje27-Nov-02 21:05
Patje27-Nov-02 21:05 
GeneralRe: Performance cost of IsBadReadPtr and IsBadWritePtr... Pin
Matt Gullett28-Nov-02 3:43
Matt Gullett28-Nov-02 3:43 
QuestionHow to deal with it ? thanks Pin
owen_200127-Nov-02 19:44
owen_200127-Nov-02 19:44 
QuestionWhat system dlls do I need to package? Pin
Jamie Hale27-Nov-02 19:32
Jamie Hale27-Nov-02 19:32 
AnswerRe: What system dlls do I need to package? Pin
Michael Dunn27-Nov-02 19:55
sitebuilderMichael Dunn27-Nov-02 19:55 
GeneralRe: What system dlls do I need to package? Pin
Jamie Hale27-Nov-02 20:11
Jamie Hale27-Nov-02 20:11 
GeneralNeed Code for these Pin
amandeeps27-Nov-02 18:50
amandeeps27-Nov-02 18:50 
GeneralRe: Need Code for these Pin
Michael Dunn27-Nov-02 19:29
sitebuilderMichael Dunn27-Nov-02 19:29 
GeneralDialog Windows Hidden Problem :: MFC Pin
valikac27-Nov-02 18:12
valikac27-Nov-02 18:12 
GeneralRe: Dialog Windows Hidden Problem :: MFC Pin
Peak27-Nov-02 20:31
Peak27-Nov-02 20:31 
GeneralRe: Dialog Windows Hidden Problem :: MFC Pin
valikac28-Nov-02 5:40
valikac28-Nov-02 5:40 
General"DestroyWindow" ---- Error!!!! Pin
liuty200627-Nov-02 17:21
liuty200627-Nov-02 17:21 
GeneralRe: "DestroyWindow" ---- Error!!!! Pin
Peak27-Nov-02 20:28
Peak27-Nov-02 20:28 
GeneralLoadLibrary and STDAPI Pin
devvvy27-Nov-02 16:55
devvvy27-Nov-02 16:55 
QUESTION 1:

i just want to confirm that I can register and unregister my ATL-COM wizard created server by calling LoadLibrary and invoke DllRegisterServer/DllUnregisterServer directly - as opposed to command line util Regsvr32.

For some reason, the code is not working, and with no compiler or runtime error - I cant even tell if the function call has been executed. I know however that the register the component does not exist in registry - after i run the following subroutine:


//TO UNREGISTER SERVER:
int UnRegQueryGen(char * pszDll)
{
DWORD dwError;

typedef STDAPI (*PFUNC) (void); //QUESTION 2: This will cause : error C2159: more than one storage class specified

//So, I changed it to:
typedef void (*PFUNC) (void); //and it seems to work fine (i.e. no compiler error)


//<caution! quote="" from="" msdn..="">
//If the string specifies a path but the file does not exist in the specified directory, the function fails. When specifying a path, be sure to use backslashes (\), not forward slashes (/).


//STEP 1: Load dll.
HINSTANCE hLib;
hLib = LoadLibrary(_T(pszDll));


//STEP 2: un-register server
if(hLib!=NULL)
{
PFUNC pFunc = NULL;
pFunc = (PFUNC) GetProcAddress(hLib, _T("DllUnregisterServer"));
if(pFunc!=NULL)
{
//Unregister the server!
pFunc();
}
else
{
//Additional exception handling here.
dwError = GetLastError();
FreeLibrary(hLib);
return 0;
}
}
else
{
//Additional exception handling here.
dwError = GetLastError();
return 0;
}
FreeLibrary(hLib);


return 1;
}

//TO REGISTER A SERVER

int RegQueryGen(char * pszDll)
{

typedef void (*PFUNC) (void);


//STEP 1: Load dll.
HINSTANCE hLib;
hLib = LoadLibrary(_T(pszDll));


//STEP 2: register server
if(hLib!=NULL)
{
PFUNC pFunc = NULL;
pFunc = (PFUNC) GetProcAddress(hLib, _T("DllRegisterServer"));
if(pFunc!=NULL)
{
//register the server!
pFunc();
}
else
{
//Additional exception handling here.
FreeLibrary(hLib);
return 0;
}
}
else
{
//Additional exception handling here.
return 0;
}
FreeLibrary(hLib);

return 1;
}

One last point, the exposed DllRegisterServer and DllUnregisterServer is implemented by ATL Wizard, so, I dont think there's anything to do with it.

Thanks!

norm

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.