Click here to Skip to main content
15,912,329 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to gray out PropertyPage Tabs? Pin
Not Active17-Sep-01 13:15
mentorNot Active17-Sep-01 13:15 
AnswerRe: How to gray out PropertyPage Tabs? Pin
Not Active17-Sep-01 9:33
mentorNot Active17-Sep-01 9:33 
GeneralSAX and encoding Pin
CodeGuy17-Sep-01 8:45
CodeGuy17-Sep-01 8:45 
Generalconvert Pin
17-Sep-01 8:43
suss17-Sep-01 8:43 
GeneralRe: convert Pin
Chris Losinger17-Sep-01 8:52
professionalChris Losinger17-Sep-01 8:52 
QuestionBest way to get a random integer between 0 and X? Pin
Sprudling17-Sep-01 8:27
Sprudling17-Sep-01 8:27 
AnswerRe: Best way to get a random integer between 0 and X? Pin
CodeGuy17-Sep-01 8:39
CodeGuy17-Sep-01 8:39 
GeneralRPC Server not available (cross post) Pin
Bill Wilson17-Sep-01 8:20
Bill Wilson17-Sep-01 8:20 
I am cross posting this because the need is urgent.

The code below, takes a parameterized object name, looks for a specific interface
and trys to call its methods.

It finds the interface with no difficulty but gets the error 0x8007806ba
(The RPC server is unavailable. ).

The same calls work from a VB test script. I'm running this on a Windows 2k server
with SP 2. I've checked all the security parameters (DCOMCNFG) all are set to
default, the same as for the other objects that work fine...

This code used to work, I've modified the object, transfered it to a new program
and now it fails. I did change the name of the interface (I seperated the methods
out from another interface). So I tried the old object, everything works fine. (difference shown as commente line (//OLD.)

It would appear there is something wrong with my new object. I would think the
problem must be in the new object, except that I wrote a VB test app, and it works fine. This makes me think the problem is NOT in the object.

Please Help!!

I'd include the code for the object, but its large, and I'm not sure which parts would be useful...

Thanks, Bill

*******************************************************************************************
This VB code works fine

Dim apminfo As New APMOBJECTLib.MessageInfo

Private Sub Command1_Click()

Dim t As String
t = apminfo.GetFunction("sfddsfsdlfksdflk")

End Sub


*****************************************************************************************

This code locates and connects to the interface (MessageInfo). Every thing here succeeds...

CErrorInfo CServiceMessage::UnpackMessage(VARIANT vBody)

{
CErrorInfo err;
CoInitialize(NULL);
VARIANT vResult;
_bstr_t bstrValue;


m_strBody = GetMessageAsString(vBody);
try
{

// Get Function handler object


CLSID ID;
m_pBroker=NULL;
//OLD CString strObjName = "APMObj.CFunction"; // This works fine when activated
CString strObjName = "APMObject.MessageInfo"; // New object.

// The following line of code succeeds
HRESULT hr = CLSIDFromProgID( strObjName.AllocSysString(), &ID);
if (hr != S_OK)
{
LPTSTR lpMsgBuf;
CString strError;
if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL, hr,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf, 0, NULL ) == 0 ) // Couldn't find error code
{
lpMsgBuf = "Unknown Error";
}

strError.Format("%s: %s %s Error %d: %s.","CConfigServices::Load()",
"Attempting to find object ", m_pParent->m_strObjectName,
hr, lpMsgBuf);
err.SetError(ERR_SEVERITY_MAJOR, CONFIGERROR + CString(strError));
LocalFree(lpMsgBuf);
return err;

}

hr = CoCreateInstance(ID, NULL, CLSCTX_LOCAL_SERVER,
IID_IDispatch, (void **)&(m_pBroker));

if (hr != S_OK)
{
// error handling
}

vResult = GetValue(vBody,CString("GetPriority"),VT_I4);


*******************************************************************************

This code fails

VARIANT CServiceMessage::GetValue(VARIANT vBody, CString strField, int iType)
{

DISPID dispID;
HRESULT hr;
CErrorInfo err;
LPOLESTR olestr;
VARIANT vResult;

try
{
// Unpack function name
olestr = strField.AllocSysString();
TRACEX("Get ID of " + strField);
// the following line of code fails if the new object and interface is used. It works if
// the old object name and interface is used.

hr = m_pBroker->GetIDsOfNames(IID_NULL, &olestr, 1, LOCALE_USER_DEFAULT,
&dispID);
if (hr != S_OK)


// hr is = 0x800706ba (RPC Server Not Found)



Thanks for the help,
Bill
GeneralCreate[10] Pin
84r17-Sep-01 7:03
84r17-Sep-01 7:03 
GeneralRe: Create[10] Pin
Carlos Antollini17-Sep-01 7:34
Carlos Antollini17-Sep-01 7:34 
GeneralRe: Create[10] Pin
84r17-Sep-01 7:58
84r17-Sep-01 7:58 
GeneralRe: Create[10] Pin
Carlos Antollini18-Sep-01 5:17
Carlos Antollini18-Sep-01 5:17 
GeneralRe: Create[10] Pin
Christian Graus17-Sep-01 12:56
protectorChristian Graus17-Sep-01 12:56 
GeneralHelp with Help Pin
otvac17-Sep-01 6:28
otvac17-Sep-01 6:28 
GeneralArabic in Edit Box....Multi-language Pin
17-Sep-01 6:00
suss17-Sep-01 6:00 
GeneralRe: Arabic in Edit Box....Multi-language Pin
Carlos Antollini17-Sep-01 6:49
Carlos Antollini17-Sep-01 6:49 
GeneralCreate Question Pin
17-Sep-01 5:45
suss17-Sep-01 5:45 
GeneralRe: Create Question Pin
17-Sep-01 5:58
suss17-Sep-01 5:58 
GeneralRe: Create Question Pin
17-Sep-01 6:05
suss17-Sep-01 6:05 
GeneralRe: Create Question Pin
Oscar Vazquez17-Sep-01 8:22
Oscar Vazquez17-Sep-01 8:22 
GeneralButtons with symbol character labels Pin
ChrisP17-Sep-01 5:23
ChrisP17-Sep-01 5:23 
GeneralRe: Buttons with symbol character labels Pin
Joaquín M López Muñoz17-Sep-01 6:39
Joaquín M López Muñoz17-Sep-01 6:39 
GeneralStatic object in mfc, only one instance for all instance of my class Pin
Remi Morin17-Sep-01 4:44
Remi Morin17-Sep-01 4:44 
GeneralRe: Static object in mfc, only one instance for all instance of my class Pin
Chris Losinger17-Sep-01 4:51
professionalChris Losinger17-Sep-01 4:51 
GeneralRe: Static object in mfc, only one instance for all instance of my class Pin
Remi Morin17-Sep-01 4:58
Remi Morin17-Sep-01 4:58 

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.