|
You have a source file where some operation happens, and that should update a progress bar in the UI, right? In that case, you could do a PostMessage with the current progress as LPARAM, handle the message in your main window and then update the progress bar there.
If I got something wrong, please explain in detail.
"Real men drive manual transmission" - Rajesh.
|
|
|
|
|
hi
i need to create a memory dc with a specified dimensions. one way is to select a created or loaded bitmap in it which has the desired dimensions. is there any way else?
thx
|
|
|
|
|
The HDC is just a drawing interface to 'something'. The DC itself does not have a size. It is usually backed by a window, a printer, or a bitmap. You always have to retrieve the size of the underlying object that backs the DC. This can be the client are of the window, the whole window, the size of the paper in your printer, the size of the bitmap or whatever. If your memory DC is backed by a bitmap, then you are right, you have to select another bitmap to the DC to change the size.
|
|
|
|
|
thank u
i did this and the problem was resolved:
Ct2View::d_tmpDC.CreateCompatibleDC(&dc);
bitmap.DeleteObject();
bitmap.CreateCompatibleBitmap(&dc, Ct2View::d_itemSize.cx, Ct2View::d_itemSize.cy);
Ct2View::d_tmpDC.SelectObject(&bitmap);
|
|
|
|
|
Hello Friends
I am creating a application in which user can choose any image format and also can choose one color of that image that he wants Transparent.Now ,to do this,I am using bitmap class of GDIPLUS and getting its height and width And matching choosed color with all image colors and If matches then setting tht pixel alpha to 0.But this is working fine for tiff file and for some bmp not for all bmp.Some bmp colors are coming irregular.Is there any other Way to set transparency of Images?
Thanks & Regards
Yogesh
|
|
|
|
|
If the image is originally rendered with anti-aliasing, the simple replacement of colors will never look good. You can look at the hue of the colors to see if they are fairly close, and do some adjustments to the alpha channel according to that. The easiest thing would probably be to find an image library with this feature.
|
|
|
|
|
Thanks for your Reply.
Can u please suggest me some Library or is It possible with GDI plus?
Regards
Yogesh
|
|
|
|
|
I make use of AfxBeginThread to kick off an mfc dialog that does some work for me. Form is:
AfxBeginThread(UI_proc, &threadData, Priority);
My goal is to create a UI thread that will be able to handle messages. In my testing, I clearly see messages delived to this dialog (wm_paint, etc). In migrating the code to another application, I was reading about AfxBeginThread. In the help, it shows two forms for the call:
<br />
CWinThread* AfxBeginThread( <br />
AFX_THREADPROC pfnThreadProc, <br />
LPVOID pParam, <br />
int nPriority = THREAD_PRIORITY_NORMAL, <br />
UINT nStackSize = 0, <br />
DWORD dwCreateFlags = 0, <br />
LPSECURITY_ATTRIBUTES lpSecurityAttrs = NULL );<br />
<br />
CWinThread* AfxBeginThread( <br />
CRuntimeClass* pThreadClass, <br />
int nPriority = THREAD_PRIORITY_NORMAL, <br />
UINT nStackSize = 0, <br />
DWORD dwCreateFlags = 0, <br />
LPSECURITY_ATTRIBUTES lpSecurityAttrs = NULL );<br />
The online help clearly indicates that the first version is for a worker thread while the latter is for a UI thread. My question is why does my code still receive UI events? Luck?
Charlie Gilley
<italic>You're going to tell me what I want to know, or I'm going to beat you to death in your own house.
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
The first version only takes a function as its first parameter.
The function is simply runs in a new thread.
The second version takes a CWinThread derived class.
Which means you're running a whole new application in a new thread.
You must be calling it differently.
Do you have a different dialog showing up?
If so how are you calling it?
|
|
|
|
|
This is just a guess, but while the documentation says that the first version is for a worker thread and the latter for a UI thread, that doesn't necessarily mean that the first version might not work if you create UI components within that thread. It's possible that under certain circumstances it will work okay and under others it fails miserably.
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
|
|
|
|
|
The relationship between a worker thread and UI thread is that, a worker thread becomes a UI thread if you have a message loop in it. So I'm guessing the UI_proc function has a message loop in it.
|
|
|
|
|
Superman - my application is a little unique in that it is for an embedded HMI using WinCE. When my application needs to wait (a desktop PC would change the cursor to a wait cursor), my wait has to cover the entire control screen transparently with an animation in the center. So, in the UI thread, I have simply:
<br />
CWaitDlg myDlg;
pData->pWaitDlg = &myDlg;<br />
<br />
myDlg.m_sMessage = pData->sMessage;<br />
<br />
myDlg.DoModal();<br />
The dialog is a standard mfc dialog with a BEGIN_MESSAGE_MAP() / END_MESSAGE_MAP() macro sequence. Is this what triggers everything to work correctly?
Appreciate the comments.
Charlie Gilley
<italic>You're going to tell me what I want to know, or I'm going to beat you to death in your own house.
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
charlieg wrote: The online help clearly indicates that the first version is for a worker thread while the latter is for a UI thread.
All threads work. The distinction is that the second prototype is for a thread that has a message pump. See here for more.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
|
Run the replace commands one after another, instead of running them amuck. I hope I understood your query correctly - please explain otherwise.
It was ever thus, the Neophiles will always rush out and get 'The Latest Thing' at a high price and with all the inherent faults - Dalek Dave.
|
|
|
|
|
|
Without seeing the code, I can hardly tell anything.
It was ever thus, the Neophiles will always rush out and get 'The Latest Thing' at a high price and with all the inherent faults - Dalek Dave.
|
|
|
|
|
|
Nami.v.s wrote: while(csTemp.Replace(","," <comma> "));
while(csTemp.Replace(":"," <scol> "));
}
else
{
while(csTemp.Replace("<comma>",""));
}
while(csTemp.Replace("\t"," "));
while(csTemp.Replace("\r",""));
while(csTemp.Replace("\n",""));
while(csTemp.Replace(" "," "));
It makes no sense to run the CString::Replace() within a while . The CString::Replace() call will automatically replace all the occurrences of the given input.
It was ever thus, the Neophiles will always rush out and get 'The Latest Thing' at a high price and with all the inherent faults - Dalek Dave.
|
|
|
|
|
|
The problem itself is not clear to me. What exactly are you trying to achieve? (provide sample input and desired output).
Important: Do not use txtspk here. Please type each word in full.
It was ever thus, the Neophiles will always rush out and get 'The Latest Thing' at a high price and with all the inherent faults - Dalek Dave.
|
|
|
|
|
|
Nami.v.s wrote: Name:XXXX,HomeLoc:WF
Nami.v.s wrote: Name<scol>XXXX <comma>HomeLoc<scol>WF
First replace all the commas with a single call to CString::Replace() .
Next, replace all the colons with another single call to CString::Replace()
If there are more such characters, repeat.
You should never need a while here.
It was ever thus, the Neophiles will always rush out and get 'The Latest Thing' at a high price and with all the inherent faults - Dalek Dave.
|
|
|
|
|
Either you are not understanding what you are asking, or you are not understanding what you've been told. Using the Replace() method within a while() loop is not going to work in your situation.
Other than that, if it's still not working, you need to show the input string, the desired output string, and the output string that your code produces.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
IMO a looped replace may have a devastating effect, try
while(csTemp.Replace("a","ab"));
on a string that holds some 'a'.
|
|
|
|