|
Its because your mixing crappy old MFC CString and lovely new STL, you naughty boy you.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Hello i was told to look here for something that would convert a VC++ 7.10 Project to a VC++ 7.0 project can anyone help me ???
|
|
|
|
|
|
Hi,
I'll try to explain my problem in as few words as possible so I won't scare anyone off with long posts
Mission :
I'm working on a hobby-project to render graphics that change with user-input.
Problem :
GfxObjects can be deleted/changed, but *during* rendering that's a big NONO as you'll probably understand
Possible solutions :
- Multithreading.
Tried it, it's a very big pain in the arse.
GfxObjects could be plugins with their own imported edit-dialogs and I don't want other developers to have the burden of doing locking / unlocking everywhere (and give'em a perfect opportunity to crash my app).
- Singlethreaded :
OnIdle is fine, it's just not enough.
F.e. when the mouse enters the menu, idling stops.
Same for window-resizing etc.
The ideal way would be :
{
ProcessUserInput( [for a maximum time of 1/100th sec.] );
RenderFrame();
}
I hope some of you guys have suggestions on how to tackle this
-
Lennart Denninger / GameCoder / Guerilla Games
|
|
|
|
|
Well like it or not I think you need to use the multithreading approach to get the result you want. One interuptable thread for rendering, and UI back in the main app thread.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
I know...
But it would be nice to have a way to lock the object-system before all the ui-handling and unlock it afterwards.
Just like locking it before rendering and unlocking it after rendering.
Locking / unlocking for every single change sucks,
it means that for someone to write a plugin with an edit-dialog the code would look like this :
CEditDlg::OnVar1Changed()
{
LockObjectSystem();
// change var here
mObject->SetVar("General.SplineSegments", 10);
UnlockObjectSystem();
}
I'd prefer something like
{
LockObjectSystem();
UpdateALLDialogsAndSettings();
UnlockObjectSystem();
}
'cause in this case the people creating plugins wouldn't need to know about all the locking-stuff, and more important - they wouldn't be able to send my app down in flames by simply forgetting to lock/unlock.
|
|
|
|
|
Why can't you collect the info they enter in the plugin and then apply it when the plugin finishes. This puts you in total control and you can handle any locking required.
Can't say I comprehend precisely what you are getting at with locking, but I assume you only want one user/thread/plugin to be able to change objects at a time.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
A message-based system like you propose has crossed my mind (and I even started implementing it),
but it seems like an overly complex solution to a very simple problem
Then I'd have create a message-system that handles a lot of different (custom) messages,
lock/unlock a message-queue etc....
If only there was a way to
1st) update the UI and thus the gfx-object parameter changes
2nd) render the frame
where the rendering would be virtually uninterrupted, and the UI would be allowed to have some lag...
The plugins don't "finish" by the way;
it's a normal app with an edit-window for the configuration of the selected effect (selected from a listcontrol in another window).
So the render-thread is rendering non-stop,
and meanwhile the user can change effect-properties in the UI.
(Think of a winamp-plugin with a realtime edit-window)
Still, right now I'm thinking of going back to the multithreaded system..
But then I still want to find a way to make sure the plugins can't crash the app.
Which means taking the locking/unlocking out of their hands - but I still have to find an elegant way to do that :-/
|
|
|
|
|
Forgot to mention this :
The (plugin)edit-dialog also has to display the current values for all the effect-parameters.
Which would mean for a message-based system like you proposed (gathering all entered data and processign it later),
that the message-system has to be bidirectional.
(Since you're not only inputting new values, but also *reading* them from the object)
And that's a whole different, (imho way *too*) complex ballgame.
Ps.
I don't want to disrespect you or anything,
(I really value your input on my problem !!)
but your signature looks really
"Hey! look at me! I'm a professional developer!"
flashy kind of thing
Isn't it a bit too much..?
|
|
|
|
|
Is it feasible to have two instances of the "object system". One is used by the renderer and the other by the UI components. Whenever the renderer has finished etc. it asks the UI object if it has changed, and if so it copies whatever it has to, to get in sync. A lock would only be necessary during this sync process.
re. my signature, you should have seen it a year or so back. I'm open to suggestions to tone it down further?
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Neville Franks wrote:
I'm open to suggestions to tone it down further?
I don't have a problem with it at all
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Ryan Binns wrote:
I don't have a problem with it at all
Thanks, I thought it was reasonably tame.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Hi, all:
I have an odd problem that I have been experiencing. I create a simple Dialog-base application and then add two buttons to it. Each button click calls creates a MODELESS dialog. I have a big OK button on each dialog and the OK button overlaps some. If I set both modeless dialog style in Resource Editor to Popup, everything works fine. If I change the style to Child, then the problems come in. Click on Button 1 to create Dialog Num1. Click on OK button on Dialog Num1 , the button on the main dialog gets the click, seems like the MODELESS dialog is behind the main dialog, even though visually it is on top. Also, Click on button 1 to create Dialog Num 1 and then click on Button 2 to create Dialog Num 2. If I don't move the dialogs, when I click on the OK button on Dialog Num 2, the message for button clicking goes to Dialog Num1 which is create first and underneath of Dialog Num2. It seems that Dialog Num 1 is on top of the Dialog Num 2, even though visually otherwise. Another issue is when those dialog get moved, the redraw does not work correcly. I tried use SetWindowpos with WndTop or WndTopMost, it does not affect the result. I try to use MoveWindow, SetFocus, same thing.
Is this a MFC bug, or simply the MODELESS dialog can not have Child style.
Any help or suggestion is highly apprecaited. thanks in advance.
Dion
|
|
|
|
|
DionChen wrote:
Is this a MFC bug, or simply the MODELESS dialog can not have Child style.
A modeless dialog can have a child style. It is kind of hard to follow your explanation but I can say that I have experienced some problems with modeless dialogs. However, you should use the pop-up style which is used for dialog boxes. Since you don't have any problems with the pop-up style then why do you worry so much?
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
Is there a good quality SDK out there that someone could recommend to enable me to print PDF files from within my C++ application? Adobe doesn't provide me a way to set printer tray information (pass in a DEVMODE structure) and they frequently popup dialogs. I've found a ton of PDF SDK's out there, but none of them have a good set of printing functions. I need the ability to specify a printer and tray and know that no message boxes are going to pop; since this will run as an engine application. Thanks, Ron.
|
|
|
|
|
I'm working with dialog boxes for the first time in .net, and I can successfully show a dialog box from a starting dialog, but the second one always has additional Ok and Cancel buttons pasted into the upper right corner and the phrase "TODO: Place controls here." None of these things appear in the form editor. Anyone know how to get rid of them?
|
|
|
|
|
Null Monkey wrote:
Anyone know how to get rid of them?
You mean, is there an option to get rid of them? If that's your question, then my answer would be no. But if you just want to remove them from the dialog box, just click on the buttons and then hit delete. But I don't think this is your question.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
I've since stumbled accross the answer, but the problem was that I had already deleted those things, and at run time they would re-appear, (and they seemed to be kinda angry that I tried to delete them.) It turns out that apparently dialogs, at least in the version I'm using, are created with an html background that occasionaly, but not always contains the accursed two buttons and static text string. I just deleted the body of said html file and they went away...
|
|
|
|
|
I just realized that you were talking about .net. I don't have that platform, so my reply is irrelevant. Sorry about that.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
Hi,
I am getting link error when I complied a program from Microsoft SDK that used PSAPI. I could not figure out whats going on and I tried using unicode and ANSI flags in link settings. No luck. Can someone help me out please? Here is the code
#include <windows.h>
#include <stdio.h>
#include <psapi.h>
void PrintProcessNameAndID( DWORD processID )
{
char szProcessName[MAX_PATH] = "unknown";
// Get a handle to the process.
HANDLE hProcess = OpenProcess( PROCESS_QUERY_INFORMATION |
PROCESS_VM_READ,
FALSE, processID );
// Get the process name.
if (NULL != hProcess )
{
HMODULE hMod;
DWORD cbNeeded;
if ( EnumProcessModules( hProcess, &hMod, sizeof(hMod),
&cbNeeded) )
{
GetModuleBaseName( hProcess, hMod, szProcessName, sizeof(szProcessName) );
}
else return;
}
else return;
// Print the process name and identifier.
printf( "%s (Process ID: %u)\n", szProcessName, processID );
CloseHandle( hProcess );
}
void main( )
{
// Get the list of process identifiers.
DWORD aProcesses[1024], cbNeeded, cProcesses;
unsigned int i;
if ( !EnumProcesses( aProcesses, sizeof(aProcesses), &cbNeeded ) )
return;
// Calculate how many process identifiers were returned.
cProcesses = cbNeeded / sizeof(DWORD);
// Print the name and process identifier for each process.
for ( i = 0; i < cProcesses; i++ )
PrintProcessNameAndID( aProcesses[i] );
}
Link Errors:
Linking...
ProcessInfo.obj : error LNK2001: unresolved external symbol _GetModuleBaseNameA@16
ProcessInfo.obj : error LNK2001: unresolved external symbol _EnumProcessModules@16
ProcessInfo.obj : error LNK2001: unresolved external symbol _EnumProcesses@12
Debug/ProcessInfo.exe : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.
ProcessInfo.exe - 4 error(s), 0 warning(s)
I am using Windows 2000 Professional SP4 and VC++ 6.0 with SP5. I got this sample from Platform SDK under PSAPI. Please help me out. I am lost.
Thanks in Advance,
Anil
|
|
|
|
|
Are you linking with psapi.lib?
Add the following statement to your cpp file.
#pragma comment(lib,"psapi.lib")
John
|
|
|
|
|
Hi John,
Thank you very much . It worked.
Anil
|
|
|
|
|
you need to link with psapi.lib. add it in the link settings.
|
|
|
|
|
Hi,
I have a basic HTML Browser built using the MFC Wizard. I am having a page where I have a set of images. On clicking the images, I am changing the title through Javascript.
Now in my HTMLViewerView.cpp, I override OnTitleChange to actually open up in full view the image clicked on. However, even navigate doesnt seem to work in OnTitleChange. Here's my code snippet...
void CMFCSlideViewerView::OnTitleChange(LPCTSTR lpszText)
{
CHtmlView::OnTitleChange(lpszText);
AfxGetMainWnd()->SetWindowText(lpszText);
CString title;
AfxGetMainWnd()->GetWindowText(title);
Navigate(_T("http://www.microsoft.com"));
}
Please note, I actually want to navigate to whatever is set in my title. However, even calling a standard URL doesnt work. I dont get any errors, my navigate call just doesnt navigate. Suggestions welcome.
Thanks in advance,
Vish
|
|
|
|
|
I'm looking for documentation of, or a helper library for, BSC files. Does such exsist? I'd like to write a utility that extracts information from the BSC and dumps it to an SQL database, and ultimately create something like LXR for applications built with developer studio.
|
|
|
|