|
The question describes as follows:the embeded system which has a apache service installed, capture picture and sound file from the usb camera.I use the activex control to show the picture and play the sound,how can my control to get the data the apache sent?
|
|
|
|
|
Hi experts,
I have a problem...
I am creating an ActiveX component (my first) and in it I need to call a third party dll from a program. the function works only if the program is active.
So basically: my activeX should just post message to the program to execute one of its functions; if the program is active, should execute the order, if not I will use my ActiveX to tell the user that the application is not active
Thank you in advance for all your comments
Dimkov
|
|
|
|
|
I have created simple ATL project. Using AddClass i have added ATL Control object which has a stock property 'Fillcolor' then finished the wizard. After that i tried to add property by using 'add propery', its creating necessary entries in IDL file but its not creating get and set methods to the implementation file.
why this happens? Please help me.
I also find that if i add stock propery to the ATL Control only the above problem occurs.
|
|
|
|
|
Hi,
Is there someone who knows if it's possible and how to integrate COM in a XBAP wpf application?
I've made a wrapper and when I tried to make an instance to it I 've got an AccesViolationException. In my desktopapplication this exception doesn't occur and everything works well. But when i tried it in a browser and in a mediacenter application, this exception was thrown. I think it has to do with the security of web applications but I'm not sure.
Elke.
|
|
|
|
|
Hello
I have developed a COM server using attributed ATL with VS8. The objects are instantiated and used within a C# .NET Windows Forms application. When shutting down the application not all FinalRelease() methods of all objects can execute completely. I can make this behaviour constant by placing a call to Sleep(5000) at the beginning of the FinalRelease() method, the execution will never reach the next statement.
The debugger says at this point that the lowest frame on the call stack is "[In a sleep, wait or join]" (independently from the additional Sleep() call that is not executed at this time).
I think it is related to the threading model of my COM objects (apartment). Someone (I don't know exactly who) waits an amount of time for my objects to terminate and then forces termination. But I don't want this behaviour! How can I disable that or set the timeout to another value? (I'd prefer INFINITE!)
What is the reason for the described behaviour? How can I solve the problem without adding cleanup functions that are called before any descruction code? (I thought FinalRelease() is actually such a cleanup function )
Best regards
Steve
|
|
|
|
|
I think your problem here is actually in how the .NET Framework uses COM objects.
When you create a COM object in .NET code, the Framework generates something called a Runtime Callable Wrapper. The Framework does not call AddRef on your component every time the .NET code makes a copy of the interface pointer. It only calls Release when it destroys the RCW. Instead, it performs traced references with the garbage collector - if the GC detects there are no outstanding references to the RCW it then marks it for collection.
So what calls Release ? I'm not too sure on this one, but I think the RCW ends up on the finalization queue, and then the finalization thread is responsible for calling Release . Unfortunately, there is a total of one finalizer thread in the system (separate from all the application threads, so you can get cross-threading problems) and it can easily get blocked.
I think what's happening for you is that the finalizer thread isn't being allowed to run to completion on process shutdown.
My personal best practice is to do everything possible to avoid finalization. That means calling Dispose on everything as soon as I've finished with it - the using block in C# (and VB 8.0) can help a lot here. Unfortunately again, the RCW doesn't implement IDisposable and cannot be disposed of in this way.
The only documented way to dispose of a COM object explicitly is to call Marshal.ReleaseComObject . However, this function does not trace references and can prematurely delete an object that is still actually in use, so use it carefully.
It is probably better to add an explicit way of allowing the client to close down the object, rather than relying on FinalRelease .
|
|
|
|
|
Why we need COM? shall we use DLL insted of COM? What is the advantage of using COM?
I know COM makes use of DLL for dynamic linking. But the above question is what ever is possible by COM can also be achive by DLL or not? If not what is the advantge of COM?
Thanks in Advance
Nandu
|
|
|
|
|
You know, I hate it when people post questions like this without reading older messages. Someone asked a short while ago what the difference between COM and a DLL is.
Maybe if you read a little bit more about COM, you'd be able to appreciate the differences. Not all COM components sit inside dinky little DLLs. Some components are full-blown applications (like Excel, for instance), and cannot ever be in-process, and that's even before you start thinking about remoting an interface (oops, sorry, I didn't mean to use remote as a verb!).
Steve S
Developer for hire
|
|
|
|
|
Thanks,
I have searched for the diff between COM and a DLL. But I could not find it in the older messages, can you please provide that URL.
Nandu
|
|
|
|
|
this[^] was what I was thinking of.
Seriously, if you do not understand the difference between a DLL and COM, you need to do much more reading (Inside COM or Essential COM would do for starters). As the other poster has said, COM is a binary standard for cross-language components, and much more.
Lots of the parts of the software provided by Microsoft in the OS (such as the Firewall, Explorer) provide COM interfaces as the API. Granted, many components are implemented as in-process DLLs, but lots more aren't. Sure, for many things COM is perceived as overkill, and a simple DLL with a flat API may well be easier to use. However, taking into account the inter-process and inter-machine capabilities that come almost free with COM (and DCOM), you have a much clearer idea that the simple DLL is just the tip of a very large iceberg.
Really, go find a copy of Essential COM, and you'll understand why your question is not a good one. COM is the glue that allows you to stick multiple components together into a system, among other things.
Steve S
Developer for hire
|
|
|
|
|
COM is a binary standard for interacting software components; COM servers have a lot of advantages with respect to ordinary DLL's (BTW only COM in-process servers are DLL's: local and remote servers are executables). Since COM and ordinary DLL comparison is a rather brad topic, I suggest to you to read a good COM-related book, such as Inside COM or essential COM(I assume you're familiar with standard DLL's and OOP programming).
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.
|
|
|
|
|
Thanks you CPallini
Nandu
|
|
|
|
|
|
Hi all,
I am developing an ActiveX Control that can be used with Microsoft Access. In this control, there are two properties - Get and Set - for retrieving and assigning text to be displayed on the control. It is a multiline display control. I placed the control on Access form and entered the text in the design mode. The text gets displayed multiline. So far fine. But when I switch the view from design to form, the entered text doesn't get displayed. Rather, it is the text which is already in the Access Form that gets displayed.
Could anyone point out where am I going wrong and the possible solutions for rectifying?
Thanks
Anil
|
|
|
|
|
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.
|
|
|
|
|