|
I tried that, and I get nothing. I've based this on a port of the NeHe basecode to SDL, and even though I can see no differences in the method of either code, mine doesn't work.
I tried calling gluLookat(), I tried translating the geometry to be in front of the camera, i tried making the backcolor something other than black, nothing works.
|
|
|
|
|
I didn't really looked at your code but I just want to let you know that there is probably a better alternative to SDL: take a look at SFML[^]. It's a more modern library which is similar to SDL but is fully object oriented (and much more efficient too). I suggest you take a look at the features page.
|
|
|
|
|
Hi all,
i m create a odbc connection and use access database.
when i create MFC ODBC Consumer class its derived from CRecordset class.
when in thread i open and close multiple times the crecordset class its crash,and some times its becomes slower.
please help me for this.
and tell me how can i use more efficiently the Crecordset class.
thank in advance.
|
|
|
|
|
Post a code snippet on how you open and close your record set. Omit code that is not not part of the problem. From your description it sounds like you are not closing your record set correctly.
|
|
|
|
|
Ctest* test_sett = new Ctest;
if ( !test_sett->IsOpen() )
test_sett->Open();
while ( !test_sett->IsEOF() )
{
test_sett->MoveNext();
}
if ( test_sett->IsOpen() )
test_sett->Close();
delete test_sett;
|
|
|
|
|
I'm thinking you should focus on getting the database-related code working first before introducing multiple threads to the mix.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Greetings!
We have been trying to track down errors that in our application that happen at random times on our customer's Windows Server 2003 system, and the only thing we know about them is the memory address given in an Application Popup event in the system event log. We do not have any application error events corresponding to these messages.
I found that Dr. Watson was disabled on their machine, so I enabled it. To test it, I wrote a quick application that will try to divide by zero or to write to memory address 0x00000000. In both cases, a message box should be displayed should the program get past the error statement. When I ran the program on their system, I was very surprised to see that neither error generated any kind of response! I did not get the infamous "Your application has encountered a problem and needs to close" box, I did not get any messages in any event log, and the messages after the errors happen did not appear. The application just silently ended.
Is there some setting someplace in Windows Server 2003 system that controls whether or not errors will result in user notifications or log messages?
Thanks very much!
RobR
|
|
|
|
|
|
When is an MFC application fully realized?
---
I've got an MFC application A that creates a new MFC dialog application B with CreateProcess.
When application B is created, A looses focus and I need to have A reclaim the focus.
I've tried a few different things but none seem to be working.
I create the process like this:
if( CreateProcess( NULL, cCommandLine.GetBuffer(), NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &si, pi ) )
{
WaitForInputIdle (pi->hProcess, INFINITE);
return (pi->hProcess);
}
After that, I tried individually or mix'n'match between them:
mainframe->SetFocus();
mainframe->ActivateFrame();
mainframe->PostMessage( WM_ACTIVATEAPP, TRUE, 0 );
mainframe->PostMessage( WM_ACTIVATE, TRUE, 0 );
I even tried sending (HWND_BROADCAST) a message from B to A at the end of B's OnInitDialog, but maybe it's too early in B life-time to broadcast that message.
- Am I missing something ?
- Can A reclaim itself the focus ? or re-activate itself without user intervention ?
- When is B fully realized and ready so I can broadcast a message back to A ?
Thanks.
Max.
Watched code never compiles.
|
|
|
|
|
Maximilien wrote: When application B is created, A looses focus and I need to have A reclaim the focus.
How about letting B's user interface not claiming the focus in the first place? For example by setting your starup info si.wShowWindow to value SW_SHOWMINIMIZED or SW_SHOWNOACTIVATE (see MSDN). Now it depends on B and no need for more inter process communication.
Hope it helps!
|
|
|
|
|
Moak wrote: SW_SHOWNOACTIVATE
Thanks for the info ..
I tried doing this with a simple dummy project and it does not work, B (the secondary application) is still active after the CreateProcess.
// for the sake of experimenting, created a simple MDI application (A) and a simple dialog application (B)
void CMainFrame::OnOpensubOpen()
{
PROCESS_INFORMATION pi;
ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
STARTUPINFO si;
CString cCommandLine=_T("C:\\Users\\me\\Documents\\B\\Debug\\B.exe");
ZeroMemory( &si, sizeof( STARTUPINFO ) );
si.cb = sizeof( STARTUPINFO );
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_SHOWNOACTIVATE;
if( CreateProcess( NULL, cCommandLine.GetBuffer(), NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi ) )
{
WaitForInputIdle (pi.hProcess, INFINITE);
}
}
The SW_SHOWNOACTIVATE (or SW_SHOWMINNOACTIVE or SW_SHOWNA ) does not work, the B application is still activated when started up;I've been able to "make it work" by using SW_MINIMIZE (doc says it will activates the next top-level window in the Z order).
Maybe I'm not certain what is active or not when a new UI process is created; When I create the process B, A is active, so if be is launched with the SW_SHOWNOACTIVATE flag, A should not be de-activated ?
Thanks again, still looking into this.
Max.
Watched code never compiles.
|
|
|
|
|
You can check application B if you have something similar to ShowWindow(m_nCmdShow) in your source code, here you can handle SW_SHOWNOACTIVATE in a special way (e.g. by not calling ShowWindow). Otherwise you can try to dig deeper and check where the focus change or dialog activation comes from (e.g. window message WM_ACTIVATEAPP ).
Happy debugging!
|
|
|
|
|
I think that sending an HWND_BROADCAST message from the OnInitDialog of your B application is too early, because when it's called the window has not already shown, then your A application has not loosen the foucs yet.
You can try to send the same HWND_BROADCAST message the first time the OnActivateApp or the OnShowWindow is called in your B application.
|
|
|
|
|
An application cannot directly make itself the foreground app; only the active application can do that.
However, there are some fun tricks like having application B make application A the foreground app.
Another method is to attach to the foreground application:
DWORD foregroundProcessId = GetWindowThreadProcessId(::GetForegroundWindow(), NULL);
DWORD curThreadId = GetCurrentThreadId();
AttachThreadInput(foregroundProcessId, curThreadId, TRUE);
ShowWindow(hWnd, SW_SHOW);
BringWindowToTop(hWnd);
SetActiveWindow(hWnd);
SetForegroundWindow(hWnd);
SetFocus(hWnd);
AttachThreadInput(foregroundProcessId, curThreadId, FALSE);
|
|
|
|
|
If I have an CScrollView with few lines , rectangles and other , can I move scrollbar with mouse due the mouse is within client area ? Something like acrobat reader sheets , when the mouse cursor is hand , on OnLButtonDown mouse pointer change to 'MoveHand' cursor and OnMouseMove move scrollbars ?
|
|
|
|
|
Yes, you could, but you have to write all the required code: provide an "hand" mode and change the cursor when that mode is active, then handle the WM_LBUTTONDOWN , WM_MOUSEMOVE and WM_LBUTTONUP to do it.
Basically, in the WM_LBUTTONDOWN message handler you have to set a flag that mean dragging and save the cursor location and the scrollbars position; in the WM_LBUTTONUP you have to reset the dragging flag. Finally, in the WM_MOUSEMOVE you have to test the dragging flag, and if it is set, set the scrollbars position to obtain a shift of your view that correspond to one that the mouse has been moved.
|
|
|
|
|
Thank you Viti . I develop this [^] project , that have implement all things that you said ... but I don't know how effectively move scrollbars considering mouse position on client area ... do you know some sample code ?
|
|
|
|
|
Try this article[^] from Microsoft, and refer to the IntelliMouse panning implementation.
|
|
|
|
|
Thanks again Viti , is not like what I want but from this sample I learn very much !!!!
|
|
|
|
|
I did it :
void CDragSheetView::OnLButtonDown(UINT nFlags, CPoint point)
{
m_point = point;
m_bMouseCapture = TRUE;
SetCursor(AfxGetApp()->LoadCursor(IDC_CURSOR_HANDMOVE));
SetCapture();
CScrollView::OnLButtonDown(nFlags, point);
}
void CDragSheetView::OnMouseMove(UINT nFlags, CPoint point)
{
if(m_bMouseCapture)
{
CPoint ptScroll = GetScrollPosition();
if(m_point.x < point.x)ptScroll.x -= (point.x - m_point.x);
if(m_point.x > point.x)ptScroll.x += (m_point.x - point.x);
if(m_point.y < point.y)ptScroll.y -= (point.y - m_point.y);
if(m_point.y > point.y)ptScroll.y += (m_point.y - point.y);
ScrollToPosition(ptScroll);
m_point = point;
}
CScrollView::OnMouseMove(nFlags, point);
}
|
|
|
|
|
I am trying to migrate our application to VS 2010, but ran into a roadblock concerning CodeJock's TookitPro libraries:
it appears the newest purchasable versions do not work with VS 2010! I've downloaded the trial from the newest build which does support 2010, but I found the trial libs/dlls have been compiled with compiler options that are incompatible with our application. Thus I would need to change the ToolkitPro project settings and manually rebuild it.
Only - there are no ToolkitPro project files!?
I contacted CodeJock Support, tried the forums, and the phone, but no responses in 3 days time - for all I know the company might not exist anymore.
Since CodeJock can not or will not help, is anyone here who has an idea what to do, i. e. how to get or maybe even create a project file that I could adapt to compatible settings and create a lib/dll that work with our application?
|
|
|
|
|
What version of Codejock ToolKitPro are you running?
We had issues with 9.7 (yeah I know its as old as the hills) under VS2010 as it docking windows wouldn't work as there has been a change in MFC.
To make it work you can change the VC toolkit your project is compiled against (this is found in the C++ section of your project), however this will mean it builds as a VS2008 project in real terms...
Alternatively take a look at this post I got back from the forum that will help (and it took over 6 months to get this reply)...
Forum Post[^]
|
|
|
|
|
Thank you for your suggestions.
Regarding version I am not sure where to look that up. The lib is named ToolkitPro1113vc71U.lib, so maybe it's version 11.13 (?), compiled with VC 7.1 (VS 2003.NET). The 'U' indicates unicode character coding. The header files are dated from march 2007 and contain a 2007 copyright notice, but I didn't spot a version number there.
The trial version is ToolkitProEval1341vc100UD.lib, so that would mean version 13.41 ?
Our VS 2010 application does use the newer version (I deleted the libs and dlls of the older version to make sure it does) and it does compile, but not link.
What I need is a version that works with VS 2010 and is compiled with /Zc:wchar_t- . The trial version is compiled with /Zc:wchar_t+ .
|
|
|
|
|
We did play around with 13.xx trail versions back in January and haven't gotten any further than you and management have deemed it unimportant for the time being, we also found Codejock somewhat unhelpful when asking for assistance.
However the earlier versions do work and if you apply the fix suggested at the bottom of the forum post I included and you'll have the same functionality as you had previously.
Obviously if you have a need for more advance functionality then I'm affraid I can't help further...
|
|
|
|
|
Thanks, I might give it a try. Unfortunately this may not be a good solution though, since our main reason for switching to VS 2010 is taking advantage of the various parallel programming libraries, and I'm not at all sure which of these are being supported with VC9
|
|
|
|