|
Hi,
i have an com application which keeps track of another application and displays the message accordingly.
but it gives error70 when we handle the application to and fro very frequently.
can anyone help me on Error-70 or any idea about the possible reasons.
thanks in advance
amolk
|
|
|
|
|
Hai friends,
I am get an error "The stub received bad data" while calling CreateInstance function.
But some times its working.
I am using a COM Exe as server. I am using a regular dll to call the interface functions of COM Server. I am getting this error in dll.I had registered the COM Exe using regerver.
OS installed : WindowsXP Service Pack 2
Platform : VC++6.0 Service Pack 6
Can anybody help me to solve?
With regards,
appoos
Known is a drop, unknown is an ocean
|
|
|
|
|
Hello,
1. Have you initialized all your variables inside com server? Some memory garbage can cause the problem
2. It can be some timing problem with initialization. Try to play with some delays (just use Sleep(…)) inside constructor and FinalConstruct() method of your exe com server.
Regards,
|
|
|
|
|
i have made the plugin in VC for outlook so when i send mail the micorsoft word page remain open i want to close that page so any1 can help me in this regard.
the code for initilizing the word is as follow
if(EditorType==olEditorWord)
{
HWND hwnd;
hwnd = ::GetForegroundWindow();
HRESULT hr = EnumChildWindows(hwnd, &EnumWindowsProc, NULL);
CComPtr<idispatch>Dispatch;
spInspect->get_WordEditor((IDispatch**)&Dispatch);
DISPID dispp;
OLECHAR FAR* szMemberpName;
EXCEPINFO pexcep;
UINT uArgErr;
DISPPARAMS disparams={NULL,NULL,0,0};
szMemberpName = L"Close";
VARIANTARG ApResult;
Dispatch->GetIDsOfNames (IID_NULL, &szMemberpName, 1, LOCALE_SYSTEM_DEFAULT, &dispp);
hr = Dispatch->Invoke(dispp, IID_NULL, LOCALE_SYSTEM_DEFAULT,DISPATCH_METHOD, &disparams, &ApResult, &pexcep, &uArgErr);
if(FAILED(hr))
{
_bstr_t des;
char * ii;
des = pexcep.bstrDescription;
ii = (char*) des;
}
else
{}
|
|
|
|
|
Hi all ,
How can I get the path of a COM DLL ??
I am using this way..
Inside DLL , I am writing this code.
/******************************************************/
HINSTANCE g_hInst;
TCHAR szModule[MAX_PATH];
g_hInst = _Module.GetModuleInstance();
GetModuleFileName(g_hInst, szModule, MAX_PATH);
/*******************************************************/
I am getting the Path . But am getting in this form..
"D:\THINVI~1\INTEGR~1.DLL" .
The tilt sign makes the folder and file names incomplete . My actual path is
"D:\THINVISITS_14-2-07\INTEGRALHOTBAR.DLL"
So how can I get my dll path in the complete form without Tilt(~)..
Please Help Me
Thanks
George.
|
|
|
|
|
Add an additional call to GetLongPathName .
Steve
|
|
|
|
|
Hi all,
I have a VB applicatiOn , which calls a function in VC++ DLL.
Arguement of function is a one dimensional string array.
Array will get filled in VC++ dll function.
I have written the programme given below.
But I am unable to get the array elements from VC++.
Programme is given below.
VC++ COM
/*****************************************/
STDMETHODIMP CTest111CL::myFun(SAFEARRAY **ppOutputArray)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
HRESULT hresult;
SAFEARRAYBOUND aDim[1] ;
aDim[0].lLbound = 0;
aDim[0].cElements = 3;
BSTR HUGEP *pbstr;
*ppOutputArray = SafeArrayCreate(VT_BSTR , 1, aDim);
hresult=SafeArrayAccessData(*ppOutputArray,(void HUGEP**)&pbstr);
pbstr[0] = SysAllocString(OLESTR("SOURCE_VA"));
pbstr[1] = SysAllocString(OLESTR("ACV"));
pbstr[2] = SysAllocString(OLESTR("10"));
SafeArrayUnaccessData(*ppOutputArray);
return S_OK;
}
/**********************************************/
VB Application
---------------
''''''''''''''''''''''''''''
Dim i As Test111CL
Private Sub Command1_Click()
Dim arr_str(3) As String
Set i = New Test111CL
i.myFun arr_str()
MsgBox arr_str(1)
End Sub
''''''''''''''''''''''''''
MsgBox arr_str(1) , The message Box shows and empty string.
How can I rectify it. Please help me.
Thanks
George
-- modified at 4:53 Friday 9th February, 2007
|
|
|
|
|
Hello,
Try this:
Idl: HRESULT FunName([in,out] SAFEARRAY(BSTR)* pbsData);
.h: STDMETHOD(FunName)((SAFEARRAY** pbsData);
.cpp: STDMETHODIMP ClassName:: FunName(SAFEARRAY** pbsData)
{
//checking if it is an one-dimensional array
if((*pbsData)->cDims != 1)
return E_FAIL;
//Checking the number of elements of the array
if(3 != (*pbsData)->rgsabound[0].cElements)
return E_FAIL;
// locking the array before using its elements
HRESULT hr = SafeArrayLock(*pbsData);
if(FAILED(hr))
return E_FAIL;
// using the array
BSTR* pbs = (BSTR*)(*pbsData)->pvData;
pbs[0] = …
pbs[1] = …
pbs[2] = …
…
// releasing the array
return SafeArrayUnlock(*pbsData);
}
VB: Option Explicit
Option Base 1
Dim sArr(1 To 3) As String
Call ….FunName(sArr)
Regards,
|
|
|
|
|
Hi lafleon ,
Its working excellent . I have implemented it for a 3d array and got correct result.
Thank you Very much for your help.
George
|
|
|
|
|
Hello,
Read the article on MSDN: “How to Pass Arrays between Visual Basic and C”. http://support.microsoft.com/kb/207931
Regards
|
|
|
|
|
Some more links:
1. "Passing an array from VC++ DLL to VB", by Amol Kakhandki on Code project. http://www.codeproject.com/dll/ctovbarray_passing.asp
2. http://www.manbu.net/Lib/En/Class5/Sub7/1/23.asp
|
|
|
|
|
Hi All,
I want to enumerate menu item identifiers of MS-Office apps. I found all MS-Office apps share resources stroed in some dll (MSO.dll, may be wrong). I like to disable some menu items by using subclassing or something else. So can anybody help to enumerate these id's.
Thanks a lot!
- Santosh
-- modified at 4:14 Friday 9th February, 2007
|
|
|
|
|
Hi all,
I have code for passing 2d array from VC++ to VB6(Code is given below), But My need is to pass a 3d array from VC++ to VB6, Can any one pleas replace the code I have given for 2d to 3d
STDMETHODIMP TestMacroInterface::ProcessStringArray(SAFEARRAY**ppOutputArray)
{
HRESULT hresult;
SAFEARRAYBOUND aDim[2]
aDim[0].lLbound = 0;
aDim[0].cElements = 3;
aDim[1].lLbound = 0;
aDim[1].cElements = 2
BSTR HUGEP *pbstr;
*ppOutputArray=SafeArrayCreate(VT_BSTR , 2, aDim);
if (*ppOutputArray==NULL)
{
::MessageBox(NULL, _T("NOT_OK"), _T("Pickup"), MB_OK);
}
else
hresult=SafeArrayAccessData(*ppOutputArray,(void HUGEP**)&pbstr)
pbstr[0][0] = SysAllocString(OLESTR("SOURCE_VA"));
pbstr[0][1] = SysAllocString(OLESTR("ACV"));
pbstr[0][2] = SysAllocString(OLESTR("10"));
SafeArrayUnaccessData(*ppOutputArray);
}
Thanks
George
|
|
|
|
|
georgekjolly wrote: SAFEARRAYBOUND aDim[2]
aDim[0].lLbound = 0;
aDim[0].cElements = 3;
aDim[1].lLbound = 0;
aDim[1].cElements = 2
BSTR HUGEP *pbstr;
*ppOutputArray=SafeArrayCreate(VT_BSTR , 2, aDim);
if (*ppOutputArray==NULL)
{
::MessageBox(NULL, _T("NOT_OK"), _T("Pickup"), MB_OK);
}
Change this to,
SAFEARRAYBOUND aDim[3]
aDim[0].lLbound = 0;
aDim[0].cElements = 3;
aDim[1].lLbound = 0;
aDim[1].cElements = 3
aDim[2].lLbound = 0;
aDim[2].cElements = 3
BSTR HUGEP *pbstr;
*ppOutputArray=SafeArrayCreate(VT_BSTR , 3, aDim);
if (*ppOutputArray==NULL)
{
|
|
|
|
|
Hi Prasad,
Thank you very much.
And some more help please ..
1-> How can I pass a 3d array from VB to VC++ ( Just code )
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim i As Test33CL
Dim iArray(1 To 3, 1 To 3, 1 To 3) As String
Private Sub Command1_Click()
Set i = New Test33CL
i.StringFun (iArray)
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Is there is a riht way , I am getting error.
2-> how to assign string value to BSTR *pbstr.
Thanks
George
|
|
|
|
|
Hi George,
I'm not VB guy. Lets wait some body to solve your query.
|
|
|
|
|
Hai Prasad,
Sorry for again disturbing u .. It is an assignment for me from a company ,If I am clearing this I will get Job there...
Please Just See my assignment of String to the 3d array is in Right way ,Programme I have given below..
STDMETHODIMP CTestMacroInterface::ProcessStringArray(SAFEARRAY *ppOutputArray)
{
SAFEARRAYBOUND aDim[3]
aDim[0].lLbound = 0;
aDim[0].cElements = 3;
aDim[1].lLbound = 0;
aDim[1].cElements = 3
aDim[2].lLbound = 0;
aDim[2].cElements = 3
HRESULT hr;
BSTR HUGEP *pbstr;
*ppOutputArray=SafeArrayCreate(VT_BSTR , 3, aDim);
if (*ppOutputArray==NULL)
{
Messagebox("Null");
}
else
hr=SafeArrayAccessData(*ppOutputArray,(void HUGEP**)&pbstr
/*******************************************************************
Now I need to store my data 3 dimensionaly data is
FirstName LastName Job
Ram Lakhan Engineer
Dipu Das Merchant
Vinu Lal Bussiness
a[0][0] = "Ram" , a[0][1] = "Lakhan" , a[0][2] = "Engineer"
a[1][0] = "Dipu" , a[1][1] = "Das" , a[1][2] = "Merchant"
a[2][0] = "Vinu" , a[2][1] = "Lal" , a[2][2] = "Bussiness"
**************************************************************/
// Here I have assigned my values, Is this the correct way of assigning values ??
pbstr[0] = SysAllocString(OLESTR("Ram")); // for a[0][0]
pbstr[1] = SysAllocString(OLESTR("Dipu")); // for a[1][0]
pbstr[2] = SysAllocString(OLESTR("Vinu")); // for a[2][0]
pbstr[3] = SysAllocString(OLESTR("Lakhan")); // for a[0][1]
pbstr[4] = SysAllocString(OLESTR("Das")); // for a[1][1]
pbstr[5] = SysAllocString(OLESTR("Lal")); // for a[2][1]
pbstr[6] = SysAllocString(OLESTR("Engineer")); // for a[0][2]
pbstr[7] = SysAllocString(OLESTR("Merchant")); // for a[1][2]
pbstr[8] = SysAllocString(OLESTR("Bussiness")); // for a[2][2]
SafeArrayUnaccessData(*ppOutputArray);
}
Thanks
George
|
|
|
|
|
georgekjolly wrote: a[0][0] = "Ram" , a[0][1] = "Lakhan" , a[0][2] = "Engineer"
a[1][0] = "Dipu" , a[1][1] = "Das" , a[1][2] = "Merchant"
a[2][0] = "Vinu" , a[2][1] = "Lal" , a[2][2] = "Bussiness"
**************************************************************/
// Here I have assigned my values, Is this the correct way of assigning values ??
pbstr[0] = SysAllocString(OLESTR("Ram")); // for a[0][0]
pbstr[1] = SysAllocString(OLESTR("Dipu")); // for a[1][0]
I think, you have messed up here.
Using Arrays of Strings[^].
This link will give you idea, how to use the array.
|
|
|
|
|
Hi Prasad,
Thank you Very much
George
|
|
|
|
|
Hi
How to start a interactive process(say calc.exe) on a remote machine USing WMIon Windows XP
Thanks In Advance
abhi
|
|
|
|
|
Hi all,
I want to develop add-in for OUTLOOK, In that for event handling use IDispEventSimpleImpl Interface, and declare handler function (fn) for the specified event using SINK_ENTRY_INFO, but whenever that particular event occurs my handler function gets call two times! why it happens so? I want to call it only single time....
MY code is.....
class ATL_NO_VTABLE CConnect :
public CComObjectRootEx<ccomsinglethreadmodel>,
public CComCoClass<cconnect, &clsid_connect="">,
public IDispatchImpl<addindesignerobjects::_idtextensibility2, &addindesignerobjects::iid__idtextensibility2,="" &addindesignerobjects::libid_addindesignerobjects,="" 1,="" 0="">,
public IDispEventSimpleImpl<1,CConnect,&__uuidof(Outlook::ExplorerEvents)>,
{
public:
BEGIN_SINK_MAP(CConnect)
SINK_ENTRY_INFO(1,__uuidof(Outlook::ExplorerEvents ),0xf002,onFolderChange,&OnSimpleEventInfo)
END_SINK_MAP()
public:
//type defination to avoid compilation 'ambigous call' errors
typedef IDispEventSimpleImpl<1,CConnect, &__uuidof(Outlook::ExplorerEvents)> ExpEvents;
void __stdcall onFolderChange();
}
Any idea about this, please suggest me...
Thanks & Regards,
Shyam
Reply
Reply
Shyam Gaikwad
|
|
|
|
|
HI all.
i want return the array in COM project.but i don't know how i should Write the code. Thank you.
|
|
|
|
|
Maybe you could return a variant with safearray
|
|
|
|
|
How to write a program in MFC BY CREATING A BUTTON BY CLICKING THAT BUTTON APOP UP SHOULD DISPLAY THAT INTERNET IS WORKING OR NOT I WANT SOURCE CODE
pradeep
|
|
|
|
|
Hi,
I have a component in vb.net. In this component i have app.config file from which I am reading the connection settings and settings for enterprise libarary exception handling.
If I use this component form .NET application it works fine but when I try to use this component from asp by registering the dll, the copmponent is not able to read any settings from app.config file.
Please provide solution to this problem i searched everywhere but not able to get the working solution.
|
|
|
|
|