Answer Questions
hazz Data Type conversion between JavaScript and C++
I am using the XMLHTTPObject in javascript, it need to invoke an ActiveX object. The ActiveX Object is written in VC++ 6.0. VC++ function looks like this. ========================= long CMYComponent::saveToFile(LPCTSTR aFileName, LPCTSTR aData, short aNewFile) { // TODO: Add your dispatch handler code here writeToFile((char *)aFileName , (char *)aData, aNewFile); return 0; } ==========================JAVASCript code=== saveToFile(fileName, xmlHTTP.responseText,1); ================================= if the data type in the reposne is ascii it works fine. if the data type is binary it fails. Really I want to send xmlHTTP.responseBody to the C++ function above, what is the best data type I should use in C++ function so that I can make it ...Show All
TommieJ System.DateTime to c++ DATE structure conversion?
can someone help me how to convert the System.DateTime to unmanaged DATE structure in c++ The only DATE that I know in Visual C++ is a typedef double, not a struct. To convert to that DATE just use the ToOADate of the DateTime struct: DATE d = dateTime.ToOADate(); excelent, sorry for the desinformation about struct, its really a double.. thanx for answer ...Show All
Michael1956 Memory leaks created by the compiler/ run-time system
I have spent nearly two weeks trying to find some memory leaks in a program I am developing. Initially I thought it had something to do with PlaySound (see previous post, 30 Jan 2007) but that was not so. I have now discovered some hidden memory leaks in C++ which I am happy to share with others. (Please note I am using Version 6.0. It’s possible these problems have been fixed in later versions.) The following code: CSize test = pDC->GetTextExtent(“ABCDEFG”); creates a memory leak. I thought that all memory allocated within a function (when not using ‘new’) would be deallocated at the exit, but this is not so. My best guess is this. GetTextExtent has two forms and the form used above needs a CString par ...Show All
Luigi Fonti Problem with example for __asm calls
I tried the following example from msdn sites: http://msdn2.microsoft.com/en-us/library/y8b57x4b.aspx I've made a new project >> Win32-Consoleapplication selected empty project added a blanc file called main.cpp into it and copied the examplecode into it saved build project and started debug for testing it and i got the following response: Unhandled Exception at 0x004020a2 in asm_1.exe: 0xC0000005: Access Violation while writing at Position 0x00003010. (*translated from german to english) I searched msdn and google for it but found nothing. Is there Something wrong with the example, or did i forgot something Environment: AMD AthlonXP WinXP Home Edition SP2 MS VC++ 2005 .NET That code only works if you link s ...Show All
Hello_Yo (MSVCRT) _iob disappeared?
What can I do to replace the functionality of _iob Seems to be missing in MSVCR7/8 (using VS2005). Error 1 error LNK2001: unresolved external symbol _iob main.def In my def, I'm redirecting this export as such: _iob=MSVCR80._iob I also tried: _iob=MSVCRT._iob Hello, I'm facing exactly the same problem. I need to compile with a library that was compiled using VC 6.0. Of course I have no way to recompile this library as it's part of a product from another company. Did someone have a way to avoid this problem I tried to make some stubs, I check in the header file (stdio.h, wchar.h) and so on... Many thanks in advance Laurent Flahou ...Show All
J4m3sB DLLs unloaded
Hi, guys: I have a COM component. It uses several third party DLLs. Recently, I noticed that after the DLL holds the COM component is unloaded from the memory, the third party DLLs can stay in the memory, and when recreating the instance of the COM component, the third party DLLs will not be reloaded. Sometimes, this will cause GPF. My question is why the third party DLLs can stay in the memory, and how can I unload them Thanks, Zhen That's pretty weird, I think it is the Windows Loader that keeps reference counts on implicitly loaded DLLs and it is not known for getting it wrong. One way to debug this is to use the DependencyWalker tool, use the Profile menu command to watch DLLs getting lo ...Show All
jduartedj multiple libraries problem
i am attemoting to use multiple libraries for my program since i need to use a library created by an outside party which contains functions i need in my proram. the problem is when i add this library to my Additional Dependencies this is the error messages i get (the include/sources/etc paths also already changed to include the new funcations) Linking... LIBC.lib(crt0dat.obj) : error LNK2005: _exit already defined in MSVCRTD.lib(MSVCR80D.dll) LIBC.lib(crt0dat.obj) : error LNK2005: __exit already defined in MSVCRTD.lib(MSVCR80D.dll) LIBC.lib(crt0dat.obj) : error LNK2005: __cexit already defined in MSVCRTD.lib(MSVCR80D.dll) LIBC.lib(fflush.obj) : error LNK2005: _fflush already defined in MSVCRTD.lib(MSVCR80D.dll) LIBC.li ...Show All
Neotech C++/CLI /CLR Managed Support in Native Library
Hi, I have a C++ project, a .dll project in Visual Studio 2005, which uses all native C++. I was able to compile the project with the /clr option (just /clr for common language runtime support). I am able to add the a reference to the dll with another C++ project, which is also compiled with the /clr option, and the entire application runs fine. The problem comes when I try adding the .dll project reference to a test C# project and add a "using MyCPPNamespace" to my C# class. I don't see the new C++ project namespace anywhere within my intellisense in the C Sharp project and I can't just add it as a using. I thought compiling my native C++ project with the /clr option allowed us to add references to these projects in other manage ...Show All
Dhow Unicode newline using TEXT macro?
Somehow I feel stupid for not being able to figure this out, but here goes: I want to include a newline in a string literal that's being converted to Unicode inside a TEXT macro. The converted string gets passed to DrawText. I've tried a variety of different escape code literals (like \n, \r, \n\r, \0\n, etc.), and none have had the desired result. Anybody know the correct arcanity to solve this problem Thanks, Barry At one point in my code, I do this: AddItem(TEXT("blah blah\r\nblah blah blah\r\nblah blah")); Eventually this call works its way down so that a buffer of WCHARs is allocated and the string is copied into it, but that's not important. The buffer address is later passed into DrawT ...Show All
TheresaKad Linking errors building AMCap (sample from DirectShow, SDK )
Hi! I'm trying to build this application, which should have no problems, but I'm getting linking errors with Visual 2005 Express. These are the errors I get: ------ Build started: Project: AmCap, Configuration: Debug Win32 ------ Linking... amcap.obj : error LNK2019: unresolved external symbol __imp__CoCreateInstance@20 referenced in function "long __cdecl AddFilterByCLSID(struct IGraphBuilder *,struct _GUID const &,struct IBaseFilter * *,wchar_t const *)" ( AddFilterByCLSID@@YAJPAUIGraphBuilder@@ABU_GUID@@PAPAUIBaseFilter@@PB_W@Z) SampleCGB.obj : error LNK2001: unresolved external symbol __imp__CoCreateInstance@20 amcap.obj : error LNK2019: unresolved external symbol __imp__CoTaskMemRealloc@8 referen ...Show All
AlanKohl How to avoid Busy Waiting?
Hey everyone :) I wish to know how can I translate a "busy waiting loop" approach into an event driven approach Lets say I have a queue of tasks, whenever there are elements in the queue, a process has to treat these elements Now I do it like this: while(1){ if(MyQ.Size()>0){ My.Q.RemoveHead .... } } This approach causes the cpu to work on full load, even if there are no elements in the queue. Is there a way to avoid this loop and somehow to create an event driven approach. Something like OnQueueHasElements... Thanks in advance :) Bancila, Sorry I don't think that this is a good solution for the problem. I think usage of multiple threads can resolve issue ...Show All
Subhas Visual Studio 2005 Service Pack 1 Beta - error C2244
Hello, I installed SP1 Beta asap, because I am encountering the "Updating Intellisense ... 100% CPU load" problem. Intellisense problem seems to be resolved, but now I can't compile QT 4.1.4 here is compiler message: -----------------------------------------start c:\qt\4.1.4\include\qtcore\../../src/corelib/tools/qhash.h(805) : error C2244: 'QMultiHash<Key,T>::replace' : unable to match function definition to an existing declaration c:\qt\4.1.4\include\qtcore\../../src/corelib/tools/qhash.h(790) : see declaration of 'QMultiHash<Key,T>::replace' definition 'QHash<Key,T>::iterator QMultiHash<Key,T>::replace(const Key &,const T &)' existing declarations ...Show All
Shan McArthur C++/CLI crashes with a pure static C++ lib
Greetings, I was trying to use a static lib in my Windows Forms exe app, but as soon as I call any function from that lib, the app crashes with an assert from the CRT, and then I get this exception: ***** An unhandled exception of type 'System.TypeInitializationException' occurred in Unknown Module. Additional information: The type initializer for '<Module>' threw an exception. ***** The debugger shows that CRT asserts on allocating memory for a global class instance declared in the static lib, because the heap used for that instance is not from the CRT heap. The project is compiled with /clr only. If I remove the global variable from the lib, everything works ok... Here is a sample program that demonstrates the problem: http://www. ...Show All
Joe Morel - MSFT textBox - 2 questions
Hi all. I have a textBox controler in my win app that i write in c++. I insert data into the textBox in runtime. 2 Questions: 1) Is it possible to insert the data in LIFO that means that if i insert line "bla bla bla" then new line and then "yada yada yada" it will appear as yada yada yada bla bla bla Is it possible without clearing the box each time, writing new line and then filling with old data. (I have a lot of info and after a while the screen updates slow) 2) If the first question is answered and the data is inserted in LIFO, is it possible to show only the last X lines As i mentioned i have a lot of data comming in but only the last data is the relevant to see... Thanks ahea ...Show All
EZ1976 ref class VS. value class
HI everyone, I am new in C++.NET 2005 world and there is something that makes me a little crazy: What is the difference between ref class and value class also ref struct and value struct Which type of classes ( ref or value ) I should create for my applications I hope anyone who have the answer helps me to figure this out of me. I'm sorry that you feel neglected. Some questions just slip by unnoticed, while we're all sleeping :) The main difference between ref and value types is that ref types contain pointers to their data, while value types contain the actual data. For most uses, that is worker classes, gui classes, utility classes, you'll want to use the ref types. If, on the other hand, you're wr ...Show All
