|
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<
|
|
|
|
|
The problem in your code is that u are writing the file after the do while loop, and therefore if u write the file after the do-while construct it would write the last values. Write the values to the file in the do-while loop. After every time you obtain the values from the user write it to the file and then ask for the y/n thing.
I mean just before this
cout<
|
|
|
|
|
How can I convert a int to a char??
|
|
|
|
|
|
How? can you show me an exemple?
|
|
|
|
|
Larsson wrote:
How can I convert a int to a char??
Do u inquring about char *
[itoa]
if char:simple casting will help!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
|
[code]
int nNum=10;<br />
char szNum[5];<br />
<br />
itoa(nNum,szNum,10);
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
|
TCHAR szBuffer[16];
INT iValue = 5;
::wsprintf (szBuffer, TEXT("%d"), iValue);
|
|
|
|