|
I have not actually done this before, but the header is a different control, so I don´t think you should use the custom draw of the list. CHeaderCtrl supports custom draw (search for the term in MSDN), writing a separate handler for its NM_CUSTOMDRAW should allow you to format the header.
Hope this will set you in the right direction.
/moliate
|
|
|
|
|
I'm looking for some useful explanations of the Memory resources displayed in WIn9x System Monitor (under Accessories); esp.
reserved memory (mostly but not always correlates to swap file usage + Physical memory used)
Do you know any article, web site etc. that does explain some deeper things about the memory managment?
(I'm combatting some weird memory hog... no fun)
TIA Peter
|
|
|
|
|
Hi,
I am using GDI+ to convert a batch of TIFFS to JPEGS - i was just wondering how i can resize a image object and then save it out. Does it have to go via a 'graphics' object? and if so how?
Cheers
Richard
|
|
|
|
|
Yes, you can resize it by drawing it onto a graphics object of the right size, making sure you stretch it at the same time. The best function in my opinion for this is Graphics::DrawImage.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
|
|
|
|
|
Hi,
I (desperately) need a list of running processes (ID orHandle, and Module name), on Win 9x (more important) and NT/W2K. I know I know this gets asked often, but couldn't find any on CP..
Thanks a lot!
Peter
|
|
|
|
|
I think there is a sample in the platform sdk, PViewer or something like that. So a search on MSDN for Process Viewer.
Michael
|
|
|
|
|
http://www.codeproject.com/threads/interprocesssync.asp
--------------------------------------------------
If my messages appear curt, I apologize.
I try to be brief to save your time as well as mine.
--------------------------------------------------
|
|
|
|
|
MSDN Search:
HOWTO: Enumerate Applications in Win32
Q175030
The information in this article applies to:
Microsoft Win32 Application Programming Interface (API), used with:
the operating system: Microsoft Windows NT, version 4.0
Microsoft Windows 95
the operating system: Microsoft Windows 2000
Definitely one of the best starting points to do it.
|
|
|
|
|
Use CreateToolhelp32Snapshot, Process32First and Process32Next defined in tlhelp32.h. It works on Win9x as well as NT (PSAPI gives you more control, but only works on NT).
/moliate
|
|
|
|
|
Actually, ToolHelp32 funtions are *not* available on NT4, according to MSDN. W2K supports them, however.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Sorry, my mistake...
Thanks for the info.
/moliate
|
|
|
|
|
Thanks folks! (Yes I'm a bit late, just didn# get notifs)
I went with the ToolHelp23 functions, since Win98 and W2K are enough and NT4 isn't *that* important.
Peter
|
|
|
|
|
I'm writing an application that opens bitmaps and then let user make a
selection by drawing a dragging rectangle with mouse. I'd like that drawn
rectangle does not disappear on mouse-left-button-up event, but only on next
button-down event.
Someone could tell me how this code doesn't work? Or may suggest me some
right code, please?
// m_bDrag, m_bDraw, m_bEraseRect are boolean initally set as FALSE by
constructor
void CFotoView::OnLButtonDown(UINT nFlags, CPoint point)
{
SetCapture();
m_bDrag = TRUE;
CClientDC dc(this);
if(m_bEraseRect)
{
dc.SetROP2(R2_NOTXORPEN);
dc.Rectangle(m_ptFirst.x, m_ptFirst.y, m_ptLast.x, m_ptLast.y);
m_bEraseRect = FALSE;
}
m_ptFirst = point;
CScrollView::OnLButtonDown(nFlags, point);
}
void CFotoView::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if(m_bDrag)
{
if(nFlags)
{
m_bDraw = TRUE;
m_ptCurrent = m_ptNew = point;
//ClientToScreen(&m_ptCurrent);
//ClientToScreen(&m_ptNew);
m_bDrag = FALSE;
}
}
else if(m_bDraw)
{
CClientDC dc(this);
dc.SetROP2(R2_NOTXORPEN);
dc.Rectangle(m_ptCurrent.x, m_ptCurrent.y, m_ptNew.x, m_ptNew.y);
m_ptNew = point;
//ClientToScreen(&m_ptNew);
dc.Rectangle(m_ptCurrent.x, m_ptCurrent.y, m_ptNew.x, m_ptNew.y);
}
CScrollView::OnMouseMove(nFlags, point);
}
void CFotoView::OnLButtonUp(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if(m_bDraw)
{
CClientDC dc(this);
m_bDrag = FALSE;
m_bDraw = FALSE;
ReleaseCapture();
dc.SetROP2(R2_NOTXORPEN);
//ClientToScreen(&point);
//dc.Rectangle(m_ptCurrent.x, m_ptCurrent.y, m_ptNew.x, m_ptNew.y);
m_bEraseRect = TRUE;
m_ptLast = point;
}
else if(m_bDrag)
{
m_bDraw = FALSE;
m_bDrag = FALSE;
ReleaseCapture();
}
CScrollView::OnLButtonUp(nFlags, point);
}
Thanks everyone could help me.
Bye
giampy
|
|
|
|
|
you are probably overwriting the rectangle in your OnDraw call. in general, you should try to handle all drawing from your OnDraw. every other function should just Invalidate the parts of the view that it wants redrawn. there are execptions to this rule, of course; but this is a good way to start.
-c
POKE 808,234
|
|
|
|
|
YOU'RE RIGHT!!!
I followed your precious hint and now it works!
Thx: this really helped me!
giampy
|
|
|
|
|
If you haven't looked at it already, take a look at the CRectTracker class. The documentation suggests that it's intended for OLE/COM, but in reality it's much more general than that and makes it pretty easy to do what you describe wanting.
|
|
|
|
|
Hi, All!
=======
Is there any way for me to create an operator.
For example, like the 'new' operator:
Instead of: x= new int[5];
It will be: x= MyNew int[5];
NOT : x= MyNew(sizeof(int)*5) ;
BTW: come to #CodeProject on DalNet (mIRC)
|
|
|
|
|
do a google search on "override operator new". i got 4900 hits. at least the first three pages all looked relevant.
-c
POKE 808,234
|
|
|
|
|
Look up operator new on MSDN.
Michael
|
|
|
|
|
|
I have a program where I need to replace the Alphabet value to numers.
Examples:
I have B13 which has to be replace with 1013.
10 is just aplhabet count. I would know the position in the string to replace.
Please help me.
|
|
|
|
|
But "B" isn't the 10th letter.
Describe your problem more.
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
If you count the alphabet A-woud be 10, B- 20,
C-30 ....Z-26
So I have a string where mixed value:letters and numbers.
I need to replace the value of letter with applicable numbers. The string len is different every time.
Thanks.
I tryed your code with my string Modifier and it's not working. Can you tell me why?:
for (i=0; i < strlen(Modifier); i++)
{
ch = Modifier.GetAt(i);
switch (ch)
{
case 'A':
str.Delete(i);
str.Insert(i,"10");
break;
case 'B':
str.Delete(i);
str.Insert(i,"20");
}
}
|
|
|
|
|
A is 01, not 10. Otherwise, A and J have the same value.
Having said that, I would do this by building a second string, otherwise it gets too messy, because you're inserting two chars in the place of one and need to track that in terms of GetAt(). For example if I have "ABC" and I GetAt(0) and replace it, I end up with the string "01BC". If I then iterate through the loop I GetAt(1), I will get back '1', NOT 'B'.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
|
|
|
|
|
I think he wants to replace all letters in a string with two-character numeric representations.
Assuming a CString is being used:
#include <ctype.h>
CString sText = "A big lazy dog";
CString sResult = "";
CString sTemp = "";
int nLen = sText.GetLength();
sText.MakeUpper();
for (int i = 0; i < nLen; i++)
{
char cCurr = sText.GetAt(i);
if (isalpha(cCurr))
{
sTemp.Format("%02d", (int)cCurr - 64);
sResult += sTemp;
}
else
{
sResult += CString(cCurr);
}
}
<pre>
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|