Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
T

Tom Moore

@Tom Moore
About
Posts
51
Topics
23
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Linked Lists and unique_ptr's
    T Tom Moore

    Hi, its been a while since I've used CodeProject. Quick Question. I'm training myself on standard algorithms and trying to create a linked list. In Java it's easy.

    class Node{
    public int data;
    public Node next;
    public Node(int val){ data= val; next = null;}
    }

    In the C++ Pre Ox11 you could use raw pointers.

    struct Node{
    int data;
    Node* next;

    Node(int val):data(val),next(0){}
    }

    but you had to new up your next node and delete it afterwards. With the new version of C++, you can use unique_ptr. But if I try to use that, I can't seem to get a good node to next.

    struct node{
    int data;
    unique_ptr next;

    node(int al):data(val),next(nullptr){}
    }
    node a(3);
    node b(4);
    a.next = b; // Error
    a.next = move(b); // Error
    a.next.reset (b); // Error

    Please could you enlighten me, on how I can get this to work. Many Thanks Tom

    C / C++ / MFC c++ java data-structures help question

  • Getting the handle of a PictureBox in MFC
    T Tom Moore

    Hi, It's been a while since I've posted in here. A friend and I have a problem with MFC, We're trying to get the handle of a PictureBox in MFC, but the code we use keeps returning null. Here is a code snippet we're using

    CStatic* pCStatic = (CStatic*) GetDlgItem(IDC_STATIC1);
    HWND hWnd = pCStatic->m_hWnd;

    We're trying to get the handle of the PictureBox so we put a DirectX into the control. Many Thanks Tom

    C / C++ / MFC c++ graphics game-dev help

  • C++ Pointer Help [Solved]
    T Tom Moore

    Thanks, didn't realize that could be done.

    C / C++ / MFC c++ python performance help

  • C++ Pointer Help [Solved]
    T Tom Moore

    Tim Craig wrote:

    I really don't see the point in the standalone RobotSpeak function set. If you have an instance of Robot, say robot, why not just do: robot.Speak(); And if you have different types of robots saying different things, make Speak virtual and operate through base classes.

    I know, but the point of the question wasn't about the Robot speaking, I was asking about using dynamically created objects through references.

    C / C++ / MFC c++ python performance help

  • C++ Pointer Help [Solved]
    T Tom Moore

    Thanks, I'll be aware of that in the future. 'Bomb-proof', reminds me of the old Atari ST, whenever that crashed for whatever reason, it would print cherry bombs on the screen, we calling bombing out. That was early to mid 90's. Thanks Again. Tom

    C / C++ / MFC c++ python performance help

  • C++ Pointer Help [Solved]
    T Tom Moore

    If you refer to the object by reference, it cannot by deleted, which is a good thing. Where as if you did such as RobotSpeak(const Robot*& const robot). You could delete the object in the procedure, and if the calling program tried to do any thing to object, it would fail and leak memory or worse. Thanks Again ;P Tom

    C / C++ / MFC c++ python performance help

  • C++ Pointer Help [Solved]
    T Tom Moore

    Thanks for replying :) . Whats the difference between passing a object by derefencing a pointed object and using a using a Reference To Pointer, and a Pointer Argument, like RobotSpeak(Robot const & robot) and RobotSpeak(Robot const *& robot) and also RobotSpeak(Robot const ** robot). Tom

    C / C++ / MFC c++ python performance help

  • C++ Pointer Help [Solved]
    T Tom Moore

    Hi, its been a while since I've posted here :). I've come back to C++ after doing quite a lot of scripting in Python though Scripting is still a passion of mine but enough about scripting. I read an article about Memory Management in C++ the other day and some one wrote the code about borrowing a object through a reference even though it was created on the free store. I'm mixed up about the various syntaxes heres some examples of code im mixed up with. Robot.hpp

    #include <iostream>
    class Robot{
    public: void Speak(){std::cout << "Hello\n";}
    }

    main.cpp

    #include <iostream>
    #include "Robot.hpp"

    void RobotSpeak(Robot& robot); // Calls robot.Speak()
    void RobotSpeak2(Robot*& robot); // Calls robot->Speak()
    void RobotSpeak3(Robot** robot); // I imagine robot->Speak()
    void RobotSpeak4(Robot* robot); // I imagine robot->Speak() again

    int main(){ return 0; }

    When and how would you use RobotSpeak(Robot&) on a object created on the free store and when would you use the others. Many Thanks in Advance. Tom

    modified on Saturday, May 8, 2010 9:55 AM

    C / C++ / MFC c++ python performance help

  • Object Orientated Programming - Association,Composition and Aggregation (Multiple Languages)
    T Tom Moore

    Hi, I've been coding in .NET and Java and C++ for a few years now and I still haven't quite got my head round Association ,Aggregation and Composition. I know a the difference conceptually, eg. A Bank *has* branches (Aggregation), eg. A Child *has* a toy (Composition). The thing that confuses me, is when it comes to coding the relationship. I've looked at examples on the Web and it still confuses me. C# and Java

    public class Boy
    {
    public void PlayWith(Toy toy) {toy.play();} // is this Association?
    }

    public class Bank
    {
    // private BankBranch branch = new SydneyBranch(); is this Aggregation or Composition
    List branches = new List(2) {new SydneyRdBranch(); new ParisRdBranch(); } // is this Aggregation or composition?
    }

    Please could someone explain how to write Association, Aggregation and Composition in Code please. Many Thanks ;) ;) Tom

    Design and Architecture csharp c++ java tutorial question

  • Get rid of this programmer
    T Tom Moore

    I can't see anything wrong with that code. Attitudes like that stop people like me (Students from college) from becoming developers, because no-one wants a newbie. Catch 22. Tom

    The Weird and The Wonderful

  • Windows XP 64 Problems
    T Tom Moore

    Hi, I've just brought a new computer : AMD 64 3800 1GB RAM ASUS AM2 Motherboard Geforce 7800 GT Graphics Card 2 SATA Hard Drives DVDRW + CD Rom And Windows XP 64 Edition. The problems lies when I install Windows XP 64. It boots up into Windows, theres some activity then it freezes. You can't click on anything, only move the mouse cursor. Does anybody know why, or how to solve it? :( Am I proberly better off with Windows XP 32 Many thanks in advance Tom

    System Admin graphics tutorial question

  • 32 or 64 bit.
    T Tom Moore

    Hi, Thanks for the info. I've just brought a new computer with XP 64 bit. I'm just wondering what your experience of XP 64bit is like. How well, do 32 bit applications run on Win XP 64bit? I was a bit worried about the bug issue. But you've cleared that for me :) Thanks Tom

    Windows API design help question announcement

  • Coding Equals Operator
    T Tom Moore

    Thanks Nick, Much Appreciated. Its just that in C++ you would use the this statement and check against the type on the right. I was just wondering if ReferenceEquals and Equals use the same kind of technique deep down in the CLR thats all. But as for implementing it, you've hit the nail on the head. Many Thanks :laugh:

    C# csharp c++ graphics tutorial question

  • Coding Equals Operator
    T Tom Moore

    Hi, Im just wondering, how do you write the equals operator in C#. Im slightly confused about the syntax. For example in C++ for a vector : class vector{ private: float m_x; float m_y; float m_z; public: vector(x,y,z): m_x(x),m_y(y),m_z(z); vector(): m_x(0),m_y(0),m_z(0); ~vector(); bool operator==(Vector v) { if (this == v) return true; else return (m_x == v.m_x && v.m_y && v.m_z); } } I know its got something to do the Equals Function and Reference Equals Method. How do you test to see if its the same instance? Many Thanks in advance ;) Tom

    C# csharp c++ graphics tutorial question

  • File System Methods
    T Tom Moore

    DavidCrow wrote:

    So what exactly is the problem? Implementing the crosshair? Figuring out what is selected in a tree control? Setting the text of an edit control?

    The exact problem is implementing the drag and drop procedure so it works out of the current program, the cross hair needs a function that returns the window handle or control handle, so I can send a WM_PASTE message to the necessary control. Tom

    C / C++ / MFC c++ csharp help workspace

  • File System Methods
    T Tom Moore

    DavidCrow wrote:

    As soon as you start dragging from your tree control, are you sending a TVN_BEGINDRAG notification message?

    I don't think you understand! You don't drag from the tree view, you drag the crosshair like in Spy++ (See The Window Finder Article) They'd be a cross hair in the bottom of the screen, then when you drag the cross hair onto the window, eg. Textbox , it would copy and paste the file path from the tree view into the window control that you dragged the cross hair. Thanks Tom

    C / C++ / MFC c++ csharp help workspace

  • File System Methods
    T Tom Moore

    DavidCrow wrote:

    What does a URI have to do with GetLogicalDrives() or GetLogicalDriveString()? How does drag/drop relate to all of this? Please explain what it is that you are after.

    Ok, My app is supposed to display a tree view of the file system, you can then select the file you want. Then you drag a cross hair like in Spy++, to the window and it will copy the absolute path of the file to the location you dragged the crosshair to. I know that can be done without an app been written, but in some windows that don't support drag/drop operations, eg. Lan Connections Screen in Internet Options. Dragging the cross hair over the selected area will retreive the handle of the control and send a WM_PASTE message to that control and paste the file path into the selected window. :) Tom

    C / C++ / MFC c++ csharp help workspace

  • File System Methods
    T Tom Moore

    Hi, I'm trying to write a program that can copy a file URI into any window by drag and drop. The problem lies in C++, so far i've found only two methods: GetLogicalDrives and GetLogicalDriveString. In .NET there is this eqivalent: Environment.GetLogicalDrives and DriveInfo.GetDirectories. Im wondering if there is any eqivalent in Visual C++ Thanks Tom

    C / C++ / MFC c++ csharp help workspace

  • How to backup outlook express contacts and groups?
    T Tom Moore

    You're right. I am posting in the coding forums as well, because I'd like to do it anyway possible. Dell are sending a restoration disk over today, and my dads computer will have to be formatted meaning he'll lose everything in his address book. I could do it normally but he'd have to add the contacts back to the groups. Anyway possible as I said, scripting or non scripting. Tom

    The Lounge help tutorial question learning

  • How to backup outlook express contacts and groups?
    T Tom Moore

    Nishant Sivakumar wrote:

    See http://support.microsoft.com/kb/270670\[^\] Regards, Nish

    Thanks Nish, I have already seen that article by Microsoft, however it doesnt mention anything about backing up groups, my dad has groups of upto 60 people. As I said I have backed up his Address Book before, but when I did, it only had the contacts and he had to re-create the groups and add all the people to those groups which was a really big pain to him. Is there anyway of doing it but copying the groups. Thanks Tom

    The Lounge help tutorial question learning
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups