Search Results

Search found 8 results on 1 pages for 'fneep'.

Page 1/1 | 1 

  • VS2010 "An item with the same key has already been added"

    - by fneep
    I recently installed Visual Studio 2010 and copied and converted an old VS2005 solution to VS2010 When I edit this solution, if I try to change a control's .image property, VS2010 creates a message box telling me that "An item with the same key has already been added" (screenshot below), and won't let me browse for an image. I can add images for any other solution, even others ported from VS2005, but not this one. Any idea what I'm doing wrong?

    Read the article

  • How do you disable a DataGridView's keyboard shorcuts?

    - by fneep
    I've just noticed that DataGridViews have a default shortcut so that whenever you press "Ctrl + H", the DataGridView's editing control backspaces, and can delete your entire selection within the cell. This can get quite annoying since I want to open a Replace box whenever Ctrl H is pressed. Is there any way to stop the backspacing while still being able to use it to open the replace box? I'm running C# 2.0, but I could update my application to 3.5 if the newer C# has a solution.

    Read the article

  • How do I go about overloading C++ operators to allow for chaining?

    - by fneep
    I, like so many programmers before me, am tearing my hair out writing the right-of-passage-matrix-class-in-C++. I have never done very serious operator overloading and this is causing issues. Essentially, by stepping through This is what I call to cause the problems. cMatrix Kev = CT::cMatrix::GetUnitMatrix(4, true); Kev *= 4.0f; cMatrix Baz = Kev; Kev = Kev+Baz; //HERE! What seems to be happening according to the debugger is that Kev and Baz are added but then the value is lost and when it comes to reassigning to Kev, the memory is just its default dodgy values. How do I overload my operators to allow for this statement? My (stripped down) code is below. //header class cMatrix { private: float* _internal; UInt32 _r; UInt32 _c; bool _zeroindexed; //fast, assumes zero index, no safety checks float cMatrix::_getelement(UInt32 r, UInt32 c) { return _internal[(r*this->_c)+c]; } void cMatrix::_setelement(UInt32 r, UInt32 c, float Value) { _internal[(r*this->_c)+c] = Value; } public: cMatrix(UInt32 r, UInt32 c, bool IsZeroIndexed); cMatrix( cMatrix& m); ~cMatrix(void); //operators cMatrix& operator + (cMatrix m); cMatrix& operator += (cMatrix m); cMatrix& operator = (const cMatrix &m); }; //stripped source file cMatrix::cMatrix(cMatrix& m) { _r = m._r; _c = m._c; _zeroindexed = m._zeroindexed; _internal = new float[_r*_c]; UInt32 size = GetElementCount(); for (UInt32 i = 0; i < size; i++) { _internal[i] = m._internal[i]; } } cMatrix::~cMatrix(void) { delete[] _internal; } cMatrix& cMatrix::operator+(cMatrix m) { return cMatrix(*this) += m; } cMatrix& cMatrix::operator*(float f) { return cMatrix(*this) *= f; } cMatrix& cMatrix::operator*=(float f) { UInt32 size = GetElementCount(); for (UInt32 i = 0; i < size; i++) { _internal[i] *= f; } return *this; } cMatrix& cMatrix::operator+=(cMatrix m) { if (_c != m._c || _r != m._r) { throw new cCTException("Cannot add two matrix classes of different sizes."); } if (!(_zeroindexed && m._zeroindexed)) { throw new cCTException("Zero-Indexed mismatch."); } for (UInt32 row = 0; row < _r; row++) { for (UInt32 column = 0; column < _c; column++) { float Current = _getelement(row, column) + m._getelement(row, column); _setelement(row, column, Current); } } return *this; } cMatrix& cMatrix::operator=(const cMatrix &m) { if (this != &m) { _r = m._r; _c = m._c; _zeroindexed = m._zeroindexed; delete[] _internal; _internal = new float[_r*_c]; UInt32 size = GetElementCount(); for (UInt32 i = 0; i < size; i++) { _internal[i] = m._internal[i]; } } return *this; }

    Read the article

  • Why am I getting 'Heap Corruption'?

    - by fneep
    Please don't crucify me for this one. I decided it might be good to use a char* because the string I intended to build was of a known size. I am also aware that if timeinfo-tm_hour returns something other than 2 digits, things are going to go badly wrong. That said, when this function returns VIsual Studio goes ape at me about HEAP CORRUPTION. What's going wrong? (Also, should I just use a stringbuilder?) void cLogger::_writelogmessage(std::string Message) { time_t rawtime; struct tm* timeinfo = 0; time(&rawtime); timeinfo = localtime(&rawtime); char* MessageBuffer = new char[Message.length()+11]; char* msgptr = MessageBuffer; _itoa(timeinfo->tm_hour, msgptr, 10); msgptr+=2; strcpy(msgptr, "::"); msgptr+=2; _itoa(timeinfo->tm_min, msgptr, 10); msgptr+=2; strcpy(msgptr, "::"); msgptr+=2; _itoa(timeinfo->tm_sec, msgptr, 10); msgptr+=2; strcpy(msgptr, " "); msgptr+=1; strcpy(msgptr, Message.c_str()); _file << MessageBuffer; delete[] MessageBuffer; }

    Read the article

  • How do you keep the text selection on a DataGridView?

    - by fneep
    I'm running C# 2.0, and I've written an application with a DataGridView in virtualmode and a TreeView in the same form, but in different panels of a SplitContainer. My application has a "find all" function that finds all instances of a certain string, and adds them as the child nodes to a new node to the TreeView (it's a tree view because you can have multiple search results by having different root nodes). That idea is that when you click on one of those search results in the TreeView, that it would select the specific text of that result in the DataGridView (Virtually the same as Notepad++'s find all function) When I click on the TreeView, it does set the selected cell of the DataGridView and highlight the specific text, but it loses that specific text selection instantly (but keeps the cell selection) because by clicking on the TreeView the DataGridView loses focus. Here's the code for the AfterSelect of the TreeView: private void Tree_Results_AfterSelect(object sender, TreeViewEventArgs e) { if (e.Node.Level > 0) { SearchResult SelectedItem = (SearchResult)Tree_Results.SelectedNode.Tag; DataViewMain.CurrentCell = DataViewMain[SelectedItem.TypeIndex, SelectedItem.LineIndex]; DataViewMain.BeginEdit(false); DataGridViewTextBoxEditingControl SelectionData = (DataGridViewTextBoxEditingControl)DataViewMain.EditingControl; SelectionData.SelectionStart = SelectedItem.HighlightStart; SelectionData.SelectionLength = SelectedItem.HightlightLength; } } If the DataGridView were a text box I could possibly set HideSelection to false, but DataGridViews have no such property (and changing the Hide Selection for the EditingControl does nothing) Any ideas? I'm receptive to a different control instead of a TreeView that would allow my DataGridView to retain focus.

    Read the article

  • How do I repass a function pointer in C++

    - by fneep
    Firstly, I am very new to function pointers and their horrible syntax so play nice. I am writing a method to filter all pixels in my bitmap based on a function that I pass in. I have written the method to dereference it and call it in the pixel buffer but I also need a wrapper method in my bitmap class that takes the function pointer and passes it on. How do I do it? What is the syntax? I'm a little stumped. Here is my code with all the irrelevant bits stripped out and files combined (read all variables initialized filled etc.). struct sColour { unsigned char r, g, b, a; }; class cPixelBuffer { private: sColour* _pixels; int _width; int _height; int _buffersize; public: void FilterAll(sColour (*FilterFunc)(sColour)); }; void cPixelBuffer::FilterAll(sColour (*FilterFunc)(sColour)) { // fast fast fast hacky FAST for (int i = 0; i < _buffersize; i++) { _pixels[i] = (*FilterFunc)(_pixels[i]); } } class cBitmap { private: cPixelBuffer* _pixels; public: inline void cBitmap::Filter(sColour (*FilterFunc)(sColour)) { //HERE!! } };

    Read the article

  • How do you embed a resource so that it can be accessed for icons?

    - by fneep
    I have a C# project using VS2005. Basically I have two icons, one for the application, and one for files that are associated with the application. I have associated these files with the application, and I know how to set their icons in the Registry, but I can only set them to the application icon because it seems to be the only external resource. To show what I mean, I've built the app and opened it with Resource Hacker, and you'll notice only one of the two icons is there, using one icon and one icon group.

    Read the article

  • Associate File Extension with Application

    - by fneep
    I've written a program that edits a specific filetype , and I want to give the user the option to set my application as the default editor for this filetype (since I don't want an installer) on startup. I've tried to write a re-useable method that associates a file for me (preferably on any OS, although I'm running Vista) by adding a key to HKEY_CLASSES_ROOT, and am using it with my application, but it doesn't seem to work. public static void SetAssociation(string Extension, string KeyName, string OpenWith, string FileDescription) { RegistryKey BaseKey; RegistryKey OpenMethod; RegistryKey Shell; RegistryKey CurrentUser; BaseKey = Registry.ClassesRoot.CreateSubKey(Extension); BaseKey.SetValue("", KeyName); OpenMethod = Registry.ClassesRoot.CreateSubKey(KeyName); OpenMethod.SetValue("", FileDescription); OpenMethod.CreateSubKey("DefaultIcon").SetValue("", "\"" + OpenWith + "\",0"); Shell = OpenMethod.CreateSubKey("Shell"); Shell.CreateSubKey("edit").CreateSubKey("command").SetValue("", "\"" + OpenWith + "\"" + " \"%1\""); Shell.CreateSubKey("open").CreateSubKey("command").SetValue("", "\"" + OpenWith + "\"" + " \"%1\""); BaseKey.Close(); OpenMethod.Close(); Shell.Close(); CurrentUser = Registry.CurrentUser.CreateSubKey(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.ucs"); CurrentUser = CurrentUser.OpenSubKey("UserChoice", RegistryKeyPermissionCheck.ReadWriteSubTree, System.Security.AccessControl.RegistryRights.FullControl); CurrentUser.SetValue("Progid", KeyName, RegistryValueKind.String); CurrentUser.Close(); }

    Read the article

1