|
Hello,
Yes, i am deleting all GDi resources in desctroctor
I found where the problem is, the creation of those CBrushs cannt be in OnDraw Method, because OnResize method, it will create again the bruths
thanks
|
|
|
|
|
FWIW, you can simplify your code and reduce the chance of leaks
something like this:
void CMyChessView::OnDraw(CDC* pDC)
{
CBrush white(RGB(255,255,255));
CBrush black(RGB(0,0,0));
CMyChessDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
for (int i=1;i<=8;i++)
for (int j=1;j<=8;j++)
{
pDC->Rectangle((i-1)*56,(j-1)*56,i*56,j*56);
}
} mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks Mark for trying to help me;)
|
|
|
|
|
Hello anyone and everone
I'm looking for a great website to learn C++
i"m a newbe at it and can barely make any sence of C++ code
I would like to programm games so any info in that diretion would be great
thanks for any advice.
|
|
|
|
|
|
|
hello!
How can i create a shortcut to a file on-the-run ?
If I could specify the folder where to create it, it would be great!
Thanks!
Shpid3r
|
|
|
|
|
|
uu... i`m really impressed! That article (on codeproject.com) answered all my questions!
Many thanks!
Shpid3r
|
|
|
|
|
Hello
I need to write a DLL for some functions that I have which depend on a separate lib file.
when i write a short test program that uses the functions as is and link against the lib file, everything works great. But when i take the same functions and put them in a DLL, it doesn't work (i get some unresolved references to any function that I use from the lib file).
Am i supposed to do anything special to get it to recognize the functions from the lib?
thanks for your time.
|
|
|
|
|
effectively, there are some things to get done for a DLL to work properly.
you should start by reading this[^] article...
|
|
|
|
|
yeah i already know that bit
when i have regular functions that don't depend on the library (the one that I didn't write) the dll builds just fine
it's when i use the library's functions in my dll that i get the linking errors.
|
|
|
|
|
You haven't specified what type of DLL you're using or how you are linking
and/or binding to the DLL at runtime so it's difficult to give a specific answer.
I do know you will find links to a solution here[^]
If I had to guess, I'd say you need to link your application project
to the link library produces by a build of the DLL project, but again,
this is a wild guess since you gave no specifics.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: since you gave no specifics.
He's fishing
|
|
|
|
|
yeah that link helped - thanks
|
|
|
|
|
I am getting a exception while running in the debugger. It happens inside a memcpy and VS 2003 C++ stops the app and opens the assembly code for the memcpy. Is there anyway to find out which memcpy in my code cause this problem.
Scott Dolan
Jernie Corporation
Engineering & Manufacturing
Software, Hardware, & Enclosures
|
|
|
|
|
Did you look in the Call Stack View?
|
|
|
|
|
Where the hell is the call stack view?
Scott Dolan
Jernie Corporation
Engineering & Manufacturing
Software, Hardware, & Enclosures
|
|
|
|
|
Menu: Debug > Windows > Call Stack
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</A>
|
|
|
|
|
ScotDolan wrote: I am getting a exception while running in the debugger. It happens inside a memcpy and VS 2003 C++ stops the app and opens the assembly code for the memcpy. Is there anyway to find out which memcpy in my code cause this problem.
post your code here!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi Friends
I am not able to get the Selected Date from the DatePicker. It is showing me the Current DateTime always.
I am new with VC++.
//Initializing
, m_Date( CTime::GetCurrentTime())
DDX_DateTimeCtrl(pDX, IDC_DATE, m_Date);
And then i am Changing the Date in DatePicker, and on Button Click Event,
i have the below instruction, where i need the Selected Date but instead it is showing me CurrentDateTime()
SELECT Polhsh_ID FROM Polhsh WHERE Installation_ID = %d AND Pelaths_ID = %d AND ActionType = '%s'AND Hmeromhnia= #%s# "), Installation_ID, m_Promhtheytes.GetItemData( m_Promhtheytes.GetCurSel()), ActionType, m_Date.Format( _T("%Y/%m/%d")) );
But i am always getting the Current DateTime.
I know it must be something simple, But i am completely new with VC++.
I hope if anybody gets time, give me some help.
Thanks
Cheers
Menon
|
|
|
|
|
See UpdateData()[^]
Also if your beginning you should be using a book or tutorials. If they have not covered UpdateData then they aren't any good so find another.
|
|
|
|
|
Hi mike
Thank you. Well i generally work on C#.NET web applications.
And there is some modifications to be done on project made by someone else.
After whole day coding in C#.NET i make mistakes while writing VC++.
And again, thanks
Cheers
Menon
|
|
|
|
|
This works fine for me:
void CMyDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_DATETIMEPICKER1, m_date);
}
BEGIN_MESSAGE_MAP(CMyDlg, CDialog)
ON_NOTIFY(DTN_DATETIMECHANGE, IDC_DATETIMEPICKER1, OnChangeDateTimePicker)
END_MESSAGE_MAP()
void CMyDlg::OnChangeDateTimePicker(NMHDR* pNMHDR, LRESULT* pResult)
{
COleDateTime t;
m_date.GetTime(t);
TRACE("%s\n", t.Format("%Y/%m/%d"));
*pResult = 0;
} Note there is no UpdateData() call.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks David
My mistake or so called foolishness was i forgot the UpdateData(True)
Still Thanks
Cheers
Menon
|
|
|
|