|
I'm sure it can be done, don't know if there's any libraries that can already do this for you (may be), but if you want to do it yourself you'll have to override the OnPaint() method.
|
|
|
|
|
thanks
but how to do that myself i know that using NULL brush on the WM_PAINT draws the window transparent but just it does that draws a no fill rect, so i can see the back of the window but just the moment it gets drawed, so i am thinking of using a timer but that is not efficient can someone they me how i can do it myself without libraries?
|
|
|
|
|
OnPaint() is the method that the MFC infrastructure calls to draw the screen, that would be the appropriate override for this, if you do it there, it should do it the same every time, if you need to get the screen redrawn at any time, just invalidate it and MFC will once again go to OnPaint() to redraw.
|
|
|
|
|
Have you looked at the WM_ERASEBKGND and/or WM_CTLCOLORDLG messages?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
M not sure this is your requirement or not
add this in onpaint
this->ShowWindow(SW_HIDE);
this will hide the entire dialog
|
|
|
|
|
|
The second link is what i needed thanks 
|
|
|
|
|
Glad to be of assistance!
Sometimes it's just knowing what to look for...
Iain.
I am one of "those foreigners coming over here and stealing our jobs". Yay me!
|
|
|
|
|
Hello,
I finished an update for an Visual C++ application. The version before works without problems, and I did no change at my compiler Settings.
But on all Computers cxcept of my Development machine, I get the following exception:
Unhandled exception 0xE0434F4D (UNKNOWN TYPE) caught at address 0x7697B727 in the thread 4532.
-> Registers:
EAX = 0x0018F220, EBX = 0xE0434F4D, ECX = 0x00000001, EDX = 0x00000000,
ESI = 0x0018F2A8, EDI = 0x0033B290, EBP = 0x0018F270, ESP = 0x0018F220,
EFlags = 0x00000212, CS = 0x0023, SS = 0x002B, DS = 0x002B, ES = 0x2B, FS = 0x0053, GS = 0x002B
-> Last error: 0x000000B7
-> Call stack (thread 4532):
KERNELBASE(?) : RaiseException(0xE0434F4D,0x00000001,0x00000001,0x0018F2A8,0x84CD36CD) + 88 bytes
-> Call stack (thread 3568):
ntdll(?) : ZwWaitForMultipleObjects(0x04CFFE18,0x04CFFE8C,0x00000000,0xFFFFFFFF,0x00000000) + 21 bytes
-> Call stack (thread 3608):
ntdll(?) : ZwWaitForSingleObject(0x00000208,0x000007D0,0x00000000,0x76711141,0x0548FCFC) + 21 bytes
-> Call stack (thread 3864):
ntdll(?) : ZwWaitForMultipleObjects(0x00000000,0x0776FFD4,0x773A9F02,0x003A26E8,0x7032659A) + 21 bytes
-> Call stack (thread 4300):
ntdll(?) : ZwWaitForWorkViaWorkerFactory(0x00389F98,0x0786FFD4,0x773A9F02,0x00389F98,0x70C2659A) + 18 bytes
-> Call stack (thread 4600):
ntdll(?) : ZwWaitForWorkViaWorkerFactory(0x00389F98,0x079AFFD4,0x773A9F02,0x00389F98,0x70DE659A) + 18 bytes
-> Call stack (thread 3496):
ntdll(?) : NtDelayExecution(0x0000EA60,0x00000000,0x07AEFF78,0x7682580C,0x0000EA60) + 21 bytes
-> Computer configuration:
OS type: WIN32 NT
OS version: major 6, minor 1, build 7600
Number of processors: 2
Processor type: GenuineIntel, stepping 10, model 7, instruction family 6
Processor name: Intel(R) Core(TM)2 Duo CPU T6500 @ 2.10GHz
Processor features: FPU, MMX, SSE, SSE2, CLFLUSH, RDTSC, CMPXCHG8B, CMOV
More processor features: VME, DE, PSE, MSR, PAE, MCE, APIC, SEP, MTRR, PGE, MCA, PAT, PSE36, FXSR, DS, SS, TM
I have no idea where I could start searching the problem. Can somebody help me?
Thank You,
Johannes
|
|
|
|
|
I was making exercise 4.23 from C++ essentials and ended up with this code:
#include <iostream>
#include <stdarg.h>
using namespace std;
double Sum (int n, double val ...)
{
va_list args;
double value = val;
double result = 0;
va_start(args, val);
for(int i=0;i<n;i++)
{
result+= value;
va_arg(args, double);
}
va_end(args);
return result;
}
int main()
{
double n = Sum(3, 2, 2, 2);
cout << "Result: " << n;
return 0;
}
It compiles fine and when i do the call "Sum(3, 2, 2, 2)" it just prints "Result: 6" but when i call "Sum(3, 2.1, 2.0, 2.0)" it prints "Result: 6.3" while it should print 6.1, right? What am i doing wrong? D: thanks! btw, the solutions the book provides aren't working...
|
|
|
|
|
I have two questions for you:
1.
by what magic is value going to track the values in the list, you only assign it once, outside the loop?
2.
don't you think you should be able to find the answer yourself, with Google and everything at your disposal?
It never hurts to look up the reference information, e.g. in MSDN[^].
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
LOL! that's an embarrassing mistake D: I see I do understand it but just made some stupid mistake >.> of course it should be
value = va_arg(args, double); instead of just
va_arg(args, double)
thanks anyways 
|
|
|
|
|
you're welcome.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Just on a sidenote:
I do wonder why the authors thought to dig up one of the worst elements of the Dark Ages Of C in a work called 'C++ essentials'! If this was labelled 'C++ complete' or something like that I'd grudgingly admit that this is still part of the language and as such belongs here. But the term 'essentials' indicate that everything in there is required for desgning good C++ code. Yet the opposite is true in this case!
While streams may be harder to implement and use, they are much safer, and provide the full functionality of varargs. The only reason to use them in a C++ program is for the purpose of interpreting arguments in a command line application. (and it's sad that the C++ standards committee never thought to provide a better interface for that purpose!)
|
|
|
|
|
Assume thread B is created while thread A is in the middle of executing.
Q1. is it possible that B starts before A was completed?
Q2. if yes, how do you treat shared resources used by the 2 threads, i.e. pointer p is deleted by B but A is still using the pointer?
|
|
|
|
|
Q1: Yes. Unless you use some kind of thread synchronization you can make no assumptions about what thread finishes when.
Q2: Use synchronization[^]. You need to synchronize access from multiple threads to any objects that aren't specifically thread safe.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
A1. Of course, in the same way your Excel sheet could be recalculating while you are typing text in Word.
A2. Thread synchronization.
You should look at threads in an application like employees in a company; each of them can do as they like or are told, if you don't manage, i.e. organize and synchronize them, a mess will ensue.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Guys,
I have a problem with CDC::DrawText() and I have been sitting here wasting away my Sunday trying to figure it out. The problem is that it does not draw the text in the position I expect it to be. The following code is supposed to draw a rectangle, then draw the text in the box, using the style (DT_LEFT, DT_CENTER or DT_RIGHT).
CBrush brush(m_background[nIndex]);
CBrush* pOldBrush = pDC->SelectObject(&brush);
pDC->SetBkColor(m_background[nIndex]);
pDC->SetBkMode(OPAQUE);
pDC->SelectStockObject(NULL_PEN);
pDC->Rectangle(m_hitRect);
pDC->SelectObject(pOldBrush);
pDC->SetBkMode(TRANSPARENT);
pDC->DrawText(txt,m_hitRect, m_nStyle | DT_SINGLELINE | DT_VCENTER);
The text appears in the box (but not in the correct position) when I use DT_CENTER or DT_RIGHT but is not drwn at all with DT_LEFT (I think its outside the rect).
Please help, I really should be cutting the grass!
Tony
|
|
|
|
|
Check the values in m_hitRect , I don't think we can guess what they are.
[edit]It is also worth checking the return value from the DrawText() call to verify that it did what you expect.[/edit]
The best things in life are not things.
|
|
|
|
|
You don't show the values of variables so it's hard to guess.
If you strip it down and hardcode values it works fine...
CString txt = _T("This is the text!");
CRect m_hitRect(10,10,200,40);
dc.Rectangle(m_hitRect);
dc.DrawText(txt,m_hitRect, DT_LEFT | DT_SINGLELINE | DT_VCENTER);
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi thanks for the reply. I figured out what it was, and as usual its something dumb and not in the area I was looking in.
A long, long time ago I had padded out the right hand side of the string with spaces (not sure why I did this). Anyway, as you can imagine, this would totally screw up the justification.
Oh well, that grass wont mow itself
Thanks
|
|
|
|
|
how to create chm file using html help wprkshop
|
|
|
|
|
You may as well ask how to build a car with tools. Try reading the documentation and help, or Google for tutorials or information on MSDN.
The best things in life are not things.
|
|
|
|
|
|
Use help authoring tools like Helpinator[] for example.
|
|
|
|
|