Answer Questions
n0n4m3 Casting the Object type
What is the correct syntax to cast an Object into an int For example, ListViewItem's Tag property is of type Object. After the property is set with an int value, how do I cast it back to an int value int n = (int)item->Tag; You can also do a static_cast: int n = static_cast<int>(item->Tag); ...Show All
LucasPc REPORT_EXCEPTION macro. A bug or a feature?
Did anybody use REPORT_EXCEPTION macro in Native C++ Location: afx.h header of MFC. It is very useful as seems to me and a very new one (if I don't err in regard to facts - it presents only in VC++ 2005, MFC 8.0). I think I've detected a strange behavior concerning it. More specifically, it dosn't work properly at runtime with _UNICODE. If you take a good look at him, you'll see that there is some thing off. As for me __FILE__ must be replaced with _T(__FILE__) everywhere in the definition. Yet the same must be done with szMsg parameter ( or it could be actually passed as generic-text-mapped ) . I prefer the embraced option. After resolving this question we could than fix also EXCEPTION_IN_DTOR macro following right after REPORT_EX ...Show All
cplusplus1 problem in retrieving "Time" from database using _RecordsetPtr
Here i am developing a application which require to fetch Time from database . But i am getting 00:00:00 AM as a time everytime. We are using MySql database. Code fragment is.... ======================================================== _variant_t vtValue; vtValue = RsSession->Fields->GetItem("StartTime")->GetValue(); COleDateTime d( vtValue ); sprintf( name, "%02d:%02d:%02d",d.GetHour(),d.GetMinute(),d.GetSecond() ); ======================================================== in "name" i am getting "00:00:00" ..everytime.. All the other values i am retrieving from ResultSetPtr are OK. Can any one tell me what is to be done ther .... Thanks in advance hello brian i ...Show All
nick5454 Using resource as a normal file
Hi, i have a problem regarding resources and files. So i'm using ZipArchive library to manipulate zip files, and i don't want to load file directly from specyfied path, but from resource. I've add *.zip file into resource, but i can't think a way to open it, directly from program. I'am opening archive with CZip::OpenArchive(const char*) // specyfied parameter can have diffrent type, but i think the main idea is obviuos. Thank for help, and sorry about my English if i've made anny mistakes. Something like: rsrc = ::FindResource(0, MAKEINTRESOURCE(YOUR_RESOURCE_ID), "YOUR_RESOURCE_CUSTOM_TYPE") //I do not remember order of arguments it could be id first, also it could be easier if your ids are strings h ...Show All
Keith Chapman Non-Square MFC Dialog
I am using Studio 2005, and have made a Dialog based app. I have an image that I want to use as the dialog background and shape. How would I go about getting the dialog to be non-square and use this image Thanx Scan your image by lines along X or Y cordinate. Assume it will be X. Select a lines with continuous NON-transparent pixels. Add (by union) each that line to a region. Then you obtain a region that corresponds to you non-transparent area in bitmap. Then use CWnd::SetWindowRgn or CWindow::SetWindowRgn (depends upon type of your application) to set this region as the window region and your window becom non-square. The last, use WM_ERASEBKGND (or WM_PAINT )event handler to draw ...Show All
collide VC++ Windows Form and C++ libraries
I understand that VC++ 2005 could be used to create .Net Windows Form apps. Could the same app utilize 3rd party C++ header files and libraries If not, what are the alternatives C++/CLI program can use unmanaded libraries directly, this is advantage of C++/CLI over C# and VB .NET. To use third-party unmanaged libraries, do the same as in unmanaged client: add .lib file to the list of libraries for Linker, add #include line and call unmanaged functions directly. ...Show All
JustinParkes Binary
I am using VS 2005 standard edition. I am sending and receiving data via RS232 using an application that I written in C++. The data is ascii but I want to see a binary representation in order to analyse it completely. I am reading the data received into a text box. Is there a standard method of converting the ascii data in the text box into its binary representation No, it won't read letters, but if you change it to read the letters a character at a time and convert to char, then it will. nobugz just posted some code which looks at first glance like it will do that for you. Oh - this is C++/CLI. CString is part of MFC. However, the .NET framework does it better anyhow String ^ myStri ...Show All
fiaolle Monitoring Child Process..
Hi, I am writing an application which silently install netfx.exe redistributable. I want to catch events(start and end of the child process) and error codes in case if execution fails. I have tried using Piping but not sucess. I am not getting any bytes in the pipe for all the use cases which i have tried. I also tried one C runtime function which creates and wait for the termination of the process. It also return the Error codes for netfx.ex. But i am looking for more flexible solution like piping. Could anyone help me figure understand why piping is not working and how _wspawn() [i think i got the name right] works. Is there any other ways i can monitor and get error codes. Regards Debugger ...Show All
Elham Sarikhani How to judge if a string is a number?
Now i want to judge if a string is a number, for example string "111234" is a number, but string "[12345]" is not a number, how to realize it is there function to be used in std or boost thks Those functions will give you 0 as the result value, so giving these doesn't answer the question. Use isdigit() on each of the characters in the string. CRT provides the following set of function to convert a string (char *) to a integer atoi, _atoi_l, _wtoi, _wtoi_l Please check the help on these api's for details You can use a string stream to do this: Example with a char array   ...Show All
Derek Nedelman unresolved external symbol
hello, I opened a second thread because this problem has nothing to do with the name of the topic of the other. I posted this also in Visual Studio C++ Express Edition because this problem might relate to the IDE. I want to implement a simple c++ programm which has a header file and a implementation file. the header file: [code] #include <iostream> namespace main_savitch_2C { class statistician { public: void next(double r); private: int count; }; } [/code] and the implementation file which contains now only the definitions: [code] #include "stats.h" using namespace main_savitch_2C; void statistician::next(double r) { } [/code] But when I try to compile this very simple program, the following error occurs: --- ...Show All
tileteam ManClass.obj : error LNK2028: unresolved token (0A0004BC) "public: __thiscall MyMathFuncs::MyMathFuncs(void)" (??0MyMathFuncs@@$
Hi I have trying to build a managed class wrapper for experimenting with native code and getting this error , I have included the lib file and the settings pull in the header file. ManClass.obj : error LNK2028: unresolved token (0A0004BC) "public: __thiscall MyMathFuncs::MyMathFuncs(void)" ( 0MyMathFuncs@@$$FQAE@XZ) referenced in function "public: __clrcall MathFuncsWrapper::MathFuncsWrapper(void)" ( 0MathFuncsWrapper@@$$FQ$AAM@XZ ) ManClass.obj : error LNK2019: unresolved external symbol "public: __thiscall MyMathFuncs::MyMathFuncs(void)" ( 0MyMathFuncs@@$$FQAE@XZ) referenced in function "public: __clrcall MathFuncsWrapper::MathFuncsWrapper(void)" ( 0MathFuncsWrapper@@$$FQ$AAM@XZ) Here is ...Show All
hschlicht Menu Bars and Dialog Boxes
Hi, I am trying to add a menu bar on a dialog box but my attempts seem to fail miserably... I can't see an option in the toolbox for a menu so i thought that i could create the menu and then add it to the dialog box... Is this plausible If so what's the procedure to do so Otherwise does anyone know how to go about creating and adding a menu bar to a dialog box Thanks --Anger Since you are speaking about "Dialog Box" I suppose you are using MFC. So here are some steps to do it: Add a menu resource to your resource file Open the dialog box in the resource editor Go to dialog box properties window and select the added menu resource in the Menu field To add an ...Show All
Saroj K. Nanda C++ Generics issue
Hi. I'm having a problem converting some C# to C++/CLI, which involves generics: //// C# code (compiles and runs): ///////////////////////// // The constraint requires the generic parameter T // to be convertable to the type of the derived class: public abstract class MyBaseT<T> where T : MyBaseT<T> { public MyBaseT() { } } public class MyDerived : MyBaseT<MyDerived> { } //// (equivalent ) C++/CLI code: //////////////////// generic<typename T> where T : MyBaseT<T> public ref class MyBaseT abstract { public: MyBaseT() { } }; public ref class MyDerived : MyBaseT<MyDerived> { }; /// Compiler error: Error 1 error C3393: syntax error in constraint cla ...Show All
logtorahul Run only one application
Hi, I want to create application that can only be executed once. I mean like MSN, once you have run it and you execute it once again, the previous program window will appear. Can someone please show me how to do it Thank you Also see "single-instance" - Google Search . There are many other search engines that you can use instead. The term you want is single-instance , either with or without the hyphen. There are many ways to do that and many samples and articles. I am not familiar with specific samples provided by Microsoft but thre are some, either in the samples provided with VC or in articles such as the articles in MSJ and MSDN magazines. Single-instance samples are very likely to exist in any site (but not min ...Show All
Swarna Which way should I go? C++ or C#
I'm about to start developing a windows application which is currently in VB6 using an Access database. Which route should I take language wise, c++ or c# and what's the difference Thanks for the info. As I already code in VB is their any benefit in moving to C# Just search for the answer to this and it appears to be somewhat complex (can of worms) there's even a book about it ! ! LOL Most VB6 developers usually continue with VB .NET. Advantage of VB .NET is that there are lot of database programming samples written in VB .NET. Advantage of C# is that it looks like real programming language. Most .NET developers can write in both la ...Show All
