|
Please read this[^] before posting.
|
|
|
|
|
699 wrote: i want find a audio chat source
In other words are you searching for a 'somebody using microphone for speaking'?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hey Everyone. I have been having linking problem with visual studio. My Problem basically is I do not know how to set it up. What I have been doing is just making one ".hpp" file with multiple classes/preprocessors in it and separate ".cpp" files for the classes and a test file, but I have a strong suspicion this is not the way one is suppose to do this. Maybe I am just going about it wrong as well, here is the latest inheritance I have been working on and cannot seems to get working.
this files called: geo.hpp
#ifndef COORD_HPP
#define COORD_HPP
#include <iostream>
namespace Geo
{
class Coord
{
private:
int x;
int y;
public:
Coord() : x(0), y(0)
{
}
Coord(int newx, int newy) : x(newx), y(newy)
{
}
Coord operator + (const Coord&) const;
Coord operator - () const;
void operator += (const Coord&);
void printOn(std::ostream& strm) const;
};
inline Coord Coord::operator + (const Coord& p) const
{
return Coord(x+p.x, y+p.y);
}
inline Coord Coord::operator -() const
{
return Coord(-x, -y);
}
inline void Coord::printOn(std::ostream& strm) const
{
strm << '(' << x << ',' << y << ')';
}
inline std::ostream& operator << (std::ostream& strm, const Coord& p)
{
p.printOn(strm);
return strm;
}
}
#endif //COORD_HPP
#ifndef GEOOBJ_HPP
#define GEOOBJ_HPP
#include "geo.hpp"
namespace Geo
{
class GeoObj
{
protected:
Coord refpoint;
GeoObj(const Coord& p) : refpoint(p)
{
}
public:
virtual void move(const Coord& offset)
{
refpoint += offset;
}
virtual void draw() const = 0;
virtual ~GeoObj()
{
}
};
}
#endif //GEOOBJ_HPP
#ifndef CIRCLE_HPP
#define CIRCLE_HPP
#include <iostream>
#include "geo.hpp"
namespace Geo
{
class Circle : public GeoObj
{
protected:
unsigned radius;
public:
Circle(const Coord& m, unsigned r)
: GeoObj (m), radius(r)
{
}
virtual void draw() const;
virtual ~Circle()
{
}
};
inline void Circle::draw() const
{
std::cout << "Circle around center point " << refpoint << " with radius " << radius << std::endl;
}
}
#endif //end CIRCLE_HPP
#ifndef LINE_HPP
#define LINE_HPP
#include <iostream>
#include "geo.hpp"
namespace Geo
{
class Line : public GeoObj
{
protected:
Coord p2;
public:
Line(const Coord& a, const Coord& b)
:GeoObj(a), p2(b)
{
}
virtual void draw() const;
virtual void move(const Coord&);
virtual ~Line()
{
}
};
inline void Line::move(const Coord& offset)
{
refpoint += offset;
p2 += offset;
}
}
#endif //LINE_HPP
and a simple test file.
this file is called :test.cpp
#include "geo.hpp"
void printGeoObj(const Geo::GeoObj&);
int main()
{
Geo::Line l1(Geo::Coord(1,2), Geo::Coord(3,4));
}
So i hope someone can help me arrage these files properly with visual studio 9 c++, or help me figure out what I am doing wrong
Thanks alot!
|
|
|
|
|
You need to create a project and put your files in it. Start with File->New->Project. This will bring a wizard where you can select any different types of project. Of cause, you may start with an 'empty' project where you will require to include all the files, as well as to set compile and link options, or you may start with a pre-defined project of your choice. I reckon, Win32 Console Application will be a good start.
After you've created a project you may start adding hpp and cpp files into it.
|
|
|
|
|
I am aware on how to make a project. I am however having a LNK2019 problem when I make separate .hpp files. The Error I am getting is:
4>geotest1.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Geo::Line::draw(void)const " (?draw@Line@Geo@@UBEXXZ)
4>geotest1.obj : error LNK2019: unresolved external symbol "public: void __thiscall Geo::Coord::operator+=(class Geo::Coord const &)" (??YCoord@Geo@@QAEXABV01@@Z) referenced in function "public: virtual void __thiscall Geo::GeoObj::move(class Geo::Coord const &)" (?move@GeoObj@Geo@@UAEXABVCoord@2@@Z)
4>C:\Users\Rob\School Work\Information Technology\Computer Programming With C++\Projects\inherit_1\Debug\inherit_4.exe : fatal error LNK1120: 2 unresolved externals
Would You be able To help me figure this out?
EDIT: I am creating a empty project by the way.
Thanks,
RobNO
|
|
|
|
|
I actually realized I had actually not implemented operator += in coord.hpp and also not implemented Line::Draw() in line.hpp.
Thanks for all you time,
RobNO 
|
|
|
|
|
Hello
I am a beginner in c(win32 console). I want to define arrow keys in c in order to a character travels up, down, left and right.
PLEASE EXPLAIN AS COMPLETE AS POSSIBLE...
thanks all
|
|
|
|
|
See my answer to your other question.
It's time for a new signature.
|
|
|
|
|
hasani2007 wrote: I want to define arrow keys in c in order to a character travels up, down, left and right.
I could easily give you the numbers, but it would be of more benefit to you to create a little test program that uses getch() to get those keys (and others) and print their values to the screen. You can then use those values in your program.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
How to define arrow keys in c.
1. Define keys.
2. Put kbhit() in a function.
3. Create a loop.
4. Thats it.
Step 1.
#define UP 72
#define DOWN 80
#define LEFT 75
#define RIGHT 77
Step 2.
void pumpKeyboardMessages(void)
{
if (kbhit())
{
ch=getch();
}
}
Step 3.
while (ch!=ESCAPE)
{
pumpKeyboardMessages( );
}
Step 4.
Here's an example of usage:
#include <conio.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#define UP 72
#define DOWN 80
#define LEFT 75
#define RIGHT 77
#define SPACE 32
#define ENTER 13
#define ESCAPE 27
#define TAB 9
#define INSERT 82
#define F1 59
void pumpKeyboardMessages(void)
{
if (kbhit())
{
ch=getch();
switch (ch)
{
case LEFT:
break;
case RIGHT:
break;
case UP:
break;
case DOWN:
break;
case ENTER:
break;
case SPACE:
break;
case F1:
break;
case TAB:
break;
}
}
}
int main(void)
{
getReady();
initGame();
bas=time(0)+1;
while (ch!=ESCAPE)
{
pumpKeyboardMessages( );
}
return 0;
}
Also check out my articles about console applications.
How to create a Win32 Console Mode breakout brick game
How to create a Win32 Console Mode breakout brick game
How to create an object oriented Win32 Console application
How to create an object oriented Win32 Console application
How to handle mouse events in a Win32 Console in C++ with Random Joke Generator
How to handle mouse events in a Win32 Console in C++ with Random Joke Generator
|
|
|
|
|
Hi all friends;
I am a beginner in c(win32 console). I want to change the colour of characters & background in c. How to do it?
PLEASE EXPLAIN AS COMPLETE AS POSSIBLE...
Thanks all.
|
|
|
|
|
hasani2007 wrote: PLEASE EXPLAIN AS COMPLETE AS POSSIBLE...
1. Read the guidelines[^] before posting a question.
2. Do not use capitals to emphasise, it is considered bad manners.
3. Do not make demands for full explanations/code. People will give what they can without being prompted.
4. Learn to use Google, Bing and MSDN to do your own research first.
This link[^] has some suggestions to get what you want.
It's time for a new signature.
|
|
|
|
|
hasani2007 wrote: I want to change the colour of characters & background in c.
Check out SetConsoleTextAttribute() .
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
What about documentation: "Using Console (Windows)"?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hello all;
I'm a beginner in c. I should program a game(it's maze).
So I am dealing with this problem that can't get the walls from input.
because user should be able to put the walls by using an array.
Apologise me because bad English writing.
|
|
|
|
|
 For example, this code generates a random maze. Its a console application
