|
Bah, I bet that "programmer-professional" was another Microsoft's hater lol.
Use CWinThread as long as u are using MFC... why to make life harder?
Philip Patrick
"Two beer or not two beer?" (Shakesbeer)
Web-site: www.saintopatrick.com
|
|
|
|
|
Oh no! He was an MFC-programmer with a very good reputation.
Two beer or not two beer -> 2B-r || !2B-r
mfg Flo
|
|
|
|
|
So tell him to explain what he meant, maybe I will agree too. I never had problems with CWinThread .
And a good programmer never tell you "don't use it" without saying why and pointing to another way.
Philip Patrick
"Two beer or not two beer?" (Shakesbeer)
Web-site: www.saintopatrick.com
|
|
|
|
|
I have a timer message in my CMainFrame (CFrameWnd) class which I need to call the OnPaint() function in CChildView (CWnd) every second.
I have the timer set up properly, now I just can't seem to run the OnPaint() function from CMainFrame.
I got a pointer to my Child view class (or so I thought) using
CWnd *tmp = GetActiveWindow();
but this appears to be a pointer to only CWnd, not my CChildView class which inherits it's properties. Odd thing is, far as I know, the only instance of CWnd running should be my CChildView object... so why am I not getting a pointer to it instead of, what appears to be, a temporary CWnd one?
I tried making the timer message in the CChildView class, but classwizard doesn't even seem to have the option, when I tried to do it manually I got some strange errors (also, I wasn't sure where to put my SetTimer function call?).
Any help would be appreciated as I have to have this done for tomorrow.
Thanks
|
|
|
|
|
How are you doing this ? Are you trying to call OnPaint, or are you invalidating the window ?
To force OnPaint you should do this
tmp->Invalidate();
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
ah, well invalidate seemed to work fine since I just needed the window to update every second.
But for future reference, do you know how I would go about accessing a function of my CChildView class from CMainFrame?
|
|
|
|
|
GetActiveView ?
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Anti_dentite wrote:
but this appears to be a pointer to only CWnd, not my CChildView class
You need to cast the CWnd* to a CChildView*
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
What about sending a WM_PAINT?
I think it calls OnPaint for you (or did I confuse sth.?)
mfg HintiFlo
|
|
|
|
|
You shouldn't call WM_PAINT, you should let the system handle it through a call to Invalidate() or RedrawWindow().
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Hi All
I have an application "A" which is active and there's an application "B" getting activated behind the application "A". ( A's window is not the parent of B ) . In WinNT, I'm able to bring the application B's window to the foreground. But, In Win2K Professional, the API - SetActiveWindow / SetForeGroundWindow doesn't seem to work. Is there any otehr round about way to fix this, Pl. sugegst me.
Thanks
regards
Sankar
|
|
|
|
|
On Win2K there is a registry setting which can be used to set it so that apps will be prevented from being made active [even though their task bar icons will start flashing]
This is a per-user setting that works only on Win2K as far as I know. I dont remember the registry key, but you can use TweakUI to set or unset this setting
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
How do you modify a VC++ Project to build a dll instead of an exe? Are there articles out there on this?
|
|
|
|
|
I'd advise you to create a fresh DLL project and copy/paste the various functions and classes.
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
OOOOOOHNO!!!!
Copy and paste should be a nono since Object-Orientation!;)
|
|
|
|
|
|
Hi all,
I am fairly new to VC++ and am looking for some advice before I start a new program.
I want to write a program that looks like a terminal session.
i.e. one window - it will present a prompt i.e. # and flashing cursor you then type your command and press enter. The results then appear on the next line followed by a new prompt and flashing cursor on the next line. (I think you get what I am after)
I have played with using edit box, rich edit box and list box all seem to be able to acheive this sort of program one way or another, but which one should I really be using??
All advice greatly appreciated,
Thanks all,
Tryhard
|
|
|
|
|
Tryhard wrote:
I have played with using edit box, rich edit box and list box all seem to be able to acheive this sort of program one way or another, but which one should I really be using??
Nope! You can not show a flashing cursor on the list box. Using editbox will be simpler than using a richedit. But using rich edit allows you to do more complex operations, such as changing font, color, ...etc.
Kind regards
Mustafa Demirhan
http://www.macroangel.com
Sonork ID 100.9935:zoltrix
|
|
|
|
|
Check out the VCTERM sample in MSDN.
I am currently writing a terminal app, and I have chosen the edit box since it seems to be the easiest control to play with.
You will need to derive your own edit box class to be able to do what you want, but that is shown in the sample.
Cheers,
/Fredrik
Sonork ID: 100.11430:PhatBoy
|
|
|
|
|
Hi, All!!!
=======
Does anyone now how the BitBlt() function works exactly ?
and what do I need to know about SRCCOPY and SRCPAINT and stuff ?
Please help.
Thanks.
BTW: come to #CodeProject on DalNet (mIRC)
|
|
|
|
|
Sagiv wrote:
Does anyone now how the BitBlt() function works exactly ?
What do you mean by 'exactly' ??? If you're doing a SRCCOPY I guess it essentially does a memcpy.
Sagiv wrote:
and what do I need to know about SRCCOPY and SRCPAINT and stuff ?
Here's a list from MSDN
BLACKNESS Turns all output black.
DSTINVERT Inverts the destination bitmap.
MERGECOPY Combines the pattern and the source bitmap using the Boolean AND operator.
MERGEPAINT Combines the inverted source bitmap with the destination bitmap using the Boolean OR operator.
NOTSRCCOPY Copies the inverted source bitmap to the destination.
NOTSRCERASE Inverts the result of combining the destination and source bitmaps using the Boolean OR operator.
PATCOPY Copies the pattern to the destination bitmap.
PATINVERT Combines the destination bitmap with the pattern using the Boolean XOR operator.
PATPAINT Combines the inverted source bitmap with the pattern using the Boolean OR operator. Combines the result of this operation with the destination bitmap using the Boolean OR operator.
SRCAND Combines pixels of the destination and source bitmaps using the Boolean AND operator.
SRCCOPY Copies the source bitmap to the destination bitmap.
SRCERASE Inverts the desination bitmap and combines the result with the source bitmap using the Boolean AND operator.
SRCINVERT Combines pixels of the destination and source bitmaps using the Boolean XOR operator.
SRCPAINT Combines pixels of the destination and source bitmaps using the Boolean OR operator.
WHITENESS Turns all output white.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Sorry...
Let me explain: . . .
Why Doesn't it work:
<code>void</code> OnPaint( <code>HWND </code>hWnd )
{
<code>PAINTSTRUCT </code>ps;
<code>HWND</code> hwndDesktop= ::GetDesktopWindow();
<code>HDC</code> hdcDesktop= ::GetWindowDC(hwndDesktop);
<code>HDC</code> hdcThis= ::BeginPaint( hWnd, &ps);
<code>HDC</code> hdcMem= ::CreateCompatibleDC(hdcThis);
::BitBlt(<code>hdcMem</code>, ps.rcPaint.left, ps.rcPaint.top,
ps.rcPaint.right- ps.rcPaint.left, ps.rcPaint.bottom - ps.rcPaint.top,
<code>hdcDesktop</code>, ps.rcPaint.right- ps.rcPaint.left, ps.rcPaint.bottom - ps.rcPaint.top,
<code>SRCCOPY</code>);
::BitBlt(<code>hdcThis</code>, ps.rcPaint.left, ps.rcPaint.top,
ps.rcPaint.right- ps.rcPaint.left, ps.rcPaint.bottom - ps.rcPaint.top,
<code>hdcMem</code>, ps.rcPaint.right- ps.rcPaint.left, ps.rcPaint.bottom - ps.rcPaint.top,
<code>SRCCOPY</code>);
::EndPaint( hWnd, &ps);
}
BTW: come to #CodeProject on DalNet (mIRC)
|
|
|
|
|
hdcMem contains a 1x1x1 bitmap, for starters. You need to select a bitmap into it.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Well.. . .
I tried this
void OnPaint( HWND hWnd )
{
PAINTSTRUCT ps;
HWND hwndDesktop= ::GetDesktopWindow();
HDC hdcDesktop= ::GetWindowDC(hwndDesktop);
HDC hdcThis= ::BeginPaint( hWnd, &ps);
<code>
int nWidth= ps.rcPaint.right- ps.rcPaint.left;
int nHeight= ps.rcPaint.bottom - ps.rcPaint.top;
</code>
HDC hdcMem= ::CreateCompatibleDC(hdcThis);
<code> HBITMAP hbmpMem= ::CreateCompatibleBitmap(hdcMem, nWidth, nHeight);
HBITMAP hbmpMemOld= (HBITMAP)::SelectObject(hdcMem, hbmpMem);
</code>
::BitBlt(hdcMem, ps.rcPaint.left, ps.rcPaint.top,
nWidth, nHeight, hdcDesktop, nWidth, nHeight, SRCCOPY);
::BitBlt(hdcThis, ps.rcPaint.left, ps.rcPaint.top,
nWidth, nHeight, hdcMem, nWidth, nHeight, SRCCOPY);
<code> DeleteObject(::SelectObject(hdcMem, hbmpMemOld));</code>
::EndPaint( hWnd, &ps);
<code> ::DeleteDC(hdcMem);
::DeleteDC(hdcDesktop);
</code>}
BTW: come to #CodeProject on DalNet (mIRC)
|
|
|
|
|
::BitBlt(hdcMem, ps.rcPaint.left, ps.rcPaint.top, nWidth, nHeight, hdcDesktop, nWidth, nHeight, SRCCOPY);
You need to go from 0, 0 to nWidth nHeight, because that's the size of the bitmap. I assume you WANT to start your BitBlt from nWidth/nHeight, although obviously your window needs to be less than half the width and height of the desktop for this to work.
However, the SECOND BitBlt certainly needs to start copying from hdcMem at 0, 0 - as it stands you're starting at the point just beyond where the bitmaps exists. GDI will accept commands that are outside the bounds of the bitmap in the HDC, it will simply ignore or crop if they are partly on/partly off.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|