|
If slider range has been set from 0 to 100 and SetPos returns 50, you know that it is 50%.
So the position of the tic is at (283 - 86) / 2.
Now you can do a MoveTo and LineTo from X1 which is ((283 - 86) / 2, bottom of slider1) to X2 which is at ((283 - 86) / 2, top of slider 2).
«_Superman_»
|
|
|
|
|
Hi Superman,
I have written the code like this, but still it's not working
while (slide_pos <= 100)
{
m_pDlg->m_slider_bar1.GetWindowRect(&rect1);
m_pDlg->m_slider_bar2.GetWindowRect(&rect2);
int pos = m_pDlg->m_slider_bar1.GetPos();
m_pDlg->x1 = ((rect1.left-rect1.top)/100);
m_pDlg->y1 = rect1.bottom;
m_pDlg->x1 = ((rect1.left-rect1.top)/100);
m_pDlg->y2 = rect2.top;
m_pDlg->m_slider_bar1.SetPos(slide_pos);
m_pDlg->m_slider_bar2.SetPos(slide_pos);
slide_pos = slide_pos + 5;
m_pDlg->InvalidateRect(NULL);
Sleep(1000);
}
rect1 values are :- top=86,bottom=110,left=283,right=565
rect2 values are :- top=259,bottom=283,left=283, right=565.
Can you please look into the code what i have written and let me know where i did wrong..?
modified on Tuesday, February 17, 2009 10:18 AM
|
|
|
|
|
It looks like I have mis-interpreted your question.
Let me try and get it right.
You have 2 sliders.
When one of the slider is moved you want the other one also to move along.
Is that what you need?
«_Superman_»
|
|
|
|
|
Hi,
Yes that is only the part of my requirement. I have two horizontal sliders on my dialog. Now i want to create one verical line in between the two sliders.
Whenever i have clicked on Start button then slider tics will get moved and incremented by 5, i am able to move two slider tics at the same time.
but now what i want is to move line along with the tics. I am not able the slider position where it is exactly moved in terms of pixels.
modified on Tuesday, February 17, 2009 10:29 AM
|
|
|
|
|
You can get the (x1, y1) and (x2, y2) positions for drawing the line using the following code
m_slider1.GetThumbRect(&rect1);
m_slider2.GetThumbRect(&rect2);
m_slider1.ClientToScreen(&rect1);
m_slider2.ClientToScreen(&rect2);
ScreenToClient(&rect1);
ScreenToClient(&rect2);
<span style="color:blue">int</span> x1 = rect1.left + ((rect1.right - rect1.left) / 2);
<span style="color:blue">int</span> y1 = rect1.bottom;
<span style="color:blue">int</span> x2 = x1;
<span style="color:blue">int</span> y2 = rect2.top;
Then you can draw the line using the following code
CDC* pDC = GetDC();
CPen pen(PS_SOLID, 1, RGB(0, 0, 0));
pDC->SelectObject(&pen);
pDC->MoveTo(x1, y1);
pDC->LineTo(x2, y2);
ReleaseDC(pDC);
You may need to erase the previously drawn line.
For that you will need to store the previous line coordinates and draw over it using the same color of the dialog.
«_Superman_»
|
|
|
|
|
Hi Superman,
Thanks for your effort on this..I am able to move slider position correctly, but not able to move along with the sliders, below i am copying my code snippet, please review it and let me know where i am doing wrong..?
Below code i have written in OnStart funciton():-
int slider_pos = 5;
while(slider_pos <= 50)
{
m_slider1.GetThumbRect(&rect1);
m_slider2.GetThumbRect(&rect2);
m_slider1.ClientToScreen(&rect1);
m_slider2.ClientToScreen(&rect2);
ScreenToClient(&rect1);
ScreenToClient(&rect2);
m_slider1.SetPos(slider_pos);
m_slider2.SetPos(slider_pos);
int x1 = rect1.left + ((rect1.right - rect1.left) / 2);
int y1 = rect1.bottom;
int x2 = x1;
int y2 = rect2.top;
slider_pos += 5;
InvalidateRect(rect1,FALSE);
InvalidateRect(rect2,FALSE);
Sleep(1000);
}
Below i have written in OnPaint()
CDC* pDC = GetDC();
pDC->MoveTo(old_x1,old_y1);
pDC->LineTo(old_x2,old_y2);
pDC->MoveTo(x1,y1);
pDC->LineTo(x2,y2);
old_x1 = x1;
old_y1 = y1;
old_x2 = x2;
old_y2 = y2;
Please help me regarding this..?
Thanks in advance..
|
|
|
|
|
You are using x1, y1, x2 and y2 in 2 functions.
I'm assuming you're creating the variables as member variables.
If so remove the int keyword from within the while loop.
Also, in OnPaint you must call BeginPaint instead of GetDC .
And instead of 2 InvalidateRect calls, do a single Invalidate call.
«_Superman_»
|
|
|
|
|
Hi,
I made these changes,
PAINTSTRUCT ps;
CDC* paintDC = BeginPaint(&ps);
//paintDC->MoveTo(old_x1,old_y1);
//paintDC->LineTo(old_x2,old_y2);
paintDC->MoveTo(x1,y1);
paintDC->LineTo(x2,y2);
old_x1 = x1;
old_y1 = y1;
old_x2 = x2;
old_y2 = y2;
EndPaint(&ps);
but line is displaying at last slider position, that to in wrong pixels..
can you please tell me where i am doing wrong..?
Thnaks in advance..
|
|
|
|
|
Hi
Can you please kindly help me on this ASAP, as it is very urgent requirement for me..
|
|
|
|
|
Hi all....as a part of my undergraduate project, i've to design a protocol for streaming audio to another system in a LAN...that protocol should be a layer 2 protocol...can anyone tel me how to implement this and where can i get sample protocol source code and stuffs???? thanks in advance...
|
|
|
|
|
Start on yoursefl, make some research on google and once you are stuck on a specific point, come back and ask a specific question. BTW, read the "How to get an answer to your question" post on top of this forum.
|
|
|
|
|
Hi guys,
I have a frustrating issue that has just cropped up about a week ago.
I have a piece of code which downloads a file via HTTP and saves it to disk.
This code has been working perfectly for the last year on a server, now all of a sudden the call to CHttpFile->Read throws an
exception "Not enough storage is available to process this command".
The server has more than enough memory available (machine has 4gig, of which roughly 1gig is being used at any given time).
It has 12 gig hd space free, drive quota is turned off, and the page file is set to 3 gig min, 4 gig max.
Even straight after a restart, the code still throws the exception.
The file size over the last year has grown from 40meg to 65meg, and that same piece of code is able to download a small 1meg file on the server no problem.
The only bit of advice i have been able to google is that of increasing the IRPStack size, which aparently should fix issues such as this, but unfortunately this does not appear to fix my issue.
If any of you have had any other similar issue, and know of a solution to this problem, please let me know!
Thanks.
|
|
|
|
|
- How are you calling
CHttpFile::Read ? - Have you tried single-stepping through the CHttpFile::Read function (you will be able to if you've got the MFC source installed) to see what underlying function causes the exception to be thrown?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Here's the code snippet that reads the file:
BYTE *pData = new BYTE[dwRemoteSize];
pHttpFile->Read(pData, dwRemoteSize);
and dwRemoteSize is set via:
pHttpFile->QueryInfo(HTTP_QUERY_FLAG_NUMBER|HTTP_QUERY_CONTENT_LENGTH, &dwRemoteSize, &dwLen, 0)
I have stepped through the code on my dev box, however the dev box does not throw this exception. It appears to be related purely to the server box..
|
|
|
|
|
I've just done some investigation on my dev box (with Apache 2.2 as a web server).
This indicates that CHttpFile::Read doesn't want to read more than 67,151,821 bytes at a time. However, it would seem you can read the file in chunks, the same way you would off disk, something like:
unsigned __int64 totalRead(0);
while (1)
{
const DWORD toRead = 1<<20;
const DWORD nRead = httpFile->Read(pData + totalRead, toRead);
totalRead += nRead;
if (nRead != dwRemoteSize) break;
}
_ASSERTE(totalRead == dwRemoteSize);
HTH!!!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Interesting I'll give it a spin and let you know!
|
|
|
|
|
Fantastic
Got the file to download in chunks! Thanks for your help Stuart!
|
|
|
|
|
Hi,
I am using SHGetSpecialFolderPath with CSIDL_SYSTEM to get system folder path. But for Window32 and Window64 I am getting the same path "C:\Windows\System32" But I window64 I should be "C:\Windows\SysWOW64"
What is the problem?
|
|
|
|
|
Nope - this page[^] says that you use CSIDL_SYSTEMX86 to get the WOW64 directory.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
That is because System32 is the system directory for Windows64. This is the directory where the 64 bit DLLs reside. SysWow64 is the directory where the 32 bit DLLs reside. What's in a name.
CSIDL_SYSTEMX86 will probably give you SysWow64 .
«_Superman_»
|
|
|
|
|
Hallo all,
Please help me to write the algorithm in step by step way , it would be better if u send the c++ code for Niblack binarization algorithm in c++.
thanks ,
|
|
|
|
|
Bindas Samanta wrote: Please help me to write the algorithm in step by step way
Bindas Samanta wrote: it would be better if u send the c++ code
So, you want to full code or you want to do it step by step ?
Anyway, this is not the place to ask for 'full codezz'. Start by implementing that yourself and once you are stuck with a specific problem, then come back to ask specific questions.
|
|
|
|
|
- Background: some C/C++ knowledge.
- Step 1: study the algorithm of the book.
Let us know about your progress in order to suggest you the next steps.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi all,
i m using SDI type MFC application, my exe size is 4.61 MB.
Is this possible to decrease the size of exe.
please tell me how can i do this.
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
Suggestion 1.
1> Use ATL instead of MFC and don't link to libraries you don't really need.
Suggestion 2.
1) Dynamically link your program with the MFC library. This will give you a minimum reduce of at least 2031%.
2) Go to Project Settings dialog.
3) Click the 'C/C++' tab.
4) In the 'Optimizations' combo box, choose 'Minimize size'. Click OK to close this dialog. The file size is decreased now
5) Build and compile your executable.
Now check the file size.
Suggestion 3.
Download and use some tool to decrease the size of your exe.
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|