Click here to Skip to main content
15,901,764 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: how to move button when the dialog is resized? Pin
Chuck O'Toole4-Oct-11 12:22
Chuck O'Toole4-Oct-11 12:22 
GeneralRe: how to move button when the dialog is resized? Pin
TheGreatAndPowerfulOz4-Oct-11 12:28
TheGreatAndPowerfulOz4-Oct-11 12:28 
GeneralRe: how to move button when the dialog is resized? Pin
Chuck O'Toole4-Oct-11 13:55
Chuck O'Toole4-Oct-11 13:55 
AnswerRe: how to move button when the dialog is resized? Pin
David Crow4-Oct-11 9:03
David Crow4-Oct-11 9:03 
GeneralRe: how to move button when the dialog is resized? Pin
TheGreatAndPowerfulOz4-Oct-11 9:37
TheGreatAndPowerfulOz4-Oct-11 9:37 
AnswerRe: how to move button when the dialog is resized? Pin
Chuck O'Toole4-Oct-11 12:11
Chuck O'Toole4-Oct-11 12:11 
AnswerRe: how to move button when the dialog is resized? Pin
Rolf Kristensen8-Oct-11 10:38
Rolf Kristensen8-Oct-11 10:38 
QuestionIssue with CreateInstance and E_NOINTERFACE Pin
BeerFizz4-Oct-11 5:16
BeerFizz4-Oct-11 5:16 
Hi,

I have a piece code which I wrote several years ago. This code was written on a XP system with VS2005.

The code worked fine and in fact the existing .exe still works fine on some machines.


Now, this code seems to work on some machines and not on others. I suspect the difference between target machines in 32 or 64 bit, though that may be totally wrong... The development machien is 32 bit XP machine and the machine on which it fails is a Windows 2008 Server R2 64-Bit.


The code will still CoInitialize's and connects just fine and the 'logging in' also works.. Its the call to:

hresult = ptrRS.CreateInstance(__uuidof(Recordset)); // E_NOINTERFACE error

which fails.





This is a snippet of the code:
C++
#include "stdafx.h"


#include <string>

using namespace std;

#include "dbAccess.h"

#include "XYTrace.h"
#pragma comment(lib,"trace.lib")


#include "ATLComTime.h"
#include <comdef.h>
#include "Afxdisp.h"

#include <ole2.h>

#import "C:\Program Files\Common Files\System\ADO\msado15.dll" rename("EOF", "ADOEOF") rename("Property", "PProperty")


/////////////////////////////////////////////////////////////////////////////
//
//	Globals
//
/////////////////////////////////////////////////////////////////////////////
_WebRes			*wr;
HRESULT			hresult;
using			namespace ADODB;
_RecordsetPtr	ptrRS;

.....
.....
.....


/////////////////////////////////////////////////////////////////////////////
//
//	ibsConnect
//
/////////////////////////////////////////////////////////////////////////////
bool ibsConnect(char *userid, char *iniPath)
{
	CLSID clsid;

	hresult = CoInitialize(NULL);
	WriteTrace(TraceXDetail, "CoInitialize returned %x", hresult);
	if(FAILED(hresult)) {
		WriteTrace(TraceError, "****  CoInitialize Failed ");
		return false;
	}
	hresult=CLSIDFromProgID(OLESTR("TTExt.WebRes"), &clsid);
	WriteTrace(TraceXDetail, "CLSIDFromProgID returned %x", hresult);
	if(FAILED(hresult))
	{
		switch (hresult) {
			case CO_E_CLASSSTRING:
				WriteTrace(TraceError, "****  CLSID Failed -- registered CLSID for the ProgID is invalid");
				return false;
				break;
			case REGDB_E_WRITEREGDB:
				WriteTrace(TraceError, "****  CLSID Failed -- error occurred writing the CLSID to the registry.");
				return false;
				break;
			default:
				WriteTrace(TraceError, "****  CLSID Failed -- unknown reason");
				return false;
				break;
		}
	}
		
	hresult=CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, __uuidof(_WebRes), (LPVOID *)&wr);
	WriteTrace(TraceXDetail, "CoCreateInstance returned %x", hresult);
	if(FAILED(hresult))
	{
		switch (hresult) {
			case REGDB_E_CLASSNOTREG:
				WriteTrace(TraceError, "****  CoCreateInstance Failed -- Class not registered");
				return false;
				break;
			case CLASS_E_NOAGGREGATION:
				WriteTrace(TraceError, "****  CoCreateInstance Failed -- class cannot be created as part of an aggregate.");
				return false;
				break;
			case E_NOINTERFACE:
				WriteTrace(TraceError, "****  CoCreateInstance Failed -- class does not implement the requested interface");
				return false;
				break;
			case E_POINTER:
				WriteTrace(TraceError, "****  CoCreateInstance Failed -- ppv parameter is NULL");
				return false;
				break;
			case 0x8007007e:
				WriteTrace(TraceError, "****  CoCreateInstance Failed -- the specified module could not be found");
				return false;
			default:
				WriteTrace(TraceError, "****  CoCreateInstance Failed -- unknown reason - hresult |%x|", hresult);
				return false;
				break;
		}
		return true;
	}

	
	BSTR	bstrMess = NULL;
	char	cStr[256];
	strcpy(cStr, "OK");
	bstrMess = A2BSTR(cStr);

	strcpy(iniPath, "");
	WriteTrace(TraceInfo, "Connecting to IBS database with userid '%s' and ini path '%s'", userid, iniPath);
