|
i want to know that how to hide the application from appplication list when we press the Ctrl+alt+delete. i want to do this in the visual c6.
ddd
|
|
|
|
|
|
i want to compile this code :
<br />
template <class T> <br />
inline const T& max ( const T& a, const T& b) <br />
{ <br />
return a < b ? b : a ; <br />
<br />
<br />
}<br />
got this error message :
: error C2226: syntax error : unexpected type 'T'
: error C2062: type 'const int' unexpected
: error C2059: syntax error : ')'
: error C2143: syntax error : missing ';' before '{'
: error C2447: '{' : missing function header (old-style formal list?)
but it's successfully compiled on BCB6.0 .
VC7.1 is just stupid???
|
|
|
|
|
Teerayoot wrote:
template
inline const T& max ( const T& a, const T& b)
{
return a < b ? b : a ;
}
put above code in header file !
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
try using as
template<typename T><br />
inline const T& getMax ( const T& a, const T& b) <br />
{ <br />
return a < b ? b : a ; <br />
}
The problem is with the name of the function. I have renamed it from "max" to "getMax" because macros with the name "min" and "max" already exist in stdlib.h, and same name of the function as those macros caused the errors.
Rahim Rattani
Software Engineer,
Matrix Systems (Pvt) Ltd.,
Karachi - Pakistan
|
|
|
|
|
Error message make me very confuse.
it should say
"name of the function max alredy exist in standard library!"
or somethings that can make sense.
Thank you.
|
|
|
|
|
Hi,
i know that i can set each of the incoming parameters of my function to a default value, like this:
void Function(int x , int y = 10);
and then,i can call to the function in 2 ways:
Function(10,20);
Function(10);
my question is - how can i set a CString object to empty by default?
for example:
void Function(int x , CString string = ???????);
and call that function:
Function(10,"Not an empty string");
Function(10);
anyone????????
Regards,
Eli
|
|
|
|
|
As smple as u set the integer values.
void Function( int x , CString string = "" );
Rahim Rattani
Software Engineer,
Matrix Systems (Pvt) Ltd.,
Karachi - Pakistan
|
|
|
|
|
eli15021979 wrote:
my question is - how can i set a CString object to empty by default?
for example:
void Function(int x , CString string = ???????);
and call that function:
Function(10,"Not an empty string"); // x = 10 , string = "Not an empty string"
why don't you do the same as you code with integers...?
<font color=blue>void</font> Function(<font color=blue>int</font> x , CString string = <font color=gray>""</font>); Then you call it the way you like...
Function(10, <font color=gray>"Hello CP"</font>); <font color=green>
Function(10); <font color=green>
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Also, you need to decide if the function accepting the CString really REQUIRES a CString object.
Maybe you can get by with a LPCTSTR instead.
Then you can write your function:
void Function(int x , LPCTSTR szString = NULL);
and call that function:
Function(10, "Not an empty string");
Function(10);
You can get really tweaked after awhile working with code all written to accept a CString by value, and then when you examine the function's use of the string, it could have easily sufficed to send it a string constant instead.
|
|
|
|
|
Is there any Group Calender control available (preferably as a MFC Control)?
(Commercial or Non - Commercial)
Something like http://www.officeclip.com/web/calendar/tour3.html
and the OfficeClip Group Calendar - Invite Attendees - Picture (the one down the site).
I should see the appointments of a group of people and (ideally) someone should be able to dynamically drag an appointment and move it to another date / time.
Any help appreciated.
All the label says is that this stuff contains chemicals "... known to the State of California to cause cancer in rats and low-income test subjects." Roger Wright http://www.codeproject.com/lounge.asp?select=965687&exp=5&fr=1#xx965687xx
|
|
|
|
|
Hi
I am trying to set a region for buttons. here is code:
CRect the_rect;
m_SearchBtn->GetClientRect(the_rect);
HRGN region_handle = CreateEllipticRgnIndirect(the_rect);
int nRet=m_SearchBtn->SetWindowRgn(region_handle,TRUE);
nRet value is always non-zero. But still the button shape won't change. Could anyone tell me what is wrong?
Regards
|
|
|
|
|
Do NOT conflit refrence and value!
In MSDN --> void GetClientRect( LPRECT lpRect ) const;
So use m_SearchBtn->GetClientRect(&the_rect);
HRGN region_handle = CreateEllipticRgnIndirect(&the_rect);
....
|
|
|
|
|
It won't work even with reference.
|
|
|
|
|
First Set the Style of Button to Owner Draw!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
If I enable OWNERDRAW, button is not been visible. Otherwise it displays in a default rectangle shape.
|
|
|
|
|
|
SelectClipRgn(..) didn't help........
|
|
|
|
|
After Setting Owner Draw Style, You have to use [CButton::DrawItem]to draw button.
Or take a look at button wrapper classes here at CP
[Link]
http://www.codeproject.com/buttonctrl/[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
I don't want to owner draw the button. I just need to change the shape of it. Any other solution?
|
|
|
|
|
I Belive I have to make one for you. Wait for hour,I will send you demo application!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
|
Behzad Ebrahimi wrote:
Do NOT conflit refrence and value!
In MSDN --> void GetClientRect( LPRECT lpRect ) const;
So use m_SearchBtn->GetClientRect(&the_rect);
HRGN region_handle = CreateEllipticRgnIndirect(&the_rect);
CRect has an operator that returns an LPRECT or LPCRECT, so his code was perfectly valid.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Thanks Ryan. You are right.
I always use refrence tag to take my code more readable.
|
|
|
|
|
I write the folowing code which is taking RAM and Hard disk capacity from user by using structures and than saving it to a new file after the user complete entring data it is displaying data entered by the user by opening that file. Problm is that i want to ask the user to choose an option (y/n): If user enter y then your program again get the next record of computer specification i.e RAM capacity and hard disk capacity and store the information in file. And when the user enter n it will stop getting information and display the data of the file. For this i use do while construct but it is not working properly it is getting data but displays only last entry. plz tell me wat should i do.
the code is:
#include <conio.h>
#include <iostream.h>
#include <fstream.h>
struct computerspec
{
int ram;
int hdisk;
}compuspec;
void main()
{
char ch;
do
{
//prompt the user to enter RAM capacity
cout<<"Enter the RAM capacity"<<endl;
cin>>compuspec.ram;
cout<<endl;
prompt="" the="" user="" to="" enter="" hard="" disk="" capacity
cout<<"enter="" capacity"<<endl;
cin="">>compuspec.hdisk;
cout<
|
|
|
|