Do you need to translate sentences or just individual words? If you need to translate sentences, you'll need to develop an understanding of the grammatical syntax of the language (simple things like putting adjectives before or after nouns need to be sorted out). If you need only to translate individual words, you're basically just going to effectively be looking it up in a database of some kind and replacing the text with whatever you have in your database.
the_augy
Posts
-
to anyone who knows... -
Program hangs when focused...Well, I've found that the dialog WILL in fact refresh itself if there's something new to display. For instance, if I'm debugging in visual studio, and I insert a breakpoint before a statement that does something to one of the controls in a property page (like,say, add a string to a listbox), the dialog refreshes itself without any problems. But if I'm debugging and I look at my source code and then try to look back at the window, I get the hang I was talking about before.
-
Program hangs when focused...I have a dialog-based MFC application. I create a prop sheet, add some pages to it, and display it. Everything works fine at first, but if I move focus away from the dialog (like alt-tabbing to another window or clicking on another window), if I try to view my application again it hangs. However, it will ONLY hang if I interact with the prop sheet (tab control) window. I play around all I want with dialog controls that aren't in the prop sheet or its prop pages, but the minute I touch anything having to do with the prop sheet, the dialog will hang in the manner I just described. Some other random things I've noticed: 1) If I do anything with the prop sheet (even something as simple as switch tabs), then move focus back to the main dialog by clicking one of the non-propsheet controls, the program will still hang when it gets focus back. 2) The program works perfectly fine while as long as it has focus. It's just when I switch to another window and then return that it hangs. 3) If I hit break in VC++6 while the program is hung, 99% of the time the message that my window is attempting to handle is WM_ACTIVATE (surprise surprise). Here's my main dialog's OnInitDialog function:
// make our tab control m_PropSheet = new CPropertySheet("Project Manager"); m_ThreadProperties = new ThreadPropertiesPage; m_PropSheet->AddPage(m_ThreadProperties); m_TestSpec = new TestSpecificationPage; m_PropSheet->AddPage(m_TestSpec); m_MapProts = new MapPrototypes; m_PropSheet->AddPage(m_MapProts); m_PersistPage = new PersistPage; m_PropSheet->AddPage(m_PersistPage); m_ProjViewPage = new ProjectViewPage; m_PropSheet->AddPage(m_ProjViewPage); m_ProjViewPage->SetPMDlg(this); m_PropSheet->Create(this,WS_CHILD,NULL); m_PropSheet->SetWindowPos(NULL,10,27, 750,300,NULL); m_PropSheet->ShowWindow(TRUE);
Nothin' much there. Thanks much for your help. -
Compiles fine, then doesn't...Well, here's the thing. I creating my classes in a project that was just a console application, then I made the MFC project for the demo. I moved all the files from the console application project into the MFC project folder, and when I tried compiling it didn't work, i got the errors listed. All the same stuff is included. I'm guessing there's a project setting somewhere that gets set one way for console and another way for MFC projects, and I need to switch it.
-
Compiles fine, then doesn't...Alright, I wrote a wrapper class for expat (the XML parser). I wrote it in a console application project, it compiles fine, and still does. But then I had to demo the technology that uses the wrapper class, and for that I went with an MFC application. But when I try to compile in my wrapper class, the expat .c files give me hundreds of errors. here's a chunk of it to look at: c:\program files\microsoft visual studio\myprojects\testrunfortestbed\xmltok_impl.c(91) : error C2143: syntax error : missing ')' before '*' c:\program files\microsoft visual studio\myprojects\testrunfortestbed\xmltok_impl.c(91) : error C2143: syntax error : missing '{' before '*' c:\program files\microsoft visual studio\myprojects\testrunfortestbed\xmltok_impl.c(91) : error C2059: syntax error : 'type' c:\program files\microsoft visual studio\myprojects\testrunfortestbed\xmltok_impl.c(92) : error C2059: syntax error : ')' c:\program files\microsoft visual studio\myprojects\testrunfortestbed\xmltok_impl.c(129) : error C2143: syntax error : missing ')' before '*' And here's some code so you can have a little context for the errors:
///////////// LINE 89 HERE //////////////////////////// static int PREFIX(scanComment)(const ENCODING *enc, const char *ptr, const char *end, const char **nextTokPtr) { if (ptr != end) { if (!CHAR_MATCHES(enc, ptr, ASCII_MINUS)) { *nextTokPtr = ptr; return XML_TOK_INVALID; } ptr += MINBPC(enc); while (ptr != end) { switch (BYTE_TYPE(enc, ptr)) { INVALID_CASES(ptr, nextTokPtr) case BT_MINUS: if ((ptr += MINBPC(enc)) == end) return XML_TOK_PARTIAL; if (CHAR_MATCHES(enc, ptr, ASCII_MINUS)) { if ((ptr += MINBPC(enc)) == end) return XML_TOK_PARTIAL; if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) { *nextTokPtr = ptr; return XML_TOK_INVALID; } *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_COMMENT; } break; default: ptr += MINBPC(enc); break; } } } return XML_TOK_PARTIAL; }
I'm pretty stumped. Anybody know what the problem is? -
mfc mysteriesI'm loading: advapi32.lib So, this isn't the issue.
-
mfc mysteriesI have an executable file which was compiled in debug mode. When I run it in debug mode, I get an error message before the code even seems to execute (InitInstance on my CWinApp class doesn't even get called). The error message says: "C:\path\to\filename.dll" File not Found. This filename.dll is the output from another project I have, but the 2 projects are unrelated. If I run the same exeutable file in non-debug mode, then there are no issues like this. Does anybody know why my application might be trying to link up with this filename.dll ? Does VC++ have someplace where it keeps the list of DLLs it tries to link with at runtime? Any and all help appreciated.
-
default dialog color?Exactly what i needed. Thanks =]
-
default dialog color?How would I go about retrieving the default dialog background color?
-
getting colors in bitmaps...I'm trying to use CBitmap to manipulate a bitmap, but there's no easy way for me to extract a color from a bitmap (like GetPixel(x, y) in CWnd-derived classes). Is there something I'm missing? Suggestions are well appreciated. Alternatively, is there a way to fill a bitmap with one color like FillRect() does with DCs? thanks, augy
-
Change Icon of exeoooooh. How does explorer decide what icon to display? It will automatically pull the main window's icon out and use that as the display icon, at least if it's compiled in MFC (or MFC is packaging the EXE with explorer information in it). Short answer: no f*ing idea. augy
-
Change Icon of exeWell, not using MFC, you can set your icon when you register your window class with WNDCLASSEX
WNDCLASSEX wc; wc.hIcon = LoadIcon(HandleToYourInstance, "IDI_YOURAPPICON");
There are a couple other things in WNDCLASSEX that you can set to customize your program. In MFC, go to your CWnd class's constructor and initialize the m_hIcon member:m_hIcon = AfxGetApp()->LoadIcon(IDI_YOURAPPICON);
Voila. augy -
Change Icon of exeAre you coding with MFC or not?
-
MFC threading issue...I've stepped through my code very carefully, and I'll describe exactly what happens. Here is the high level of the code that I'm debugging. BeginInterfacing() is the function that creates the child thread which plays the animated gif file, and EndInterfacing destroys it. This code is all happening within an event handler from a dialog.
m_pParent->BeginInterfacing(); m_pID->GetWindowText(m_pParent->m_strName); m_pPass->GetWindowText(m_pParent->m_strPass); m_pParent->m_strName.Remove(' '); m_pParent->m_pSub = new CSubscriber(m_pParent->m_strName); if (!m_pParent->m_pSub->VerifyPassword(m_pParent->m_strPass)) { m_pParent->EndInterfacing(); MessageBox("Invalid Password", "Invalid Password", MB_OK|MB_ICONSTOP); delete m_pParent->m_pSub; m_pParent->m_pSub = NULL; return -1; } m_pParent->EndInterfacing();
If I step over BeginInterfacing, no dialog box comes up and none of my breakpoints are triggered (I have them in Run(), EndInterfacing(), and DoModal() of the dialog box that the child thread creates). I can step through until the linem_pParent->m_pSub = new CSubscriber(m_pParent->m_strName);
When I try to F10 over this line, my breakpoint in Run() of my CWinThread class is triggered:int CInterface::Run() { m_pD.DoModal(); if (m_pParent) m_pParent->PostMessage(WM_KILLINTERFACING); return 0; }
m_pD is the dialog that will loop the gif file. Next, I step into DoModal....if (hWndParent != NULL && ::IsWindowEnabled(hWndParent)) { ::EnableWindow(hWndParent, FALSE); bEnableParent = TRUE; } TRY { // create modeless dialog AfxHookWindowCreate(this);
At the line ::EnableWindow(hWndParent, FALSE), execution seems to switch back to where it left off in the top level function, andm_pParent->m_pSub = new CSubscriber(m_pParent->m_strName);
gets executed next. In fact, execution never returns to where it left off in DoModal() (or any other part of the child thread) until much later, where it goes right back to bEnableParent = TRUE and then creates the modal dialog box normally, but of course it does this at a time I can't pin down and so I have this modal dialog box looping a gif without any way to stop it, so I have to CTRL+ALT+DEL the program, or stop debugging. The thing I would really like to figure out is why the thread stopped where it did (in the middle of DoModal) and then decided to start back up again when the main thread isn't doing any process -
MFC threading issue...I am trying to pop up a dialog to loop a gif image while my program does processing work. The problem is, the thread I'm creating doesn't pop up as soon as it's created, and placing breakpoints in InitInstance and ExitInstance reveals that they aren't being called when I call my CWinThread-drived class's CreateThread() method. What explanations exist for this behavior? I have tried versions of my CWinThread class which do and don't override the Run() method. It's a very simple problem which hopefully has a very simple solution =] I found an article[^] on code guru that deals with my exact issue. I've tried to imitate the behavior of my code to match the article's code as much as possible, but I still cannot get the thread to work. Here is the .cpp file of my CWinThread class, CInterface
IMPLEMENT_DYNCREATE(CInterface, CWinThread) int CInterface::ExitInstance() { return CWinThread::ExitInstance(); } BOOL CInterface::InitInstance() { return TRUE; } void CInterface::KillInterface() { if (m_pD.m_hWnd) { m_pD.PostMessage(WM_COMMAND, IDCANCEL); } } int CInterface::Run() { m_pD.DoModal(); if (m_pParent) m_pParent->PostMessage(WM_KILLINTERFACING); return 0; }
Any ideas? Thanks alot, augy -
afxloadlibraryHmmm, didn't fix it. The errors were the exact same. Does anybody know what header file afxloadlibrary is declared in? augy
-
afxloadlibraryI'll try it =] augy
-
afxloadlibraryafxloadlibrary doesn't want to compile in my program. I'm writing and MFC app, and if I compile with the line: hLibrary = AfxLoadLibrary(pathtodll); I get a compiler error that AfxLoadLibrary is an undeclared identifier. If I use the global namespace, like so: hLibrary = ::AfxLoadLibrary(pathtodll); I get the error that AfxLoadLibrary isn't a member of the global namespace. The documentation says that AfxLoadLibrary IS a member of the global namespace, and if you type ::, when VC++ generates that LONG list of functions in the global namespace, AfxLoadLibrary DOES show up on that list. What's the deal? How do I get it working? Thanks, augy
-
How does this happen?Interesting. I figured as much, but I didn't know that the debug version would change runtime behavior THAT much. Anyways, I do check the HINSTANCE immediately afterwards for a NULL value, before any GetProcAddress() calls, hence my utter confoundment. After running it a few times, the problem has gone away (but without ANY change in the DLL loading code), and my simple check on the HINSTANCE ptr seems to catch it. Why or how this changed, I still haven't got a clue; I was using the debug version.
-
How does this happen?I'm writing an application that loads a DLL midway through execution (it's a wizard). When I debug my program and step through the lines of code which load the DLL, I get a null pointer back and my error handler catches it just fine. But that's not my issue--the issue is, when I run the exact SAME executable file but I don't do it in debug mode, the program experiences a runtime error, presumably from trying to get functions from an invalid HINSTANCE pointer with GetProcAddress, which I do right afterwards. How is it possible for the same code to experience different behavior? Has anyone else run into this? I also see runtime differences between the debug and release versions of my code. Any ideas? Thanks alot, augy