|
Thank for nice Article.But I need one more advice forum.Function is define in header file and all thing is doing there.So how can i use there worker thread?Plz help me
|
|
|
|
|
You have to create your thread in your dialog class, just before calling the function. You don't have to change your function at all. But I think things will be much clearer once you have read the full article.
|
|
|
|
|
Hello everybody,
i got a strange problem.
If i resize a frame (within a CFormView) all works great.
Till i replace the View with another one (the frame keeps)
All Size-Events are correctly send to the new active view.
But if I size the frame fast, the view will (sometimes) not get the newest Size-Event.
Then, a ugly mistake like this is provoked :
http://img5.imageshack.us/my.php?image=fehleruu2.jpg[^]
I tested this view already as a initial view (without changing the view into the frame ) in this
case it works also without mistakes.
Only if I replace the initial view with another one, then the second view resizes not correctly.
Also i tested if the initial view is also resized (so that wrongly 2 views are sized) but i use a Hidden-Flag to step out the OnSize-Function (but the Size-Event is send anyway to it )
Big thanks for help
|
|
|
|
|
How about handling WM_EXITSIZEMOVE[^] rather than/as well as WM_SIZE?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Yes, it's a last possibility to "resolve" it,
but if the user holds down the Mouse-Key (for example to continue the sizing) it
seems pretty ugly
But thanks for your answer
|
|
|
|
|
Hello all,
In my project I am creating a SDI application without Document/View architecture in MFC(Visaul C++ 2008).
Now in it, I am creating a child window using "Create()" method with window style "WS_CHILD" and i am calling this "Create()" method from "OnCreate()" of CMainFrame class.For this newly created child window I have created a new class.Now on this new child window I have added some controls like edit boxes, buttons and these controls are also created by "Create()" method and with "WS_CHILD" style.
Now my actual problem is that when I run the application, child window gets created and I can see the controls added on the child window also but I can not access these controls means these controls are disabled. Can anyone tell how to enable or access these controls on child window.
Thanks and Regards,
Abhijit
|
|
|
|
|
re-re-re-re-REPOST!!!!
If you didn't get any responses a week ago, how do you expect to get any this week when you have provided no extra information (for example - what classes were used to create your child windows - how about posting some code to illustrate what you're doing!
To paraphrase Einstein, "The definition of insanity is posting the same thing over and over again and expecting different results"
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
i want to setFont of a CStatic text control. i have GdiPlus::Font i want to use that.. or it will do if i will be able to convert it to same CFont.
any help
thanx
|
|
|
|
|
Here is some code for the conversion:
CDC* pDC = CDC::FromHandle(::GetDC(NULL));
Gdiplus::Graphics g(pDC->m_hDC);
Gdiplus::Font gdipFont(L"Arial", (REAL)8);
LOGFONT lf;
#ifdef _UNICODE
gdipFont.GetLogFontW(&g, &lf);
#else
gdipFont.GetLogFontA(&g, &lf);
#endif
CFont font;
font.CreateFontIndirect(&lf);
Hope this helps!
modified on Tuesday, February 17, 2009 9:25 AM
|
|
|
|
|
Hey everybody
I am REALLY stuck with this one!
I'll describe the problem with a scenario:
(1) Log to computer with user "A".
(2) start->run-> "\\somecomp\somedir\"
(3) user "A" has no access to this "\\somecomp\somedir\", thus windows pops up a window that allows user "A" to log-in to "\\somecomp\somedir\" as a different user.
(4) user "A" enters user/pass of "P" that has permission to the "\\somecomp\somedir\".
The question is:
How can I tell (from user "A"'s computer) that he uses user "P" to get to "\\somecomp\somedir\" ????
Help... please...
Thanks!
|
|
|
|
|
Hi,
in my app I have the following code:
std::ofstream f(sPath.GetBuffer(0), std::ios::binary);
f.write((const char *) pBytes, dwSize);
f.close();
I also include 'iostream.h' #include <iostream.h></iostream.h>
I'm getting error:
-error C2027: use of undefined type 'basic_ios<char,struct> >'
-error C2065: 'binary' : undeclared identifier
-error C2079: 'f' uses undefined class 'basic_ofstream<char,struct> >'
-error C2078: too many initializers
-error C2228: left of '.write' must have class/struct/union type
-error C2228: left of '.close' must have class/struct/union type
Help?
Thanks!
P.S. Using vc++ 6 on WinXP SP3
|
|
|
|
|
josip cagalj wrote: I also include 'iostream.h'
You should include <fstream> also. And iostream.h is deprecated, you should include <iostream> instead (without the .h).
|
|
|
|
|
|
Still one thing more,
how to test why std::ofstream failed.
My code:
std::ofstream f(sPath.GetBuffer(0), std::ios::binary);
fails to open file, I test that with f.is_open() , but why?
Thanks
|
|
|
|
|
Check the path you're supplying to the ofstream constructor - this little C++ program works for me, which demonstrates the library doing the right thing:
#include <iostream>
#include <fstream>
int main(int, char**)
{
std::ofstream f("a.a", std::ios::binary);
if (!f.is_open())
{
std::cerr << "File open failed" << std::endl;
}
else
{
f << "Hello";
f.close();
}
}
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
josip cagalj wrote: I also include 'iostream.h'
As well as adding in #include <fstream> , let's change that #include <iostream.h> to #include <iostream> - that's what you should be including for standard stream support
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanks to you also.
Please see my new post.
|
|
|
|
|
I’ve got problem with using GDI on top of OpenGL in Windows Vista. I’ve found that if GDI graphic would be drawn before any drawing operation of OpenGL than everything what was drawn by GDI would be cleared and would be drawn everything what was drawn by OpenGL before and after. It looks like OpenGL is drawn in separate buffer which after each calling of glFlush function drawn on a screen while clearing what was drawn by GDI. One of easiest solution of the problem is to draw any GDI objects after drawing OpenGL elements, but appears the same problem when the screen spitted on 4 sides. After drawing of one screen, drawing of OpenGL elements next screen clearing GDI objects previous screen. I tried to draw everything on the screen and the copy everything to memory buffer using CDC::BitBlt and then draw this buffer using OpenGL function glDrawPixels. But I found that GDI objects are drawn after exit from CView::OnDraw function, means catch of screen using CDC::BitBlt at the end of CView::OnDraw function do not include GDI objects.
Other case is to draw GDI objects to memory and the draw them by using OpenGL functions did not tested. I am trying to find much easiest way to solve the problem.
Please, help to solve the problem.
|
|
|
|
|
Hi,
I want to move one line between two horizontal sliders, with respect to slider position... I am able to move slider tic, but not able to move line to exact sliders tic...
Is there any way to get pixels information from the slider control..
If so please kindly let me know ... It is very urgent requirement for me..
Thanks in advance..
modified on Tuesday, February 17, 2009 10:17 AM
|
|
|
|
|
It should be possible to use GetWindowRect on the slider control to get the total width of the slider and then the GetPos method to get the current tic position to calculate the width of the line you want to draw.
«_Superman_»
|
|
|
|
|
Hi,
I have tried with your solution, I am calling m_pDlg->m_slider_bar1.GetWindowRect(&rect1); this control from my app for getting pixels position.
after that i am trying to change the slider position like below mentioned way:
int pos = m_pDlg->m_slider_bar1.GetPos();
m_pDlg->m_slider_bar1.SetPos(slide_pos);
m_pDlg->m_slider_bar2.SetPos(slide_pos);
every time i am getting rectangle pixels like :- 86,110,283,565 only.
how i have to move line now to moved position.
please kindly help me regarding this..
Thanks in advance..
modified on Tuesday, February 17, 2009 10:18 AM
|
|
|
|
|
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
|
|
|
|