Answer Questions
Dietz passing and returning arguments to functions
for the life of me i dont know how to make this work in Managed C++. what am i doing wrong ref class Test { public : static void testFunc(String^ buffer) { buffer = "altered" ; } }; int main( array <System::String ^> ^args) { Test^ testClass = gcnew Test(); String^ buf = gcnew String( "some string" ); Console::WriteLine( "before {0}" , buf); //should print "some string" testClass->testFunc(buf); Console::WriteLine( "after {0}" , buf); //should print "altered" return 0; } thank you for that correction! it makes it easi ...Show All
ShEi Problems with Char*'s and LPCWSTR need help
I am trying to use the openregistrykeyex or openregistrykey function from the windows.h include file and I have the following code HKEY hKey = NULL; char * temp = "String" ; int len = strlen(temp) +1; wchar_t *wText = new wchar_t [len]; if ( wText == 0) return 0; memset(wText,0,len); ::MultiByteToWideChar(CP_ACP, NULL, temp2.c_str(), -1, wText,len); const wchar_t * test = wText; //long tempResult = RegOpenKey(HKEY_LOCAL_MACHINE, test, &hKey); long tempResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, test,0, KEY_READ, &hKey); Neither work and I can't understand the cryptic error codes if someone could help me unravel the error codes error code = Error 1 error LNK2028: ...Show All
SnakeSV Problem - CEdit displays entered character 4 times
Greetings! I'm buiding a dialog-based App and use lots of the CEdit-Control to enter floating-point-numbers. My problem now is that every single CEdit displays the entered character 4 (!) times in its field, for example: I enter "123" The CEdit says "111122223333" I cannot think of anything unusual I have done to the CEdits, only the Number-Flag in the Properties-Editor is checked for all of them. But diabling this flag did nothing to solve my problem. Instead of 'a' I get "aaaa"... Any clues what's going on here Bye! I am seeing this problem on XP x64 Service Pack 1 machines. The code works properly on 32bit XP. Anyone have any ideas Thanks, Chuck some way your cod ...Show All
NoEgo Rebuild/Repair solution?
Hello all, I had originally added a generic class to my solution through the class view. Later, I changed my mind and decided to eradicate this class from my design. I didn't see an option to delete class by right clicking it in class view so I exited VS2005, deleted the .cpp and .h files for the class and eliminated all references to the class in the other source files. The solution compiles but now I get linker error 1181 claiming that the linker cannot open the (deleted) class's object file. How do I fix this and, for future reference, what is the "correct" way of eliminating classes from projects Thank you! Open Solution Explorer and remove this class files from there. ...Show All
John Sobernheim Get and Set properties of static window at run time
Hello Gents, I am developing a desktop PC application. In this application, the user can create static window at run time.That means, the application based on Dialog window, the user click the create button the new static window created. The user can able to change positon ,size , text, color and also move the static window to over the client area. clarification : How can i get the properties ( static window frame border , color ) of static window when the user can change the position,resize that window I am waiting for yours valuble response!!!! Thanks and Reagrds, Vishva There’s another method to implement the same. You will be no ...Show All
Lawrence 007 LNK4098 and static libraries using different runtime types
I've inherited a project that has various problems. This project is a DLL linking with the MT run-time libraries. It also links to several static libraries that are outside of my control but I believe they're all compiled with the same version of Visual C++. I'm assuming the LNK4098 warning is being dumped out because one or more of the other static libs were compiled with a different runtime type (assuming single threaded). The dox for LNK4098 mention "...prevent mixing different [run-time] types... You receive this warning if you try to use different types ... of the run-time library...". A warning doesn't seem like prevention to me. It then goes on to describe the NODEFAULTLIB option and what run-time libraries to ignore wh ...Show All
thukralz error LNK2005 on static class variable
Hi again, I am getting this linker error below and could not quite figure out why. It seems that the linker is saying I declared my static class variable OptionFactory EuropeanCall::MyFactory mutliple times. Perhaps it is the way I am declaring it inside VanillaOptions.h I am rather new to C++ so it is not obvious to me. Thank you for any help! Linking... OptionFactory.obj : error LNK2005: "public: static class OptionFactory<class BaseOption,class EuropeanCall> EuropeanCall::MyFactory" ( MyFactory@EuropeanCall@@2V $OptionFactory@VBaseOption@@VEuropeanCall@@@@A ) already defined in MCMain.obj VanillaOptions.obj : error LNK2005: "public: static class OptionFactory<class BaseOption,class EuropeanCall> ...Show All
enric vives Multithreading and DoEvents.
Hi, I have a dll in VC# (Visual Studio 2005). The dll was created by me and it has threads for sending and receiving data over sockets. ( Actually it was a server code I was working on and now I needed to integrate with a third party tool which is in VC++, so I created a dll). As the threads had infinite while loops in them I was using Application.DoEvents before calling the while(true) statements in the VC# server. When I created the dll I had to remove the doevents part ( as there are no forms in a dll). Now when I use the dll in the VC++ code, it really slows down the application ( I am normally rendering frames at 40fps but when the sockets start sending and receiving I only get 1 or 2 fps). So my first question is that is there ...Show All
pdns Export/Import a Bitmap to a DLL
Hi: I want to export a bitmap to a DLL. Then I want to import it from it. Do you have any idea Thank you... Hi: Thank you. Last question, by "external editor" you mean that I must create my own resource script manually. By "external editor" I mean a graphical editor like Adobe Photoshop, Corel Painter, Paint etc. After adding to resources, the image is still stored in separate file, therefore you can edit it using any graphical editor. If you need to insert a bitmap programmatically as a resource, I think you should consider UpdateResource function and related ( http://msdn2.microsoft.com/en-us/library/ms648049.aspx ). In order to access the b ...Show All
benny353 upgrading application from windows2000 to windows XP
Dear All, We have an application developed to work on windows 2000 and we want to run the application on windows XP now. Any changes are required to the application software Please suggest. Thanks This is from the docs: VER_PLATFORM_WIN32_NT is set for "Windows Server 2003, Windows XP, Windows 2000, or Windows NT." So this check must also succeed for XP! Hello Martin and Alex, Thank you very much for your answers. I found in the code that the application checks for the operating system and if the OS is other than 2000/NT it aborts. Please find below that part of the code. In this case do I need to change any thing which will make the software to run even on W ...Show All
Pavan Contractor Sample Code Errors
I was trying to test out some Serialization stuff using the C++ example code at: http://msdn2.microsoft.com/en-us/library/system.runtime.serialization.formatters.binary.binaryformatter.aspx but when I tried to run it it told me that there were 58 things not defined. I think the problem is that the namespaces are not acctually being used, so if anyone has any ideas why these are not being detected then please help me :| Hello Re: Sample Code Errors I am going to mark this thread as answered since you have not followed up with any further information on your problem - I assume you solved the problem yourself or one of the suggestions in this thread helped you solved the problem. If you have a solution you ...Show All
Raulsassaa How to get control's relative position and it's size in a window / dialog box?
Hi all, Actually I am trying to give a different appearance to my vc++ application. i.e. i like to change the appearance of all controls in my dialogs. So I like to draw control's border in my own after removing its border property. So can any one tell me how to get relative position of controls in window / dialog any suggestions would be appreciated. Purusothaman A Hey...I am a starter... but may be I can help u...... use CWnd *pCancel = NULL; CRect rectCancelRect; pCancel = (CWnd *)GetDlgItem(IDCANCEL); pCancel->GetWindowRect(&rectCancelRect); ScreenToClient(&rectCancelRect); Thanks ...Show All
Federico Silberberg I want to use ping to detect if the internet connection is connected or not , need a good sample program
I want to use ping to detect if the internet connection is connected or not , I need a good sample program .please give me a good sample program to do this. I appreciate your help. Hello Re: I want to use ping to detect if the internet connection is connected or not , need a good sample program Such questions are outside the scope of this forum - for the scope of the VC General forum please look at: http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=19445&SiteID=1 For such issues please use the newsgroups at http://msdn.microsoft.com/newsgroups . OTP Thanks Damien It seems that ping program runs different in wireless network and cable network, ple ...Show All
Kestutis MSVC 2003: ctor-try-block error: possible compiler bug
This message was originally posted to comp.lang.c++.moderated ----------------------------------------------------------------------------------------------- Hi! I 've faced a problem in my production code. I could deduce this problem to program shown below. It seems, that try-block in constructor doesnt work as it should (compared to case where no try block exists at all). I tested this small program on my MSVC .NET Pro 2003 (and separately on PC with MSVC2003 SP1 installed). In both cases I experienced the same behaviour - access violation. Please see comment inside the program body. To get this sample work - just comment out try block in ctor. Have anyone faced such behaviour before Is there known workarounds Thanks. Kiri ...Show All
Ravel question about dlls
hey all i am using visual studio express and i was wondering if it was possible to creat dll files. i am putting a hook procedure in it. if it is please tell me thanx. I am suggesting that you first create a windows application, and then manually make the changes to the project settings to convert it to a dll project. Selecting console app is also okay. But you'll need to make a couple additional adjustments. First see if you can follow along with what I've said so far. There is another way to do it. http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/default.aspx At the very bottem there is information on how to enable windows and dll applicatio ...Show All
