|
George2 wrote:
I do not understand...
Neither do i. The call has right value so the conversion appears to be useless since there's no variable to receive it.
rechi
|
|
|
|
|
Hi, Bogdan pal!
The return type of new operator is void*, so
I think we should use
--------
(void*) ...
--------
other than
--------
(void) ...
--------
Since void* is a C++ data type and void is not a C++ data type. What is your opinion?
Thanks in advance,
George
|
|
|
|
|
Perhaps it's to get it rid of a compile warning. Leave it out and see if there is one.
|
|
|
|
|
Thanks, Anonymous buddies.
I have tried and you are right. Can you tell
me why?
George
|
|
|
|
|
I am implementing a skin based tool kit.
When repainting the frame of a window,
i catch WM_NCPAINT message then get window's
device context :
case WM_NCPAINT:
{
HDC hdc = NULL;
if( wparam==1 )
hdc = GetWindowDC( hwnd );
else
hdc = GetDCEx( hwnd, (HRGN)(wparam), DCX_WINDOW|DCX_INTERSECTRGN );
paintFrame( hdc );
ReleaseDC( hwnd, hdc );
}
The 'GetDCEx line' is taken from MSDN.
I use MSVC++7 under winXP
Thanks for your help
|
|
|
|
|
REQUIREMENT:: Application shud be sized to full monitor irrespective of the monitor size and current system resolution.
My APPLICATION:: Application is having four formviews in tabcontrol with many controls(AcitveX Lables and Buttons) on each forma view. My application is developed for best view in 15 inch and 800*600 resolution.
MY PROBLEM: i have written code to catch when resolution ic changed.and accorind to the new resolution m changing the each contols's client rect and moving the corresponding control to new client react. but reafreshing si becoming problem and some controls are painting over other controls.
Adi Narayana
|
|
|
|
|
Hi All,
I'm currently a firmware engineering and trying to get into software programming (using C++ for right now). I've decided to create a simple text editor as my first project.
Does anybody know any good references out there on this topic in particular and Windows programming in general?
Any suggestion on better projects for beginners?
Thanks y'all
Dody
|
|
|
|
|
onezerocode wrote:
I'm currently a firmware engineer
Snap! I moved from firmware to software too, so I thought I would answer your question. I'm still a novice really so others may have something more usefull to say.
I started with the book 'SAMS Teach Yourself Visual C++' and I found it very poor, it didn't expain much just took you through some examples (very briefly).
Next I got the book 'Practical Visual C++' by Bates & Tompkins, this was much better, it assumes that you know very little and explains a fair ammount.
Lastly, I am currently reading 'Programming Windows with MFC' by Jeff Prosise, this is an excelent book it talks alot about what is actually going on - I like that, coming from a firmware/hardware background I want to know what is 'under the hood', but you need to understand C++ first as it does not explain this.
Hope that helps, good luck ,
Ali
|
|
|
|
|
Programming MFC (written by Jeff Prosise) is a good reference.
A. Riazi
|
|
|
|
|
Looking for a good C++ reference book ??? "Thinking in C++" rocks, take a look at http://www.mindview.net/Books/TICPP/ThinkingInCPP2e.html.
Also, for M$ Development, MSDN provide exelent references e documentation.
Hope it Helps !!!
?
|
|
|
|
|
|
How to create a toolbar of more than one row in which bitmap is used to create buttons?
|
|
|
|
|
Try CreateToolbarEx.
Dody
|
|
|
|
|
hey my sdi ap starts off by mimising itself and i can't see why (i even so a showwindow sw_maximixed in by view's oninitialupdate)
anyone got any thoguhts?
Cheerypip
Bryce
|
|
|
|
|
I am no expert, but I belive that you would need to overide the showwindow function in your MainFrame class.. not the views..
|
|
|
|
|
hey get the Mainframe pointer in InitInstance() of AppClass and do as follow
pMainFrame->ShowWindow(m_nCmdShow|SW_SHOWMAXIMIZED);
it shud work now
nice time
Adi narayana
|
|
|
|
|
duuuh of course *feels like a plonker*
cheers for that
Bryce
|
|
|
|
|
Hello. This is a general C++ question. Can somebody please shed some light on the const modifier? I have been programming for about a year.. and I never use const because I really don't understand it... so I am trying to gain some ground, and I just can't understand this.
Please look at the class declaration below, and can somebody explain to me why the functions draw(), and getx() allow me to modify the private data members. they are declared const, so they shouldn't allow me to modify those variables.. but they do.
according to MSDN help library, you declare a member function const by placing the keyword after the parameter list.. this is what I did.. but it still lets me modify them.
I know if I declare the variables const it will work.. but shouldn't I be able to declare a function const so the compiler won't let me modify?
class cRectangle
{
public:
// constructors
cRectangle();
cRectangle(int nL, int nW);
// Destructor
~cRectangle();
// public accesors
void SetLength(int nL);
void SetWidth(int nW);
int GetLength() const { return *nLength;}
int GetWidth() const { return *nWidth;}
// public methods
void Draw() const;
private:
// Data Members
int* nLength; // pointers because they will be stored on the heap
int* nWidth;
};
// implementation file
// striped but draw() function
// Drawing functions
void cRectangle::Draw() const
{
// try and change a variable
*nWidth = 42; // why its this allowed????
// function is const? should not let me change
// the object.
}
If anybody could explain this to me. It would be greatly appreciated. Thank you.
|
|
|
|
|
because nWidth is a pointer to an int, not an int. your Draw code is changing the value that nWidth points to, not nWidth itself. and it will probably give you an access violation, since nWidth isn't initialized.
if you change the Draw code to "nWidth = 42", it will not compile.
-c
A | B - it's not a choice.
|
|
|
|
|
Damn - looks like you can type faster than me.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
It'd probably be fairly easy to make a bot that'd post random stupid VB questions, and nobody would probably ever notice - benjymous - 21-Jan-2003
|
|
|
|
|
i even made a quick project to test it out, just to be sure!
-c
A | B - it's not a choice.
|
|
|
|
|
You're a machine, I stand in awe.... All I did was type.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
It'd probably be fairly easy to make a bot that'd post random stupid VB questions, and nobody would probably ever notice - benjymous - 21-Jan-2003
|
|
|
|
|
You're not changing nWidth, you're changing the value stored in it. Why is nWidth a pointer ? When your function returns, it will still point to the same place.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
It'd probably be fairly easy to make a bot that'd post random stupid VB questions, and nobody would probably ever notice - benjymous - 21-Jan-2003
|
|
|
|
|
ok. I understand kind of.. even if a function is constant, it can still modify what a pointer points to.
|
|
|
|
|
MAybe this will help - if you create a pointer you can do this:
const int * p_i,
or this:
int * const p_i
the second syntax makes the value const, the first the memory address. A const function only enforces the first idea.
const int * const p_i is also valid syntax for both.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
It'd probably be fairly easy to make a bot that'd post random stupid VB questions, and nobody would probably ever notice - benjymous - 21-Jan-2003
|
|
|
|