#	ifdef gt_DLL7302
	if (!wr->Connect(LPCSTR(userid), LPCSTR(iniPath), &bstrMess)) {
#	else
	if (!wr->Connect(LPCSTR(userid), "")) {
#	endif
		WriteTrace(TraceError, "****  TTExt Connect Failed");
		USES_CONVERSION;
		strcpy(errorMess, (W2A(bstrMess)));
		WriteTrace(TraceError, "CONNECT:  return message - '%s'", errorMess);
		SysFreeString(bstrMess);
		return false;
	}

	WriteTrace(TraceXDetail, "CONNECT:  returned");
	USES_CONVERSION;
	strcpy(errorMess, (W2A(bstrMess)));
	WriteTrace(TraceXDetail, "CONNECT:  return message - '%s'", errorMess);
	SysFreeString(bstrMess);


	if (!wr->SetUser(LPCSTR(userid))) {
		WriteTrace(TraceError, "****  TTExt SetUser Failed");
		return false;
	}
	WriteTrace(TraceXDetail, "IBS TTExt SetUser succeeded with userid='%s'", userid);


	hresult = ptrRS.CreateInstance(__uuidof(Recordset));
	if(FAILED(hresult)) {
		WriteTrace(TraceError, "****  ptrRS.CreateInstance Recordset Failed '%x'", hresult);
		return false;
	}

	return true;
}

......
......



//  output from the Trace....


17:45:59_472_D20: Starting GEX Server (Version 1.9.13)
17:45:59_472_D20: 		for ttext.dll Version (DLL 7303)
17:45:59_472_D20: Application name gexServer
17:45:59_472_D20: Parameter: Server listening port:'999'
17:45:59_472_D20: Parameter: Server trace option: 'trace'
17:45:59_492_D20: CoInitialize returned 0
17:45:59_492_D20: CLSIDFromProgID returned 0
17:45:59_502_D20: CoCreateInstance returned 0
17:45:59_502_D20: Connecting to IBS database with userid 'GEX' and ini path ''
17:46:00_013_D20: CONNECT:  returned
17:46:00_013_D20: CONNECT:  return message - 'OK'
17:46:00_013_D20: IBS TTExt SetUser succeeded with userid='GEX'
17:46:00_013_D20: ****  ptrRS.CreateInstance Recordset Failed '80004002'
17:46:00_013_D20: ****  IBS Server connect Failed -- exiting
17:46:00_013_D20: Exiting GEX Server



CLSIDS: Development:
Name: WebRes
GUID: {02CB0046-BA2E-4BA5-B001-BAE2767188A5}
--------------------------------------------------------------------------------
Interface
   {02CB0046-BA2E-4BA5-B001-BAE2767188A5} = WebRes
      ProxyStubClsid = {00020424-0000-0000-C000-000000000046}
      ProxyStubClsid32 = {00020424-0000-0000-C000-000000000046}
      TypeLib = {66CB7502-6F39-4558-8B26-D6BDB18910AA}
      TypeLib[Version] = 1.0
CLSID
   {00020424-0000-0000-C000-000000000046} = PSOAInterface
      InprocServer = ole2disp.dll
      InprocServer32 = oleaut32.dll
      InprocServer32[ThreadingModel] = Both
TypeLib
   {66CB7502-6F39-4558-8B26-D6BDB18910AA} = 
      1.0 = TTExt
         0 = 
            win32 = c:\shared\dll7303\ttext.dll
         FLAGS = 0
         HELPDIR = c:\shared\dll7303




The following are the CLSID's from my development machine, a target machine where it does work and a target machine where it does not work.



CLSIDS: Working:
Name: WebRes
GUID: {02CB0046-BA2E-4BA5-B001-BAE2767188A5}
--------------------------------------------------------------------------------
Interface
   {02CB0046-BA2E-4BA5-B001-BAE2767188A5} = WebRes
      ProxyStubClsid = {00020424-0000-0000-C000-000000000046}
      ProxyStubClsid32 = {00020424-0000-0000-C000-000000000046}
      TypeLib = {66CB7502-6F39-4558-8B26-D6BDB18910AA}
      TypeLib[Version] = 1.0
