Creating WinAPI windows and controls can be a pain and quite difficult/annoying at times. Most of the time, I find myself searching MSDN, DaniWeb, and StackOverflow. I hate having to use external libraries unless I absolutely have no other choice. Below contains code for creating WinAPI windows, Controls, Sub-Classing, and EventHandling for each control. There is a sample working code below this article and an image of what the sample code produces. There are only 4 files to include to your projects: Form.hpp -- Form.cpp Controls.hpp -- Controls.cpp The code for these files are as follows: Form.hpp: #ifndef FORM_HPP_INCLUDED #define …

Member Avatar
Member Avatar
+0 forum 5

# Introduction # The subject of this tutorial is a bit more advanced than the subjects I have tackled in the past, but I hope this will find some interested readers. From time to time in C++, programmers find themselves torn apart between using a *Generic Programming* style which primarily involves the use of templates and compile-time mechanisms (e.g., STL), and using a *Object-Oriented Programming* style that often favors inheritance and run-time dispatching mechanisms (e.g., Qt). As it is so often the case, there is no obvious "winner", i.e., there is no paradigm that should always be preferred, even within …

Member Avatar
+2 forum 0

I'm afraid to ask this on SO because all I can get is down-vote so I ask it here.* ## **Question:** ## Does C/C++ compiler (e.g the popular "gcc") with OO concepts allocates/creates all data member if other data member are not in use? /************************************* * code for example: * ************************************** typedef std::size_t Int; class Rectangle { public: Int x; Int y; Int width; Int height; Int border_top; Int border_right; Int border_bottom; Int border_left; } //suppose I instantiate many of this class then call "some" data members Rectangle rect1, rect2, ...; rect1.x = 0; rect1.y = 0; //rect1.other_member arent called …

Member Avatar
Member Avatar
+0 forum 12

Hi everyone. I am doing a USACO training assignment, and the instructions are as follows: > Is Friday the 13th really an unusual event? > > That is, does the 13th of the month land on a Friday less often than on any other day of the week? To answer this question, write a program that will compute the frequency that the 13th of each month lands on Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, and Saturday over a given period of N years. The time period to test will be from January 1, 1900 to December 31, 1900+N-1 for a …

Member Avatar
Member Avatar
+0 forum 3

