Hi, i have created a sample ATL application in VS2010, added ATL Simple object. it has only one method int getVal() { return 10; } i have enabled /clr switch in the project properties and build in release mode. (i have added /clr because i want to consume some objects build in C#.net) after registering the dll, i have consumed the COM object in vbscript. (the code below) dim obj set obj = createobject("MySample.COMSample") msgbox obj.getVal() set obj = nothing this is very simple COM object. if i run the above script, it will show message box "10". once i press ok, there is an popup with an exception message below. --------------------------- WScript.exe - Application Error --------------------------- The exception unknown software exception (0xc0020001) occurred in the application at location 0x7c812aeb. Click on OK to terminate the program --------------------------- OK --------------------------- if i remove /clr switch and build it run the Vbscirpt. i don't see the popup error. any suggestion why there an exception when /clr switch is used ? Thanks in advance.
Vijjuuu
Posts
-
using /clr switch for ATL application raises an exception when the application is terminating. -
COM and C#.net InteroperabilityThanks for your response. Actually, i am trying re-write a COM component developed in ATL which is production. i want to give the same interface so that consumer has minimal impact. code snippet from my existence code.
STDMETHOD(get\_methodA)(/\*\[in\]\*/ VARIANT storeID, /\*\[out, retval\]\*/ VARIANT \*pVal); STDMETHOD(put\_methodA)(/\*\[in\]\*/ VARIANT storeID, /\*\[in\]\*/ VARIANT newVal); STDMETHOD(get\_methodB)(/\*\[in\]\*/ VARIANT storeID, /\*\[in\]\*/ VARIANT index, /\*\[out, retval\]\*/ VARIANT \*pVal); STDMETHOD(put\_methodB)(/\*\[in\]\*/ VARIANT storeID, /\*\[in\]\*/ VARIANT index, /\*\[in\]\*/ VARIANT newVal);
when i extract the typelib for this
[id(0x00000001), propget, helpstring("property methodA")]
HRESULT methodA([in] VARIANT storeID, [out, retval] VARIANT* pVal);\[id(0x00000001), propput, helpstring("property methodA")\] HRESULT methodA(\[in\] VARIANT storeID, \[in\] VARIANT pVal); \[id(0x00000004), propget, helpstring("property methodB")\] HRESULT methodB(\[in\] VARIANT storeID, \[in\] VARIANT index, \[out, retval\] VARIANT\* pVal); \[id(0x00000004), propput, helpstring("property methodB")\] HRESULT methodB(\[in\] VARIANT storeID, \[in\] VARIANT index, \[in\] VARIANT pVal);
so the consumer can use as methodA(123) -- return a value methodA(123) = 100 -- this will set a value methodB(123, 3) -- return a value methodB(123, 3) = 100 -- this will set a value. i am trying to mimic the same methods defined in my ATL in a C# interface and use .net com interoperability using a regasm. i am not able to find out how achieve this in C#. if this is done in ATL i was thinking there could be a way to achieve this. thanks for your time
-
COM and C#.net InteroperabilityHi all, i am trying to expose C# object to COM and in this process i got a query and not sure how to progress further. so here i am seeking for help. i want to define a interface in C# in such a way the consumer of the COM object should be able to use the method in the following way. comObject.methodName(123) the above statement will return a value, assume where 123 is the parameter which could id or some thing like that comObject.methodName(123) = 100 the above statement should set the value 100 something internal member having id 123 in both the above statement the methodName is the same. so the question is how can we define an interface in C# that can be exposed to COM using regasm.exe. i know it is possible to define such a way in C++ using ATL but not sure how can i achieve the same in C#. [Comvisible(true)] interface ExposeToCom { // don't know what all to add to make the method appear to COM to be get and set int methodName(int); } Thanks for your help,
-
Winsock - FD_WRITEThanks again David, i understood that its lets application know that it can send data to the socket, but when there is no data to send ? and does it mean after initial FD_Write (the time after connection established) , FD_WRITE will be polled to application to let know that it can send data ? i really appreciate your patience. Thanks.
-
Winsock - FD_WRITEHi David, Thanks for your reply. i am sorry, i couldn't get what you mean. i understand that application will receive an FD_WRITE event shortly after a connection is made but there is no data to send at that time. here is scenario i am trying for 1) connect to server 2) Connection established - FD_WRITE event is receive. 3) there is no data to send to server 4) some other event fired (not related to socket) -- data arrived, so store the data. 5) now data is available to send to server in the above steps 4 and 5 will happen one after the another. how can i raise FD_Write event after the data is available (means step 4) ?
-
Winsock - FD_WRITEHi all, i am developing client program using WSAAsyncselect() in Winsock2. i have few queries regarding FD_WRITE. i understood that when client is connected to server. There will be FD_WRITE event posted stating that we can send the data to server. However, i want to send data to server based on some other events that the application is interested in. i am not quite sure how the FD_WRITE event will be fired when i want send data to server. here is the pseudo.
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_SOMEOTHEREVENT:
// collect the data. we need to send collected data to sever (right now data is stored in a list).
break;
case WM_SOCKET:
switch (WSAGETSELECTEVENT(lParam))
{
// how to fire this event when application wants to send data ?
case FD_WRITE:break; } break; } return 0;
}
Thanks in advance.
-
Capture Screen whenever the display is updatedhi all, i am planning to implement a tool which can capture screen only when there is display event from Operating system (for e.g window 7) level. i have idea how to capture a screen at regular interval of time but that's not what i am planning to implement. the idea is tool will run be running in the background and it must capture the screen only when the screen is updated. i have no idea where to start. i am open for technology (c++ or c# or any other technology) i request to give me some suggestions/ideas what could be better start. Thanks Vijay.
-
negation of an expressioni thought it would be simpler, however i wasnt able to get regular expression for the below. i want to extract the words which are not in a particular pattern. say in the below sentence clicking the (Run Match) button (or F5) to see what (happens). i want to extract all the words which are not defined in brackets (). so the output will be clicking the button to see what below is expression which i defined. it is not working. can any one point out the mistake in the expression ? (?!\(\w+\))
-
Is there any way a C/C++ program can crash before main()?Yes, it can if the program didn't find dependency libraries in the search paths.
-
Memory Management in C++ - Understanding Stack and Heap in Detail.?Stack is place where local variables are allocated.( C++ run time environment is managing memory for the program) allocation and deallocation will be done by c++ runtime environment. Heap is place when you allocated memory dynamically. ( that means you are managing memory for your variables) you have deallocate the memory. Above is the fair difference about stack and heap i would recommend Programming Application for Microsoft windows by Jeffery Richter. ( if you are targeting your c++ to windows environment)
-
Xml SchemaThanks that will be enough.
-
Xml SchemaThanks for your reply. i was looking for generic xsd not for specific scenario. i have general Tree having a node which contains some data.
-
Xml SchemaHi All, I am trying to create Schema file for xml which looks like a General tree. My xml will look like
A node can contain any number of node inside and it goes on. like
Please advice how to create xsd file. Thanks.
-
CEditView operation rediculously Slows down in Windows 7Yes i am stuck :( Thanks for your time for replying.
-
CEditView operation rediculously Slows down in Windows 7Ya i tried that as well but that making my application more slow :(.
-
CEditView operation rediculously Slows down in Windows 7Thanks Richard. My MFC Application is very old application which is we are using for years. Dont want to change any class inheritances. except to find an alternative to solve the issue.
-
CEditView operation rediculously Slows down in Windows 7Thanks David. My MFC Application is very old application which is we are using for years. Dont want to change any class inheritances. except to find an alternative to solve the issue.
-
CEditView operation rediculously Slows down in Windows 7Yes and at the same the logs can be saved as File for analysis purposes if at all if there is any issue.
-
CEditView operation rediculously Slows down in Windows 7I have a MFC MDI (logging) application developed in VS2005 in Windows XP which gets logs from another Process(using pipes) and logs them into view. i have a View derived from CEditView. There is so much of logging is done to MFC application for every sec and works good in XP. when the same application is running in Windows 7. initally it seems to be good but when the logging data is becoming more and more we can se the MFC application is logging data very slowly when compared to XP. On analysis it was found that operation on Edit Ctrl is making the logging slow these are the line of code which is making the application slow . int nLen = GetWindowTextLength(); GetEditCtrl().SetSel(nLen,nLen); // tested GetEditCtrl().SetSel(-1,-1); as well GetEditCtrl().ReplaceSel(strTemp); // strTemp is the Cstring data which is read from pipe Is there any better way to make application not to get slow in Window 7 ?
-
free cloud hosting for testing purposeNo you can't. if you want to use .net and test it .its better you use Windows Azure cloud platform.