|
Hi, I would like to know how I could programmatically change an image in a dialog.
For example, by clicking on a button, it would change IDC_IMAGE1 to IDC_IMAGE2 for example.
Code examples would be appreciated or reference to an article.
Thanks
Ashley
|
|
|
|
|
http://www.codeproject.com/bitmap/
::DeleteObject(hbmButton))
hbmButton=::LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_NEW_BITMAP));
if (hbmButton != NULL)
{
m_ButtonCtrl.SetBitmap(hbmButton);
}
|
|
|
|
|
Hi, I have written a reminders program which allows the user to input something they need reminding about with a date time picker so they can select the date and the time in which the popup should come up....
I need to input into a string the current system time with the same formatting as the control so that the time and dates will match with the times and dates selected by the user. How do I get the System Time in the same format as the CDateTimePicker control?
Code examples would be appreciated or reference to an article.
Thankyou,
Ashley
|
|
|
|
|
Have a look at COleDateTime::Format[^]
Michael
But you know when the truth is told,
That you can get what you want or you can just get old,
Your're going to kick off before you even get halfway through.
When will you realise... Vienna waits for you? - "The Stranger," Billy Joel
|
|
|
|
|
CDTPicker m_DateStart; // in header
VARIANT tmpValue;
int year;
tmpValue = m_DateStart.GetYaer();
year = tmpValue.iVal;
------
SYSTEMTIME sysTime;
::SendMessage(m_DateStart.GetSafeHwnd(), MCM_GETCURSEL, 0, (LPARAM)&sysTime);
year = sysTime.wYear;
------ *****************************************
http://www.thecodeproject.com/statusbar/activexstatbar.asp
http://www.codeguru.com/Cpp/controls/controls/dateselectioncontrolsetc/article.php/c2229/
|
|
|
|
|
Hi!
I'm building a application in VC++ .NET.
But when i run it it says to me that it's Out-Of-Memory.
The memory on the computer is not full...
How do you get rid of this problem?
Can you give the program more memory?
Regards, Koo
|
|
|
|
|
Are you allocating a large amount of memory?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Is all the memory allocation on the Stack? Or are you allocating on the heap?
Ant.
|
|
|
|
|
I don't know. It's windows that allocate the memory so i don't have a clue...
|
|
|
|
|
If you have Windows 2000 or XP, look at the Performance tab of Task Manager to see the machine's memory usage. What does it look like before and during the program's execution?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
|
Which makes no sense. Look at the Task Manager before your program runs, write down the memory-related numbers. Look at the Task Manager while your program runs, write down the memory-related numbers. Compare those numbers. What do they tell you?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
That i've got plenty of memory left...
|
|
|
|
|
Ok, can you post the exact verbiage of the out-of-memory message?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
It comes in a messagebox:
Unhandled exception at 0x77e73887 in net32.exe: Microsoft C++ exception: CMemoryException @ 0x00f5f3a4.
|
|
|
|
|
Sounds like you need to compile in debug mode, and use F5 to start the program.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
What I meant was are you allocation memory to data statically or dynamically.
i.e.
char data[1000000];
or
char* pdata;
pdata = new char[1000000];
delete [] pdata;
If you are running through the debugger you should be able to see what it is that is failing to allocate. If you look at the call stack, what is being called?
Ant.
|
|
|
|
|
It's a malloc call. Trying to allocate 22 bytes..
|
|
|
|
|
If this is a C++ program use new /delete instead.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
When you look at the call stack is it calling the same function over and over again?
I.e. trying to allocate 22bytes over and over again?
Ant.
|
|
|
|
|
You may have corrupted the heap.
Usually this is because you've written to an uninitialized pointer, or written before/beyong the end of an array or object that you've previously allocated on the heap.
|
|
|
|
|
How may I change the default color in my CDialog with all my cildren-windows ( CButtons, CTabCtrl, … )
...and justice for all
APe
|
|
|
|
|
perhaps the is a better way, but i would subclass all objects
and overwrite the wm_ctlcolor method of each object
|
|
|
|
|
OK!! Thanks
Any suggestion how to make my dlg RGB(255,0,0) ?
...and justice for all
APe
|
|
|
|
|
for example:
HBRUSH CCtlcoloDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
CBrush *brush = new CBrush(HS_BDIAGONAL,RGB(200,0,0));
return (HBRUSH)(brush->GetSafeHandle());
}
i would declare and construct the brush outside the OnCtlColor Method
|
|
|
|