I think in if comparision you have used NY_CATID. Previously it is MY_CATID. So verify it once.
K ARUN KUMAR
Posts
-
CATEGORYINFO & ICatRegister -
TROUBLE Passing BYTE Array from Client to COM OUTPROC Server [modified]Thanks a lot buddy. Sure.. Arun
-
TROUBLE Passing BYTE Array from Client to COM OUTPROC Server [modified]Hi Steve, You are amazing. The change worked. But when iam building the server, it again modifying the registry setting to default Marshaller GUID. How to set my ProxtStub GUID as default?
-
TROUBLE Passing BYTE Array from Client to COM OUTPROC Server [modified]Hi Steve, i found two registry entries.. 1st Entry
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Interface\{A12EAEC2-2B64-470B-93AF-EFE0855DD3AC}]
@="IDataProvider"[HKEY_CLASSES_ROOT\Interface\{A12EAEC2-2B64-470B-93AF-EFE0855DD3AC}\NumMethods]
@="12"[HKEY_CLASSES_ROOT\Interface\{A12EAEC2-2B64-470B-93AF-EFE0855DD3AC}\ProxyStubClsid]
@="{00020424-0000-0000-C000-000000000046}"[HKEY_CLASSES_ROOT\Interface\{A12EAEC2-2B64-470B-93AF-EFE0855DD3AC}\ProxyStubClsid32]
@="{00020424-0000-0000-C000-000000000046}"[HKEY_CLASSES_ROOT\Interface\{A12EAEC2-2B64-470B-93AF-EFE0855DD3AC}\TypeLib]
@="{0381FBF3-32C1-4AF1-B6DD-EFB51815DD72}"
"Version"="1.0"2nd Registry Entry:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\CLSID\{A12EAEC2-2B64-470B-93AF-EFE0855DD3AC}]
@="PSFactoryBuffer"[HKEY_CLASSES_ROOT\CLSID\{A12EAEC2-2B64-470B-93AF-EFE0855DD3AC}\InProcServer32]
@="D:\\VC++\\Sample Applications\\BytComp\\DebugPS\\BytCompPS.dll"
"ThreadingModel"="Both" -
TROUBLE Passing BYTE Array from Client to COM OUTPROC Server [modified]ENTIRE IDL File:
import "C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\include\prsht.idl";
import "C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\include\mshtml.idl";
import "c:\program files\microsoft visual studio .net 2003\vc7\platformsdk\include\dimm.idl";
import "C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\include\mshtmhst.idl";
import "c:\program files\microsoft visual studio .net 2003\vc7\platformsdk\include\docobj.idl";
import "C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\include\exdisp.idl";
import "C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\include\objsafe.idl";[
object,
uuid(A12EAEC2-2B64-470B-93AF-EFE0855DD3AC),
dual,
helpstring("IDataProvider Interface"),
pointer_default(unique)
]
#line 14 "d:\\vc++\\sample applications\\bytcomp\\dataprovider.h"
interface IDataProvider : IDispatch {
#line 16 "d:\\vc++\\sample applications\\bytcomp\\dataprovider.h"
[id(1),helpstring("method GetSafeArray")] HRESULT GetSafeArray([out,retval] VARIANT *vtSafeArray);
[id(2),helpstring("method SetByteData")] HRESULT SetByteData([in] BYTE *bytArray);
[id(3),helpstring("method SetArray")] HRESULT SetArray([in]BSTR bstrArray);
[id(4),helpstring("method SetThings")] HRESULT SetThings([in]BYTE **ppThings );
[id(5),helpstring("method SetData")] HRESULT SetData([in] ULONG size, [in,size_is(size)] BYTE *pData);
};[ version(1.0), uuid(0381FBF3-32C1-4AF1-B6DD-EFB51815DD72), helpstring("BytComp 1.0 Type Library") ]
library BytComp
{
importlib("stdole2.tlb");
importlib("olepro32.dll");\[ version(1.0), uuid(8816EAAA-91D5-4DCF-BA1A-DD699529D099), helpstring("DataProvider Class") \]
#line 36 "d:\\vc++\\sample applications\\bytcomp\\dataprovider.h"
coclass CDataProvider {
interface IDataProvider;
};}
-
TROUBLE Passing BYTE Array from Client to COM OUTPROC Server [modified]Sorry Steve. Im new to the message posts. I will follow ur guidelines for sure from next time. Coming to our discussion, iam getting the message box only once, meaning that only one byte is marshalled.
-
TROUBLE Passing BYTE Array from Client to COM OUTPROC Server [modified]IDL File Entry: [id(5),helpstring("method SetData")] HRESULT SetData([in] ULONG size, [in,size_is(size)] BYTE *pData); Method Override: STDMETHODIMP CDataProvider::SetData(ULONG size, BYTE* bytArray) { // TODO: Add your implementation code here BYTE byt[6]; int i=0; for(;*bytArray!=0;i++) { byt[i]=*bytArray; ::MessageBox(NULL,(LPCTSTR)"he","Msg",MB_OK); bytArray++; } byt[i]=0; return S_OK; } Client: IDataProvider* pServer=NULL; HRESULT hr=::CoCreateInstance(CLSID_CDataProvider,NULL,CLSCTX_LOCAL_SERVER,IID_IDataProvider,(LPVOID*)&pServer); short sSize = 5; BYTE* pBytes; //Allocate the shared Memory pBytes = reinterpret_cast(CoTaskMemAlloc(sSize * sizeof(BYTE))); if(pBytes == NULL) return; ::memset(pBytes, 0, sSize); pBytes[0]='K'; pBytes[1]='K'; pBytes[2]='R'; pBytes[3]='D'; pBytes[4]=NULL; pServer->SetData(5,pBytes); CoTaskMemFree(pBytes); //Free the shared Memory
-
TROUBLE Passing BYTE Array from Client to COM OUTPROC Server [modified]Ya i did the same way by copying you code.Still not able to access the entire array. Can you send me a working client server codes developed in VC98 or VS2003? My Id: k_arunkumar_1217@yahoo.com
-
TROUBLE Passing BYTE Array from Client to COM OUTPROC Server [modified]Hi Stephen, What do you mean by Code highlights?
-
TROUBLE Passing BYTE Array from Client to COM OUTPROC Server [modified]I have a Project named BytComp and BytCompPS in my workspace. I built the BytCompPS and found ByCompPS.dll and registered it using regsvr32 command. Now, i have added a new interface method as suggested by you but still im not able to access the entire array. :doh:
-
TROUBLE Passing BYTE Array from Client to COM OUTPROC Server [modified]Im using Visual Studio 2003. In that i have taken an ATL Project. Server type is: Service(exe) which exposes IServicer interface.
-
TROUBLE Passing BYTE Array from Client to COM OUTPROC Server [modified]Hi Steve, Thanks a lot for the code. How to register the Proxy-Stub of my Outproc dll or exe?
-
TROUBLE Passing BYTE Array from Client to COM OUTPROC Server [modified]Hi Steve, Thanks for the Info. I tried using Size_is option. Still nor working. Can you give me a working Client Server Code? Thanking you. Arun
-
TROUBLE Passing BYTE Array from Client to COM OUTPROC Server [modified]Hi, I have an outproc server Executable which exposes an Interface IServicer. IServicer has a Method GetBytArray([in]BYTE* bytArray). This method has to get a Byte array from client and utilise the values of the array. When iam calling this Interface method from client by passing a byte array of size 10, at the server iam only able to access the first element of the array. i.e only first element of the array is marshalled from client to Server. This is happening only in the case of OUTPROC Servers. How can i access the entire BYTE array without utilising VARIANT or SAFEARRAY concepts?
modified on Tuesday, May 18, 2010 1:00 AM
-
How To Restrict Dialog Box in an SDI to be With in Application Boundaries [modified]Thanks David.. That worked. One more thing. If the dialog is a modeless dialog and if the user goes back to the main frame window and moves the window, the modeless dialog will go out of application. So for this i have added the WM_MOVING event in MainFrame class. void CMainFrame::OnMoving(UINT fwSide, LPRECT pRect) { //CFrameWnd::OnMoving(fwSide, pRect); HWND hWnd = pDlg->GetSafeHwnd(); RECT rc; RECT* pRc=&rc; rc.left=rc.top=rc.right=rc.bottom=0; LRESULT result = ::SendMessage(hWnd, WM_MOVING, (WPARAM)fwSide, (LPARAM)&rc); } and modified the WM_MOVING handler of Modeless Dialog as below. void CModelessDlg::OnMoving(UINT fwSide, LPRECT pRect) { CDialog::OnMoving(fwSide, pRect); CRect rcParent; if(pRect->right==0) //Calin from MainFrame GetWindowRect(pRect); GetOwner()->GetWindowRect(rcParent); // keep the child's left edge inside the parent's right edge pRect->left = min(pRect->left, rcParent.right - m_nWidth); // keep the child's left edge inside the parent's left edge pRect->left = max(pRect->left, rcParent.left); // keep the child's top edge inside the parent's bottom edge pRect->top = min(pRect->top, rcParent.bottom - m_nHeight); // keep the child's top edge inside the parent's top edge pRect->top = max(pRect->top, rcParent.top); // keep the child's right edge inside the parent's right edge pRect->right = min(pRect->right, rcParent.right); // keep the child's right edge inside the parent's left edge pRect->right = max(pRect->right, rcParent.left + m_nWidth); // keep the child's bottom edge inside the parent's bottom edge pRect->bottom = min(pRect->bottom, rcParent.bottom); // keep the child's bottom edge inside the parent's top edge pRect->bottom = max(pRect->bottom, rcParent.top + m_nHeight); if((rcParent.Width() < pRect->right - pRect->left) || (rcParent.Height() < pRect->bottom - pRect->top)) { this->ShowWindow(SW_HIDE); } else this->ShowWindow(SW_SHOW); this->MoveWindow(pRect); //Added by Arun } Once again Thanks a lot David..... :)
modified on Wednesday, May 5, 2010 5:31 AM
-
How To Restrict Dialog Box in an SDI to be With in Application Boundaries [modified]Nop. This does not work for me. Any ways thanks for the help. :)
-
How To Restrict Dialog Box in an SDI to be With in Application Boundaries [modified]Hi Micheal, Thanks for your reply. How to embed the CDialog into the CFrameWnd in SDI application so that my requirement is accomplished. I mean a bit of code. Please help me. :)
-
How To Restrict Dialog Box in an SDI to be With in Application Boundaries [modified]Hi enhzflep, Yep.I have implemented the OnMove(..) solution for this. But seriously searching for some direct method like inheriting some poperties of CView which will make the dialog to be constrained to be with in application. Hope any one knows the better solution. Thanks Mate.
-
How To Restrict Dialog Box in an SDI to be With in Application Boundaries [modified]Hi Richard, As advised I have limited the size to be with in the application. But, the problem comes when user is trying to move the dialog. It goes out of application boundaries. I want a functionality similar to CView child objects which stay with in the MainFrame.
-
How To Restrict Dialog Box in an SDI to be With in Application Boundaries [modified]Hi Friends, I have an interesting question for all. How can i restrict a dialog box(Modal or modeless) to stay within the application boundaries? Just like CView derived objects will not move out of application. I know we can do it with OnMove(..) event handling. But, i wanted to know whether there are any other direct means like by setting some properties to CDialog class. Please help me with this. Regards, K ARUN KUMAR
modified on Tuesday, May 4, 2010 5:30 AM