I want the program to compare what the user puts in and then compare that string to something in an array and see if it is a match. Here is code for things already put into array [CODE]private static void createExistingUserData(Scientist[] scientist){ scientist[0] = new Scientist("user1", "password1"); scientist[0].setDob("02/02/1995"); scientist[0].setSsn("612-45-7070"); scientist[0].setApplicantName("Peter Lee"); scientist[0].setInstituteName("George Washington University"); scientist[0].setDepartmentName("Information System Department"); scientist[0].setPositionRank(1); scientist[0].setResearchTopic("Software Engineering"); scientist[0].setPastFunding(250000); scientist[0].setNumOfPaper(30); }[/CODE] Here is code that i have right now for checking. [CODE]do{ ssn = JOptionPane.showInputDialog(null,"Please enter your social security number (xxx-xx-xxxx): ", "Lab 4", JOptionPane.QUESTION_MESSAGE); }while(!scientist[index].setSsn(ssn)); for (int i = 0; i < scientist.length; i++) if (ssn.equals(scientist[i])){ System.out.print("This …

Member Avatar
Member Avatar
+0 forum 9

Hi, experts: I am very to c++, and here is a program that should: • create a Customer object– (although you will only be using one constructor here, be sure and test all three) • Display the Customer’s info using the ‘get’ functions • Ask the user how many months will be simulated • For each of N months (the number of months the user desired): Ask the user to provide all purchase amounts for the customer Ask the user to provide a payment for the customer Output the current balance for the customer Display the Customer’s info using the …

Member Avatar
Member Avatar
+0 forum 2

[CODE=java]import java.util.Scanner; class Sum { private int value; public int get() { return value; } public void set(int sum) { this.value = sum; } } class Summation extends Thread { private int upper; private int lower; private Sum sumValue; public Summation(int upper, Sum sumValue) { if (upper < 0) throw new IllegalArgumentException(); this.upper = upper; this.sumValue = sumValue; } public void run() { int sum = 0; for (int i = 1; i >= lower && i <= upper; i++) sum += i; System.out.println(this.getName() + " is done"); sumValue.set(sum); System.out.println(this.getName() + " " + sum); } } public class MultithreadSum …

Member Avatar
+0 forum 0

hey guys so I'm studying a unit called Object Oriented Analysis its not one of my strongest units so i need some help in the concept of understanding UML and i have a exam coming up and i was if you guys could help me understand the basic concepts here are some outcomes: • Test your understanding of important terminologies, concepts in Object Orientation • Test you analysis skill based on your experience sample questions: Sample of Long Answer Questions Q1. Identify at least FOUR Actors for the given problem statement, including one Non-Human Actor. Identify FOUR use cases corresponding …

Member Avatar
Member Avatar
+0 forum 1

Hi! I have a question regarding a problem I've faced dealing with object oriented PHP. I'm used to always return a value after a method has been executed and then use the returned value in other methods. But that's because I've always done that in procedural programming. So I wonder if it's normal practice to instead use the properties of the class and use [B]$this[/B] to retrieve those values in the different methods instead of passing them as parameters? What is best and how should I do? code example. This: [CODE] class example { function __construct($param){ $result = $this->foo($param); $result2 …

Member Avatar
Member Avatar
+0 forum 2

I've read tutorial on tutorial and I try to work with Object Oriented PHP but the thing is that I find it rather complex. When I create a class I must include it in the current working document. It doesn't work as in Java when the compiler finds the script in the same folder anyway. And when I always must include that class in different directories it gets really inefficient. Is there a way to achieve what I'm looking for? Or have I completely misunderstood the concept in PHP? Today I have a script which automatically fixes the correct directory …

Member Avatar
Member Avatar
+1 forum 6

I am in a distributed education programming class, our most recent assignment has me stumped with a error that is driving me insane. The IDE I have on my personal computer is missing some of the libraries I need(I believe), and when I remote desktop to my school's computer and use the IDE there the error code I receive is that there is a memory exception at line: 71 The assignment is to stimulate a race track using Object oriented programing, the area I believe I am having problems with is when I attempt to make an array of Horse …

Member Avatar
Member Avatar
+0 forum 3

I'm an amateur web developer trying to move toward more professional coding practices, and I'm making my first site that makes extensive use of ajax. I've used the xmlHttpRequest object on a few occasions, for which simply creating functions as I needed them were adequate. But the site I am building now will require dozens or more of asynchronous requests, and each will require different instructions on how to process the returned data. I have been beating my head against the wall trying to figure out how to model this. This is what I have so far: [code=javascript] //I want …

Member Avatar
Member Avatar
+0 forum 1

There is a working code about a program in which you should create differen Cat objects with name and color parameter and apply method to the objects. The problem is that I get the method working for only the last cat [CODE]public class Cats { public static String name; public static String color; public Cats(String firstname, String bodycolor) { name = firstname; color = bodycolor; } public void SayMiau(){ System.out.printf("Cat %s which is %s in color said miauuuu!%n", name , color); } public static void main(String [] args) { Cats Number[] = new Cats[6]; Number[0] = new Cats("Juja","orange"); Number[1] = …

Member Avatar
Member Avatar
+0 forum 1

Hi, i'm not very good at OOP, basically just started it. My program basically its like a system for a game shop, the main isn't fully done yet, however main isn't a problem. The other files must contain some kind of problem in them. Well enough of the talk, I'll show the code and hope someone from you, the proper programmers comparying to me. The thing is that I keep getting this error and not knowing how to fix it. \string.h:24, from game.cpp /string.h:24, from game.cpp \stddef.h extraneous `int' ignored \stddef.h long, short, signed or unsigned invalid for `size_t' \Makefile.win …

Member Avatar
Member Avatar
+0 forum 5

This is a friend operator overload function that used addition. It adds two mix fraction by reducing them to simplest form the adding and converting them back to a mixed number [CODE]Mixed operator+(const Mixed& f1, const Mixed& f2) { int newnum, newnum2, gcd, tmpNumerator2, tmpNumerator, tmpInteger, tmpInteger2; Mixed r; tmpNumerator = f1.numerator; tmpNumerator2 = f2.numerator; tmpInteger = f1.integer; tmpInteger2 = f2.integer; if(tmpInteger < 0) tmpNumerator *= -1; if(tmpInteger2 < 0) tmpNumerator2 *= -1; newnum = (f1.integer * f1.denominator) + tmpNumerator; newnum2 = (f2.integer * f2.denominator) + tmpNumerator2; r.numerator = (newnum * f2.denominator)+ (newnum2 * f1.denominator); r.denominator = f1.denominator * f2.denominator; …

Member Avatar
Member Avatar
+0 forum 3

So I've been working on this program for a while, I'm finally finish but I have two error that I can not understand why. My first error is when I am declaring the header f [CODE] //------------------- Mixed.cpp -------------- #include <iostream> #include "mixed.h" using namespace std;[/CODE]ile> it keep sending me an error message error C2143: syntax error : missing ';' before 'using' I feel like this is a real simple mistake but I can not figure out what I am doing wrong? There isn't suppose to be a ; before using my next error is about operator overloading I wrote …

Member Avatar
Member Avatar
+0 forum 3

Hallo! I've been having some trouble getting a save/load function to work properly. I'm trying to save object and their properties to a file in binary using fstream. And then being able to load the object from the binary file the next time im running my project. Quick breakdown: I got this class CMapMgr which holds a vector of CMap instances, and each CMap instance holds a vector with CTile instances. So when everything is initiated and running, and when i run this code, how much is saved? [CODE] // mFile is of fstream type and is a private member. …

Member Avatar
Member Avatar
+0 forum 5

Hi all, I've finally gotten a handle on object-oriented programming (it took ages), and I really like it. But I'm still struggling with conceptualizing some things. For example, if I want to make a form using objects, do I make a Form class with a method like startFORM($name_of_action_page, $method), then another method like inputBox($name_of_box), etc. until I get to closeFORM(). Lets say I do it this way, then if I want to put the form in a table to straight things out, do I place the methods in between the html tags <td></td>. If I do that, where do I …

Member Avatar
Member Avatar
+0 forum 6

The End.