CLSID
   {00020424-0000-0000-C000-000000000046} = PSOAInterface
   {00020424-0000-0000-C000-000000000046}[PSOAInterface] = 
      InprocServer = ole2disp.dll
      InprocServer[ole2disp.dll] = 
      InprocServer32 = oleaut32.dll
      InprocServer32[ThreadingModel] = Both
      InprocServer32[InprocServer32] = cQb2bTV?j9JZ]N4eNMNY>M5KDYSUnf(HA*L[xeX)y
      InprocServer32[oleaut32.dll] = 
TypeLib
   {66CB7502-6F39-4558-8B26-D6BDB18910AA} = 
      1.0 = TTExt
         0 = 
            win32 = E:\ibs_fdrv\ibs\TeeTimes\TTExt.dll
         FLAGS = 0
         HELPDIR = E:\ibs_fdrv\ibs\TeeTimes


CLSIDS: Failing:
Name: WebRes
GUID: {02CB0046-BA2E-4BA5-B001-BAE2767188A5}
--------------------------------------------------------------------------------
Interface
   {02CB0046-BA2E-4BA5-B001-BAE2767188A5} = WebRes
      ProxyStubClsid = {00020424-0000-0000-C000-000000000046}
      ProxyStubClsid32 = {00020424-0000-0000-C000-000000000046}
      TypeLib = {66CB7502-6F39-4558-8B26-D6BDB18910AA}
      TypeLib[Version] = 1.0
CLSID
   {00020424-0000-0000-C000-000000000046} = PSOAInterface
      InprocServer32 = C:\Windows\system32\oleaut32.dll
      InprocServer32[ThreadingModel] = Both
TypeLib
   {66CB7502-6F39-4558-8B26-D6BDB18910AA} = 
      1.0 = TTExt
         0 = 
            win32 = D:\IBS\ibsconsole\ttext.dll
         FLAGS = 0
         HELPDIR = D:\IBS\ibsconsole



Thanks for all help in advance
Phil
QuestionWin API custom control in a DLL Pin
Igen14-Oct-11 4:35
Igen14-Oct-11 4:35 
AnswerRe: Win API custom control in a DLL Pin
Igen14-Oct-11 5:12
Igen14-Oct-11 5:12 
QuestionHow to clear Object memory of Map Pin
002comp3-Oct-11 21:05
002comp3-Oct-11 21:05 
AnswerRe: How to clear Object memory of Map Pin
Richard MacCutchan3-Oct-11 21:26
mveRichard MacCutchan3-Oct-11 21:26 
GeneralRe: How to clear Object memory of Map Pin
002comp3-Oct-11 22:05
002comp3-Oct-11 22:05 
GeneralRe: How to clear Object memory of Map Pin
Richard MacCutchan3-Oct-11 22:24
mveRichard MacCutchan3-Oct-11 22:24 
GeneralRe: How to clear Object memory of Map Pin
002comp3-Oct-11 22:39
002comp3-Oct-11 22:39 
GeneralRe: How to clear Object memory of Map Pin
Richard MacCutchan4-Oct-11 1:11
mveRichard MacCutchan4-Oct-11 1:11 
GeneralRe: How to clear Object memory of Map Pin
002comp4-Oct-11 2:22
002comp4-Oct-11 2:22 
GeneralRe: How to clear Object memory of Map Pin
Richard MacCutchan4-Oct-11 2:25
mveRichard MacCutchan4-Oct-11 2:25 
AnswerRe: How to clear Object memory of Map Pin
ThatsAlok3-Oct-11 23:53
ThatsAlok3-Oct-11 23:53 
GeneralRe: How to clear Object memory of Map [ how to delete newed object tht we store in map] Pin
002comp4-Oct-11 0:10
002comp4-Oct-11 0:10 
AnswerRe: How to clear Object memory of Map [ how to delete newed object tht we store in map] Pin
ThatsAlok4-Oct-11 21:07
ThatsAlok4-Oct-11 21:07 
AnswerRe: How to clear Object memory of Map Pin
Stefan_Lang4-Oct-11 5:56
Stefan_Lang4-Oct-11 5:56 
SuggestionRe: How to clear Object memory of Map Pin
ThatsAlok4-Oct-11 20:55
ThatsAlok4-Oct-11 20:55 
GeneralRe: How to clear Object memory of Map Pin
Stefan_Lang4-Oct-11 21:50
Stefan_Lang4-Oct-11 21:50 
QuestionApplication getting carshed in release mode not in debug, in the follwing scenario Pin
Amrit Agr3-Oct-11 19:49
Amrit Agr3-Oct-11 19:49 

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.