#include <iostream.h>
#include <conio.h>
#include <time.h>
#include <stdlib.h>
int main()
{
system("color 1F");
int rows,columns,r,k;
int center,c;
int random_it;
char someCharacter;
char lgt1='\xB3';
char lgt3='\xBF';
char lgt10='\xD9';
srand(time(0));
cout<<"Maze generator ver 0.000000000001 beta \n\n";
cout<<"Input columns (x) > ";
cin>>columns;
cout<<"Input rows (y) > ";
cin>>rows;
center=38-(columns/2);
cout<<'\n';
for (r=0;r<rows;r++)
{
for (c=0;c<center;c++) cout<<" ";
for(k=0;k<columns;k++)
{
random_it=rand() % 20;
if (random_it==0) someCharacter=random_it+lgt1;
if (random_it==1) someCharacter=random_it+lgt1;
if (random_it==2) someCharacter=random_it+lgt3-2;
if (random_it==3) someCharacter=random_it+lgt3-2;
if (random_it==4) someCharacter=random_it+lgt3-2;
if (random_it==5) someCharacter=random_it+lgt3-2;
if (random_it==6) someCharacter=random_it+lgt3-2;
if (random_it==7) someCharacter=random_it+lgt3-2;
if (random_it==8) someCharacter=random_it+lgt3-2;
if (random_it==9) someCharacter=random_it+lgt10-9;
if (random_it==10) someCharacter=random_it+lgt10-9;
if (random_it>10) someCharacter='\x20';
cout<<(char)someCharacter;
}
cout<<"\n";
}
cout<<"\n";
return 0;
}
...
|
|
|
|
|
First, I am writing everything in C using Visual C++ 6.0
Second, I have created a dialog box that contains an edit box located inside a dialog box and I cannot seem to find a way to change the font size of the edit (text) box. It's basically a user id window, but it's defaulting to a small font.
I can set the text inside of the box just fine:
SetWindowText ( GetDlgItem ( window, IDC_ID_WINDOW ), (char)current_id_string_g ) ;
but the font is small =(
any ideas of how to change the font size of a particular edit box?
Thanks
|
|
|
|
|
pjdriverdude wrote: any ideas of how to change the font size of a particular edit box?
Send it a WM_SETFONT message, perhaps?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Huzzah! You led me down the right path. Here's the code to changes an edit box font (at least, this works fine for me).
HFONT hFont ;
HWND x = GetDlgItem(window, IDC_ID_WINDOW) ;
HDC hdc = GetDC ( x ) ;
hFont = CreateFont(48,0,0,0,FW_NORMAL,FALSE,FALSE,FALSE,DEFAULT_CHARSET,OUT_OUTLINE_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY, VARIABLE_PITCH,TEXT("Impact"));
SelectObject(hdc, hFont);
SendMessage( x, WM_SETFONT, (WPARAM) hFont, MAKELPARAM(0, 0) );
(void) UpdateWindow(window) ;
|
|
|
|
|
I an handling the CTLCOLOR_EDIT message in the OnCtlColor() to change the background color of Edit Box.But I am having two edit boxes IDC_EDIT1 and IDC_EDIT2.I want edit1 to be blue and edit2 to be red. How I will know the source of the CTLCOLOR_EDIT message?
|
|
|
|
|
chikach wrote: How I will know the source of the CTLCOLOR_EDIT message?
The second parameter.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
thank you 
|
|
|
|
|
Hi ,
I need to insert PNG image in MFC dialog . I tried with picture box not helpful , as you know BMP can be achieved , but PNG I am difficulty to insert . Googled , not able to screw it . Kindly give your suggestion .
Thanks,
Tam
www.tamilselvan.zoomshare.com
|
|
|
|
|
Maybe some the the replies in this[^] thread will help.
|
|
|
|
|
hi,
below is the code , picture is not getting displayed .
CPic::CPic(CWnd* pParent /*=NULL*/)
: CDialog(CPic::IDD, pParent)
{
/*CString csfilename;
csfilename.Format("C:\\warningIcon.png");*/
image.Load(_T("C:\\warningIcon"));
}
CPic::~CPic()
{
}
void CPic::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
void CPic::OnPaint()
{
image.Load(_T("C:\\warningIcon"));
/*PAINTSTRUCT ps;
CDC * drawDC = BeginPaint(&ps);
CRect rcClient;
GetClientRect(&rcClient);
image_.TransparentBlt(*drawDC, rcClient, CRect(0, 0, image_.GetWidth(), image_.GetHeight()), image_.GetPixel(0, 0));
EndPaint(&ps);*/
}
www.tamilselvan.zoomshare.com
|
|
|
|