|
Replace
sect.Open(NULL,
_T( "Select * from Section WHERE sect.m_strFilter" ));
With
sect.Open(NULL,
_T(CString("Select * from Section WHERE ") + sect.m_strFilter ));
|
|
|
|
|
I am studying OpenGL and all the sample code I found so far are writen using Win32 API. I tried to integrate openGL code to a MFC SDI application, but I am having trouble with OnSize. My code doesn't behave the same as the samples of Win32 API. Anybody can give me any hint? Or some sample code to refer to?
Thank you very much in advance!
|
|
|
|
|
Please do your own googling:
http://www.google.com/search?q=mfc+opengl+sample
|
|
|
|
|
Hi Lucy,
Look at NeHe Productions, you should find some cool stuff. Don't forget to bookmark it.
VOTD: " Yet it was the Lord 's will to crush him and cause him to suffer, and though the Lord makes his life a guilt offering, he will see his offspring and prolong his days, and the will of the Lord will prosper in his hand. 11 After the suffering of his soul, he will see the light of life and be satisfied ; by his knowledge my righteous servant will justify many, and he will bear their iniquities." - Isa 53:10-11 (NIV)
|
|
|
|
|
void CChildFrame::OnSize(UINT nType, int cx, int cy)
{
CMDIChildWnd::OnSize(nType, cx, cy);
wglMakeCurrent(GL->m_pDC->GetSafeHdc(), GL->hrc) ;
WWidth = (GLint)cx;
WHeight = (GLint)cy;
::glViewport(0, 0, WWidth, WHeight);
::glMatrixMode(GL_PROJECTION);
::glLoadIdentity();
::glMatrixMode(GL_MODELVIEW);
}
|
|
|
|
|
Thank you all very much. I found a sample, and I got one running in the dialog framework, which is good enough for the time being.
Again, many thanks!
|
|
|
|
|
Just a small question.
You mentioned that you found OpenGL tutorials that use Win32API. Can you point me to some good ones? You see, I do not like using MFC
Thanks,
Pankaj
Without struggle, there is no progress
|
|
|
|
|
When i try to compile a program, VirtualDub actually (www.virtualdub.com), it says that INVALID_SET_FILE_POINTER is an unknown identifier. Accoring to MSDN it's defined in winbase.h (include windows.h) but when i search for that phrase (INVALID_SET_FILE_POINTER) in my include folder, no results are found. Anyone know what could be wrong?
Thanks
|
|
|
|
|
I have found it in winbase.h
#define INVALID_SET_FILE_POINTER ((DWORD)-1)
but only in sdk downloaded from Microsoft. This define does not exist (on my computer) in both VC6.0 and VC7.0 include/src folders.
Mukkie
|
|
|
|
|
In a function I have a local connection object declared as m_pConn1:
Ihad trouble working with a member variable so I made it local. The code works now but each time the function is called:
_ConnectionPtr m_pConn1;
HRESULT hr = m_pConn1.CreateInstance (__uuidof (Connection));
if (FAILED (hr))
{
AfxMessageBox ("Can't create intance of Connection");
}
if (FAILED (m_pConn1->Open (_bstr_t ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source = "+PhotoDBName ),
_bstr_t (""), _bstr_t (""), adModeUnknown)))
{
AfxMessageBox ("Can't open datasource");
return 0 ;
}
My hope is that the object gets destroyed when the function goes out of scope. Is thsi true or am I setting myself up for a massive memory leak?
I seem to remember something about this _ConnectionPtr being a smart pointer but maybe thats just wishful thinking. DOes anyone have any experience with this? Your suggestions are welcome. I'd not have done it this way but no other way seemed to work. I tried for two days and finally went this route.
Thanks,
ns
|
|
|
|
|
You will not have a memory leak. Hopefully not. Close the connection before you exit the function.
Why can't yo make that a member variable? What problems are you having?
|
|
|
|
|
If I createInstance only once somewhere in an initialising event, and then in my function try to do m_pConn.Open, it throws an exception, but the errors collection is empty, plus its not a com error. SO at my wits end I tried this and it worked> technically my first try should work, but it would open the conn once successfully, then even if I closed it, it wouldnt open it a second time!
I have to be 100% sure about a potential leak here though. Makes me nervous.
Thanks for responding,
ns
|
|
|
|
|
If the CreateInstance was successful, Close the connection then Release m_pConn1.
Jason Henderson quasi-homepage articles "Like it or not, I'm right!"
|
|
|
|
|
This is a smart pointer, right? Doesn't calling release on a smart pointer crash the app?
Just wondering, 'cause I think I am right, but if I'm mistaken I need to be corrected.
|
|
|
|
|
No way! I call Release (mysmartp.Release()) all the time without crashes. All it seems to do is release the m_pInterface member and set it to null.
However, after looking at some MS examples, all they do is set the smart pointer equal to null.
What should actually be done here?
Jason Henderson quasi-homepage articles "Like it or not, I'm right!"
|
|
|
|
|
Can anyone answer Jason's question? I have found that when I call Release() my app crashes but I have huge memory leaks too?
What is the correct way to clean up the smart pointer?
|
|
|
|
|
I still don't know for sure, but I think just setting it to NULL works.
"Live long and prosper." - Spock
|
|
|
|
|
Im about to start a major GU Idevelopment and I was hoping that you all could share some suggestions for Third-Party Tools.
Drop A link in this thread and tell me what toolkits you have used for things like:
Socket Communications
Secure Communications (SSL / Certificates?)
Cross-Platform GUI Development (GUI Toolkits like Qt)
Data Visualization (Graphs, Trending)(SPecifically Trending Graphs (Like Task Manager -> CPU Usage)
Drag-and-Drop
Look-and-Feel Widgets (XP Style)(Ulitmate Toolbox)
It would be nice to have a list of all the tools out there. Im Wondering what everyone uses.
Ryan Baillargeon
Software Specialist
Fuel Cell Technologies Inc.
|
|
|
|
|
This question is related to TCP socket server. Suppose client and server are running on different machines of the network. What happens if the client machine improperly shutdown or its network cable is removed. Is there any way that server determine that the client socket is no longer valid ????
|
|
|
|
|
You can use a timeout period. If the server does not receive a message from the client within an alloted time period then you can shutdown the socket.
Or you can use a "PING" method along with the timeout. The server can send a message to the client (or client to the server) every once in a while in a "You there?" "Yes I am here" fashion.
Ryan Baillargeon
Software Specialist
Fuel Cell Technologies Inc.
|
|
|
|
|
I believe when you do a read in this case, it will return ERROR immediately.
|
|
|
|
|
The server socket returns an error, and if you use async socket you get an "event" when it happens.
TCP is a "connected" socket, so you'll never be able to send to a not connected socket when using TCP...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
|
Hi!
I'm using the new Visual C++ .NET controls which allow to edit and create HTLM document (CHTMLEditCtrl class).
Is it possible to obtain the text from the control without formating and without HTML tags?
For example, obtaining "Texte" from Texte.
Thks in advance!
Appstmd
|
|
|
|
|
Use XML/XSL technologies. You may be able to load the HTML into a DOMDocument. If u can then extract the information.
|
|
|
|