|
Where can i find sample for COM. i need to understand COM clearly by samples codes.plz help me
|
|
|
|
|
There are a lot of good articles here at CP. You may start, for instance, with Jeff Glatt ones (to begin: [^]).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
I am trying to create folders on exchange 2003 on Windows 2003. But it is giving the following exception while creating folders. The Libraries used are InfiniTec.Exchange.dll version 0.92 and InfiniTec.Threading.dll version 2.1.
Please guide me on how to deal with this.
The Exception details are :
InfiniTec.Threading.AsyncOperationFailedException: Async operation failed.
See inner exception for details. ---> System.Net.WebException: The remote server returned an error: (401) Unauthorized.
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at InfiniTec.Exchange.WebDav.Request.<dorequestasync>d__a.MoveNext()
at InfiniTec.Threading.AsyncOperation.Advance(Object state, Boolean timedOut)
--- End of inner exception stack trace ---
at InfiniTec.Threading.AsyncOperation.EvaluateOperationResult()
at InfiniTec.Threading.AsyncOperation.WaitForCompletion()
at InfiniTec.Exchange.ItemBase.Save()
Manoj Kaushik
|
|
|
|
|
datas import in Grd to Excel sheet
Deepi
|
|
|
|
|
Greetings,
I have been trying to figure out how to set computer name with WMI in C++. Below is part of the code to help demonstrate what I am doing.
VARIANT varCommand;
varCommand.vt = VT_BSTR;
varCommand.bstrVal = L"NewHostName01";
hr = pInInst->Put(L"Name", 0, &varCommand, 0);
IWbemClassObject * pOutInst = NULL;
hr = pNamespace->ExecMethod(L"Win32_ComputerSystem", L"Rename",0,NULL, pInInst, &pOutInst, NULL);
ExecMethod fails with following error message: WBEM_E_INVALID_METHOD_PARAMETERS. I believe "Rename" is a non-static method thus ExecMethod reports preceeding error message. I don't know how to properly code for the non-static case . Need help. Thanks
one-trick-pony
|
|
|
|
|
hi!
I'm using asp.net2.0, in case of Gridview control if we dont use Sqldatasource control ,can we use inbuilt edit update.. functionality?
If yes?
then how to do it ?
If possible please give code snippet as example .
thank u.
yog
hui gfgh kgdgrt njjn hjgkn
|
|
|
|
|
hi i am using the below code for dummy multithreading application.
first function listens request and the thread started with thread function
but some client start receving data but some one not get the single respomnse back . can any one help me what's gona wong with this code
thanks
///////the server function//////////////////
void thread::startserver()
{
DWORD dwStatus;
WSAEVENT handles[1];
struct sockaddr_in cli_addr;
int clilen = sizeof(cli_addr);
memset(&cli_addr,0,sizeof(struct sockaddr));
printf("***********server started****************\n");
while (TRUE)
{
handles[0] = WSACreateEvent();
WSAEventSelect(m_hSockethndl, handles[0], FD_ACCEPT);
dwStatus = WSAWaitForMultipleEvents(1, handles, TRUE, 50, FALSE);
if (dwStatus == WSA_WAIT_EVENT_0)
{
SOCKET cli_socket;
cli_socket=-1;
cli_socket = accept(m_hSockethndl, (struct sockaddr *) &cli_addr, &clilen);
// set linger option
LINGER linger;
linger.l_onoff = 1;
linger.l_linger = 0;
setsockopt(cli_socket, SOL_SOCKET, SO_LINGER, (char *)&linger, sizeof(LINGER));
//setsockopt(cli_socket, IPPROTO_TCP, TCP_NODELAY, NULL, 0);
int flag = 1;
int result = setsockopt(cli_socket, /* socket affected */
IPPROTO_TCP, /* set option at TCP level */
TCP_NODELAY, /* name of option */
(char *) &flag, /* the cast is historical cruft */
sizeof(int)); /* length of option value */
if (result < 0)
{
printf("Client Socket No Delay Option Failed");
}
//printf("Thread started with the server socket=%d and client port=%d and ip=%s\n",cli_socket,cli_addr.sin_port,inet_ntoa(cli_addr.s in_addr));
/*threadParmas thparam;
memset(&thparam,0,sizeof(threadParmas));
thparam.cli_addrth=cli_addr;
thparam.threadsocket=cli_socket;*/
//CreateThread(NULL, 0, StartThread, &thparam, 0, &dwThreadID);
CreateThread(NULL, 0, StartThread, &cli_socket, 0, &dwThreadID);
FD_SET(cli_socket, &set_sockets);
}
WSACloseEvent(handles[0]);
}
}
//////////////////the thread function////////////////////
DWORD WINAPI thread::StartThread (void * thparam)
{
/* struct threadParmas threadparam;
threadparam.threadsocket=((struct threadParmas *)thparam)->threadsocket;
threadparam.cli_addrth=((struct threadParmas *)thparam)->cli_addrth;*/
SOCKET socket_handle;
u_short Clientport;
//socket_handle=threadparam.threadsocket;
socket_handle=*(SOCKET *)thparam;
//Clientport=ntohs(threadparam.cli_addrth.sin_port);
char data[256];
char Resdata[512];
memset(data,0,256);
memset(Resdata,0,512);
int counter=1;
int bytes =1;
while(bytes)
{
WSAEVENT we = WSACreateEvent();
WSAEVENT handles[1];
handles[0] = we;
WSAEventSelect(socket_handle, we, FD_READ | FD_CLOSE);
//receiving data from client
for (int i = 0; i < WAIT_MULTIPLE; i++)
{
DWORD available = WSAWaitForMultipleEvents(1, handles, TRUE, WAIT_TIME, FALSE);
if (available == WSA_WAIT_EVENT_0)
{
if ((bytes = recv(socket_handle, data, 256, 0)) < 0)
{
int er = WSAGetLastError();
printf("Error=%d while receive data from socket %d\n",er,socket_handle);
bytes = 0;
break;
}
else
break;
}
}
WSACloseEvent(we);
strcpy_s(Resdata,512,"Response send Ack");
if(bytes)
{
//printf("socket %d Message %3d received client port=%d, ip=%s size=%d\n",socket_handle,counter,Clientport,inet_ntoa(thread param.cli_addrth.sin_addr),bytes);
//go to sleep for internal processing
//printf("socket %d Message %3d received size %d %s\n",socket_handle,counter,bytes,data);
Sleep(2000);
//sending the dummy response to the client
if (send(socket_handle, Resdata, strlen(Resdata), 0) != strlen(Resdata))
{
int er = WSAGetLastError();
printf("ERROR %d IN SENDING %d RESPONSE by socket =%d\n",er,counter,socket_handle);
return 0;
}
//printf("***Response %3d send by the server socket=%d, client port=%d, ip=%s\n",counter,socket_handle,Clientport,inet_ntoa(thread param.cli_addrth.sin_addr));
//printf("***Response %3d send by the server socket=%d\n",counter,socket_handle);
}
//keeping track how many packets this specific client sends
counter++;
}
return 1;
}
question -- multi threading is not working can any body tell why it is so?
-- modified at 0:44 Thursday 5th July, 2007
|
|
|
|
|
Where is the question/problem with COM.
|
|
|
|
|
How to Deploy Presentation Layer and COM + in two servers?
Regards,
Sylvester G
sylvester_g_m@yahoo.com
|
|
|
|
|
Hi
Can anyone please tell how the Indexing server can be provided the credentials for the authentication and authorization of user, and to access a Indexing server on remote machine that is out of domain?
Thanks in advance
Manoj Kaushik
|
|
|
|
|
I did a test, tried to test TLS in COM. The code is as following,
__declspec(thread) static int num = 321;
void test()
{
int i = num; // got an error " Access violation reading location 0x00000000."
num = 332211;
Sleep(5000);
i = num;
}
Do I need to adjust some other setting of the COM, or COM really doesn't support TLS. This code works well in normal dll.
Any reply will be welcomed.
|
|
|
|
|
jsjwql wrote: Do I need to adjust some other setting of the COM, or COM really doesn't support TLS. This code works well in normal dll.
Are you by any chance linking your DLL statically?
An in-process COM server is a DLL that will be loaded at runtime and this is probably why your TLS doesn't work.
Here's what MSDN has to say about it:
If a DLL declares any nonlocal data or object as __declspec( thread ), it can cause a protection fault if dynamically loaded. After the DLL is loaded with LoadLibrary, it causes system failure whenever the code references the nonlocal __declspec( thread ) data. Because the global variable space for a thread is allocated at run time, the size of this space is based on a calculation of the requirements of the application plus the requirements of all of the DLLs that are statically linked. When you use LoadLibrary, there is no way to extend this space to allow for the thread local variables declared with __declspec( thread ). Use the TLS APIs, such asTlsAlloc, in your DLL to allocate TLS if the DLL might be loaded with LoadLibrary.
My guess is that you would get the same error with your DLL if you load it in runtime with ::LoadLibrary() .
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
I have following error in window service same code is working in window Application
"QueryInterface for interface SQLXMLBULKLOADLib.ISQLXMLBulkLoad failed."
Dim objbl As SQLXMLBulkLoad3
objbl = New SQLXMLBulkLoad3
objbl.ConnectionString = "Provider=SQLOLEDB.1;Data Source=pcDB;Initial Catalog=webdb;User ID=sa;pwd=sa"
objbl.ErrorLogFile = "c:\error.log"
objbl.BulkLoad = True
objbl.KeepIdentity = False
objbl.CheckConstraints = False
objbl.Transaction = False
objbl.Execute("c:\Items.XSD", "C:\Items.xml")
Thanks
Hardik Panchal
|
|
|
|
|
Don't cross post in multiple forums. It's considered very rude to "spam" the forums and makes it quite difficult for multiple people to collaborate on an answer.
|
|
|
|
|
Hello!
I have an application written i VC++ (Visual C++ 6.0). This application already connects to several COM-objects and listens to events from them. This works very well.
My latest COM-object is written in C# (Visual Studio 2005). I connect to this object the same way, and listens to events (delegates) from the object.
But the events only works on my computer. I works in boty release and debug. I have tried to copy the software to serveral other computers, but then I receive no events. It connects to the object, and I can call functions in the C# COM-object, and display the return value, but OnXmlEvent(LPCTSTR text) is never called in my C++ application.
Any Idea about what's missing? For testing porposes I have created a console application in C# that connects to the C# COM-object, and this works fine on any computer, so I think my problem is the C++ application.
Am I missing a DLL or library?
Frode
|
|
|
|
|
Hi,
I have written a program in C# such that it creates a dll file at runtime using the CodeDOM techology and after creation the program calls a function from the dll file. This has been created with the winforms. It has two button and two text box. txt_box1 is to get a string from the user and btn1 is to create a dll file that retuns the string in txt_box1 when called. btn2 is used to call the dll file and the result is shown in txt_box2. The problem i encounter with this is, when i run this program for the first two time it creates the dll file and returns the string correctly, but when i try for the next time it exits. what i have to do to rectify this problem. Please help me.
If you can DREAM it
you can DO it
Natarajasivan D
|
|
|
|
|
Hi,
we have an SingleInstance-COM Object which works as Data-Buffer between a SAP-GUI and a graphical configurator (OpenGL). This works about 5 years. Original developed with VC 6, compiled with VC2002, VC2003, VC2005 and now with VC2005 SP1 over the years. Since we installed this object compiled with VC2005 SP1 there is an error "Server busy" while using the COM-object.
How can i get the position of the problem ?
Any tipps or hints or tools that can help me to solve the problem ?
Can i get detailed information which server is busy ?
In another context we had an identicaly error message. We tried to open a PDF file via IE on a new installed PC. The Acrobat Reader needs to confirm a dialog the first starting time. Nobody can see this dialog in the IE-Job. Starting an autark PDF file once, solves the problem.
Thanks in advance,
Howie
ps. Switch back to the old COM-object has not this problem. Virus checked, etc.
We know nothing between the technical communication of SAP and the COM object.
-- modified at 2:56 Friday 22nd June, 2007
|
|
|
|
|
hai everyone
i want to add activexobject("WScript.Shell") in my aspx page
plz tel me step by step
thanks
Dhatchinamoorthy.R
9894824838
|
|
|
|
|
I've been writing an addin for Outlook which requires it's own print dialog (in c# using P/Invoke). All good and well, but when I load the printer properties using the winspool.drv function of the same name I get a different properties dialog compared to the one accessed through the existing Outlook print dialog.
Does anyone know why this happens and if there is a way around it?
Thanks in advance
Dave
|
|
|
|
|
Figured it out - apparently Outlook calls DocumentProperties rather than PrinterProperties.
Dave
|
|
|
|
|
Hi,
We want to use COM+ to hold our business objects and turn on Object Pooling to persist Business Objects for each Web Session. What is the best way to do that and how? Should we create a COM+ that holds business objects for all sessions ( a collection of sessions that hold a collection of Business objects for each session ), or create COM+ object for each Session to hold all business objects?
Regards,
Babak
Babak Ansari Jaberi
Software Developer/Designer
|
|
|
|
|
Hi Experts,
I am using third party com Dll interafces.But sometimes the interfaces return E_OUTOFMEMORY EXCEPTION.So tell me how to release com interface.
Thanks
|
|
|
|
|
The exact mechanism depends on how you're using it. If you're using #import or CComPtr<> smart pointers, then you release the interface by setting the pointer to NULL. If you aren't using smart pointers in this way, you have to call the Release() method.
Note that if you copy a pointer without using AddRef() or QueryInterface(), the object may go away unexpectedly. Similarly, if you use AddRef() or QueryInterface() with no corresponding Release(), the object implementing the interface will not necessarily disappear when you expect it to..
Steve S
Developer for hire
|
|
|
|
|
What language are you coding in?
In VB, just make sure you set all of the objects you create to Nothing as soon as you're done with them:
Set MyLibraryInterface = Nothing<br />
Set MyBusinessObject = Nothing
In many situations, you don't really need to do this unless you're creating a lot of objects that don't fall out of scope right away
In C++, you just call ->Release() on your interface pointer.
MyComObject* pMyComObject = NULL;<br />
(send the pointer into your class factory CreateInstance call here)<br />
(do your business logic here)<br />
<br />
pMyComObject->Release();
Hope this helps.
|
|
|
|
|
I have implemented both applications using COM & DLL. But i don't find out any significance difference.So if anybody knows about it,then please reply me as soon as possible.
Regards,
Pankaj Sachdeva
|
|
|
|
|