|
I did a dialog to display the bmp picture. Then i add some coordinates and text using pDC.
But i don't know how to save this bitmap with what i have added as a bmp file?
Does any one can give me some tips?
Thanks!
|
|
|
|
|
Hi,
Capture the client area and save it.
HDC hdc = ::GetDC(hWnd);
CDC dc, memDC;
dc.Attach(hdc);
memDC.CreateCompatibleDC(&dc);
CRect rc;
::GetClientRect(hWnd, &rc);
CSize sz(rc.Width(), rc.Height());
CBitmap bm;
bm.CreateCompatibleBitmap(&dc, sz.cx, sz.cy);
CBitmap *pOldbm = memDC.SelectObject(&bm);
memDC.BitBlt(0, 0, sz.cx, sz.cy, &dc, 0, 0, SRCCOPY);
// now you can do what you need to with bm.m_hObject
memDC.SelectObject(pOldbm);
bm.Detach();
::ReleaseDC(dc.Detach());
Bye
Cool Ju
Dream ur Destiny
|
|
|
|
|
Hello, everyone,
I want to copy a dialog from one program's resource file to
other program's resource file?
I tried , but failed.
Who can tell me the right method to do this, Thanks a lot!
|
|
|
|
|
For a conventional (not .NET) application, that uses .RC files and a resource.h file, the most reliable approach is the following:
1. Open both resource.h files in the source file editor.
2. Use the "Open With" option in the File Open command to open both .RC files in the source file editor.
3. Use copy/paste to copy the dialog from one .RC file to the other.
4. Copy the resource ID's for the dialog and its controls from one resource.h to the other.
5. Note that you may have to manually renumber the ID's for the dialog, if they conflict with other ID's already in use.
Unfortunately, I don't do .NET programming, so I don't know the procedure there.
Software Zen: delete this;
|
|
|
|
|
Hi,all!
When i use the virtualalloc function to assign the memory, sometime the system told me that
'not enough memory,can't handle the command'. I think perhaps somewhere i assign the memory
and don't destroy it,But my memory is large enough-2G,i don't understand!
Who can help me?Thanks a lot!
|
|
|
|
|
Who can help me?Thanks a lot.
|
|
|
|
|
:-DWhere can I find a Directx 9.0 SDK ?In microsoft.com,the website need to verify my operating system,I do not know if my window XP has the certificate or not.If I follow the steps to install the ActivX control ,Will IT destory my system?
Where can I get a trial based DirectX 9.0 SDK withount any worry?
su
|
|
|
|
|
I cant for the life of me figure out how to setup the syntax to get this to work, here is my vector initializations..
typedef vector<int> vInt1D;
typedef vector<vInt1D> vInt2D;
Here is how I have my function definition...
void SetupCoordinates(int, vInt2D &);
the function declaration looks like this:
void Testing::SetupCoordinates(int iUnitLength, vInt2D &Test)
{
//stuff in here
}
The compiler returns:
Error 1 error C2784: 'bool std::operator ==(const std::vector<_Ty,_Alloc> &,const std::vector<_Ty,_Alloc> &)' : could not deduce template argument for 'const std::vector<_Ty,_Alloc> &' from 'const int' c:\program files\microsoft visual studio 8\vc\include\algorithm 40
Everyone says Vectors are easy to pass to functions, but this is killing me... Thanks!!
"Your KungFu is not strong enough"
-- modified at 18:30 Saturday 19th November, 2005
|
|
|
|
|
Not enough info supplied.
I do not have VC8 so I do not have access to the same version of the algorithm file that you are using. What function is line #40 in? Where in your code are you calling that function? how are you calling it?
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
I modified the message so that the message board wouldnt parse the < > symbols out of the code, so here is the intended version I wanted to post... It should make more sense now, another note I am not using the algorithm header to do this, only the vector header, also worth mentioning is that passing should not be affected by the version of the header I am using, its a vector so its part of the STL.
"Your KungFu is not strong enough"
|
|
|
|
|
Magadass wrote: error C2784: 'bool std::operator ==(const std::vector<_Ty,_Alloc> &,const std::vector<_Ty,_Alloc> &)' : could not deduce template argument for 'const std::vector<_Ty,_Alloc> &' from 'const int' c:\program files\microsoft visual studio 8\vc\include\algorithm 40
Read the error message you posted. It tells you what the error is and the file and line number that the error occured on. The file is 'algorithm' and the line number is 40. The error occurs when the function calls std::operator ==(). Figure out what function is at line 40, then where you call that function. The error is probably in the parameters you pass to that function. The code you posted so far seems OK to me.
Also, have you looked up C2784 in MSDN? There is usually an explanation and possible solution listed there.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
It is referring to an error created in the STL because I am passing the argument incorrectly. That is why I need clarification on how to pass a Multidimensional array by reference, the debugger is trying to tell me that there is an error in the STL, which obviously there isnt, it even takes me to that STL library when I click the error.
The probel I am trying to solve which is the root of this problem is my failure to know how to setup the syntax correctly. I posted the error incase anyone else had the problem and would notice it, but in reality it is not directly associated with the problem I am having...
"Your KungFu is not strong enough"
|
|
|
|
|
Nevermind PJ my appologies, you ever debug something over and over and over and over and cant figure out whats wrong yet its right in front of your face?
So yeah I was using find in a totally seperate piece of my code, and this is what it was referring to but I thought it was referring to my declaration...soooo yeah you were right i was wrong...
Thanks!
"Your KungFu is not strong enough"
|
|
|
|
|
Magadass wrote: you ever debug something over and over and over and over and cant figure out whats wrong yet its right in front of your face?
Yeah, been there, done that!
Magadass wrote: Thanks!
You're welcome.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
I am having problem to find and select an item in a ListView
::SendMessage(hWnd, LVM_FINDITEM, -1, (LPARAM)"item to find");
am I doing something wrong?
|
|
|
|
|
The LPARAM has to be the address of a LVFINDINFO structure, not a text string.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
any code that explain how?
|
|
|
|
|
LVFINDINFO FindInfo = {0};
FindInfo.flags = LVFI_STRING;
FindInfo.psz = "item to find";
Index = ::SendMessage(hWnd, LVM_FINDITEM, -1, &FindInfo);
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
i will try and let you know, thanks alot
|
|
|
|
|
Hello guys,
I have a question : Is CWnd::SetTimer machine dependant ?
I am asking this question , because I have noticed that , for example a program which is using this function as a timer shows different delays in times on different PC - s.
On machines with faster processors a program using this method needs less time then on machines with slower processors.
"Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
|
|
|
|
|
The short answer is no. But to expound, it depends mostly on the load of the OS at that time. The timer won't fire untill the app (or thread) in question gets scheduled, or, if the app/thread in question has a lot of outstanding messages in the queue. A high-priority app running could quite easily delay it, or having many apps/threads running will have the same effect. Also, as a tidbit, different versions of Windows used different values for scheduling the time-slices each app/thread gets.
--
Joel Lucsy
|
|
|
|
|
Windows is not a real-time OS, so all time dependant functions will vary depending on the load of the machine.
On the best case, the timer callback will fall close to what you set it to, but most of the time it will be a little after.
I don't think that a Timer will be called before its ellapsed time.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
You know Max I had once written a game "Snake" , like on any Nokia mobile phone and I used the CWnd::SetTimer function for implementing a timer where I was doing different operations(moving the snake,....)
But when I took this game to my friends PC he has much better PC then I do , It was impossible to play the game as the Snake started to move very fast , of course on my PC it was moving normally.
So my problem is that I need to implement a exact timer in my current project.And I am practically sure that CWnd::SetTimer won't work for that.
Any ideas how to do that
thanks
"Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
|
|
|
|
|
SetTimer and the WM_TIMER message are defined to have 10 millisecond resolution. Unfortunately, they are treated as least priority messages, and are handled only if there are no other messages pending. This means that the timer may trigger every 10 ms, or it might be 100 ms. As others have mentioned, system load affects WM_TIMER behavior as well.
You can measure much more accurate intervals using QueryPerformanceCounter() .
Software Zen: delete this;
|
|
|
|
|
you are right Giogi,
SetTimer is some Machine Dependent! it based on cpu,load on machine etc..
so as Mr. Gary has mentioned you can go for
BOOL QueryPerformanceCounter( LARGE_INTEGER *lpPerformanceCount
);
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|