|
Christian Graus wrote:
I'd regard this as a bad idea. Why not while (whatever condition you end up breaking on), or a do...while if you want to make sure it runs once ?
If I say socket programming, does it wake any codelines in your brain?
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
I agree with you. I've actually gone as far as to do the "unthinkable!": put using namespace std; inside the precompiled header. Oh the horror!
The result? Clean, Easy-to-read code!
Unfortunately, like you say, a lot of people prefer to preach, "Don't you ever do this", instead of "Doing this is OK as long as you're aware of such and such potential problems". When it comes to the using directive, the only problem that can occur is name clashes, which the compiler is happy to tell you about, and can be corrected with the scope-resolution operator.
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
|
|
|
|
|
Hi,
does anybody know how i can make some changes at the axis scaling of a MSChart Control at runtime ?
Marco
|
|
|
|
|
I'm stuck in this CControlBar hell, using the wonderfull CSizingControlBar, I need to be able to do some stuff when the user closes the floating bar, when he presses on the x button, which is different than when the user show/hide the bars, because I can handle the menu item in the mainframe.
by default, the floating control bar frame is a CMiniDockFrameWnd, see the deeply undocumented m_pFloatingFrameClass member of the CFrameWnd class. so, when I use a CSizingControlBar, the frame is "hard coded" to CMiniDockFrameWnd. and I can't handle messages for it, and I can't handle the close.
So, as explained in the the CSizingControlBar documentation and code, I can replace the pFloatingFrameClass with my own CMiniDockFrameWnd derived class, this kinda' work, but will this replace the miniframe for all toolbars ? yep, looks like it,
I was able to fix this by using my own CMiniDockFrameWnd derived class to handle the WM_NCLBUTTONDOWN and check for HTCLOSE ... and do my stuff, and I also needed to handle the same kind of things when the bar is docked ...
Anyway, I think that the way the controlbars are handled are the work of the devil!
now, go about your daily business ...
Max.
|
|
|
|
|
Maximilien wrote:
Anyway, I think that the way the controlbars are handled are the work of the devil!
Yup.
---
Shog9
Life seems pretty easy when it's from my easy chair
And you're burnin up inside and no one cares...
|
|
|
|
|
Ok, I'm modifying someone else's cool OpenGL program. All I wish to do now is to add some cool zoom functions (it's a 3D mapping program).
I was thinking that when you would click on a spot, it would zoom in on it. So I found these functions:
SetViewportOrgEx() // I would use this to set the new orgin
ScaleViewportExtEx() // I would use this to zoom in
I put them both in my code, but nothing happened! No errors, no screen changes, no bad return values--nothing!
If you have any ideas (or even another way to do it), please help! This functionality would be really cool to the program,
~ Selevercin
If you have a problem with my spelling, just remember that's not my fault. I (as well as everyone else who learned to spell after 1976) blame it on Robert A. Kolpek for U.S. Patent 4,136,395.
|
|
|
|
|
Bonjour,
I don't where you put this code but you need to put it on the OnPaint event like this :
void CTNSImageCtrl::OnPaint()
{
PAINTSTRUCT ps;
CDC *cDC = BeginPaint(&ps);
// SetMapMode(cDC->m_hDC, MM_LOMETRIC);
SetWindowOrgEx(cDC->m_hDC, 0, 0, NULL);
SetViewportOrgEx(cDC->m_hDC,
-GetScrollPos(SB_HORZ),
-GetScrollPos(SB_VERT),
NULL);
OnDraw(cDC, &ps.rcPaint, NULL);
EndPaint(&ps);
}
Here is a sample where i just move not scale for the scale i use another way !!!
Simplicity is the supreme sophistication.
-------------------------------------------
http://www.borie.org/
|
|
|
|
|
If it is really an OpenGL program as you stated then the GDI Viewport functions will have no effect on it. There are two techniques commonly used to zoom in on an object in OpenGL. Either add a scale call (GLscalef(x,y,z) I think) and incrementally bump up the scale factors to increase the size of the object or move the camera gradually closer to the object. There are OpenGL samples on this site that demonstrate this.
The Ten Commandments For C Programmers
|
|
|
|
|
Well that explanes my problem! First of all, the person who origonally wrote this prog said that maybe a glscale() function existed. I can't find either your version or his of this function.
Also,I don't suppose you happen to know if I really need a z value. I would assume for a zoom-in function, you would simply decrease x and y to make it appear that you are zooming in.
If you have a problem with my spelling, just remember that's not my fault. I (as well as everyone else who learned to spell after 1976) blame it on Robert A. Kolpek for U.S. Patent 4,136,395.
|
|
|
|
|
Selevercin wrote:
Also,I don't suppose you happen to know if I really need a z value.
You talked about 3D, so the z value is necessary.
Selevercin wrote:
you would simply decrease x and y to make it appear that you are zooming in
... decrease them by dividing them by a value which appears to be related to z ....
~RaGE();
|
|
|
|
|
Hello all,
I had a question regarding how to get to the View of a particular window. I created an MDI application without doc/view support. When I hit File->new, a new window appears thansk to this App Generated Code
CMainFrame* pFrame = STATIC_DOWNCAST(CMainFrame, m_pMainWnd);
// create a new MDI child window
pFrame->CreateNewChild(
RUNTIME_CLASS(CChildFrame), IDR_NICKMITYPE, m_hMDIMenu, m_hMDIAccel);
My problem is that I wish to open a DIB into this new window. Everytime I open the DIB though, it goes to the background of my application and not to this new window. I have determied that this happens due to the fact that when I call GetView(), it returns &m_wndView. m_wndView is the view of the ChildView class, and hence it always appears as the background (right?). How can I get to the View of the Child Window that was created? Please help me out, or let me know if I am going about this in the right way.
I am thinking that what I should do is write a new view class, and have the DIB open into a new window using this view class. What do you guys think?
Thanks,
NickOne
|
|
|
|
|
Hi,
I'm working on an Add-in for VS6. One of my pb is to deal with modeless dialog.
When I use a non modal window, I do not catch all the messages from the keyboard anymore. For instance, if I type some text in an edit box, everything is fine except for the DEL key (same with Escape, Ctrl-Z, etc.) which acts in the VS editor window behind...
If you have any suggestions...
Christophe
|
|
|
|
|
Hi,
how do I enable the Edit-Menu for a RichEditCtrl that I have docked in a CtrlBar ?
I thought there was an article here, but I don't find it anymore.
thanks
-widi
-
|
|
|
|
|
Hi, I've been working with Ole DB and I'd like to be in touch with people who work with it too, because there is a lack of information on this matter. What we can find on microsoft's examples is raw code..Maybe we can open a forum here...what do you think...send comments
Willie
W. Zayas
|
|
|
|
|
I am trying to wrap a text using DrawText function with DT_WORDBREAK and even DT_CALCRECT, but I am not getting correct results…..
I need clear information regarding this problem…. Thx
|
|
|
|
|
Hamzeh wrote:
I am not getting correct results…..
Need more info.
Jason Henderson start page ; articles
henderson is coming
henderson is an opponent's worst nightmare
* googlism *
|
|
|
|
|
Take a look at the code for the DrawTheText member function in Davide Calabro's CButtonST v3.7 (MFC Flat buttons)[^] article here on CP.
Roger Stewart
"I Owe, I Owe, it's off to work I go..."
|
|
|
|
|
Hi,
I´ve been using the Crypto API to sign digital messages.
Everything works fine under windows 2000, but when I try
to sign a message under windows 9x it just doesn´t work.
After I click the button the system brings nothing back as
if hasn´t found the certificate.
The code executed for retrieving the certificate is:
if(myCert.FindBySerialNumber(issuer,sn))<br />
if(m_cryptmsg.SignMessage(&myCert,m_texto,&pbData, <br />
&cbData))<br />
{<br />
blob = new CCryptoBlob( pbData, cbData );<br />
m_lpRet = (LPSTR)blob->ToBase64(); <br />
blob->Release(); <br />
}<br />
else<br />
_tcscpy(m_lpRet,_T(""));
Is there anything that should be done different for it to
work under Win 9x?
Thanks in advance
|
|
|
|
|
I have an application that has a tab-page on which some controls can be placed. These controls are created in a DLL. When I try to delete these controls from within the DLL I get an assertion failure in the CWnd::DestroyWindow of the controls at ASSERT(m_hWnd == hWndOrig); . Anyone know how to fix this? ...it is realy anoying me.
<br />
BOOL CWnd::DestroyWindow()<br />
{<br />
if (m_hWnd == NULL)<br />
return FALSE;<br />
<br />
CHandleMap* pMap = afxMapHWND();<br />
ASSERT(pMap != NULL);<br />
CWnd* pWnd = (CWnd*)pMap->LookupPermanent(m_hWnd);<br />
#ifdef _DEBUG<br />
HWND hWndOrig = m_hWnd;<br />
#endif<br />
<br />
#ifdef _AFX_NO_OCC_SUPPORT<br />
BOOL bResult = ::DestroyWindow(m_hWnd);<br />
#else //_AFX_NO_OCC_SUPPORT<br />
BOOL bResult;<br />
if (m_pCtrlSite == NULL)<br />
bResult = ::DestroyWindow(m_hWnd);<br />
else<br />
bResult = m_pCtrlSite->DestroyControl();<br />
#endif //_AFX_NO_OCC_SUPPORT<br />
<br />
if (pWnd != NULL)<br />
{<br />
#ifdef _DEBUG<br />
ASSERT(pMap->LookupPermanent(hWndOrig) == NULL);<br />
#endif<br />
}<br />
else<br />
{<br />
#ifdef _DEBUG<br />
ASSERT(m_hWnd == hWndOrig);<br />
#endif<br />
Detach();<br />
}<br />
return bResult;<br />
}<br />
|
|
|
|
|
What's the value of bResult before the assertion fails ?
~RaGE();
|
|
|
|
|
When the assertions fails:
bResult = TRUE
m_hWnd = 0x00000000
hWndOrig = 0x000408e6
|
|
|
|
|
I do not understand why it souhld _not_ cause an assertion here. You destroy the window (since bResult is true) so m_hWnd is NULL, so pWnd is NULL, so m_hWnd cannot be equal to m_hWnd since it takes the original value of hWndOrig with HWND hWndOrig = m_hWnd; . I really do not see the point in all this
~RaGE();
|
|
|
|
|
I cannot figure it out either, some source comment would have been handy. Also, I can not find anything about this problem on the whole damn internet (google search). I guess I just have to put up with it and try to restain myself from smashing my keyboard.
|
|
|
|
|
Are you using the AFX_MANAGE_STATE( ) macro at the top of the function in the dll that destroys the window?
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
That's It! I thought I already added it, but I hadn't done so in the destructor. Thanx !
|
|
|
|
|