As the title says I am trying to host a .net modeless form inside an MFC dialog. I read the article Using WinForms controls in an MFC dialog[^] but I do not want to do it this was because I do not wish to compile the project that contains the MFC dialog in /clr. So I tried a different path. I created a /clr dll that exports a very simple function
Everything seems to work just fine but after a while I am having a deadlock. The window freezes. After a lot of research on the internet it seems to be a problem with the SendMessage when the child window is created from a different thread. I couldn't find any workarround though. Is there any? Can someone give me a clue?
As far as I recall from my MFC days, a Window's OnDraw() procedure will get called when the dialog closes, so this should happen automatically. Unfortunately that's the part of the code that you did not show us. You may like to add some breakpoints and use your debugger to see the flow of code when the dialog closes.
I debug the whole code by putting breakpoints in all the functions, after closing the dialog, its not going anywhere in the code, remains on the application itself. I am attaching the code herewith. Please download and check.
I never quite placed much attention as to how threads are labeled in the debug display but... does it really matter? A UI thread is really just a label for a thread, it differs only in the extra functionality that comes from the framework around it, so does the label really make a difference? If it works fine why are you worried about the label the debugger is using?
Why are you using CStrings for your data buffers, and why are you trying to convert the file content with wcstombs()? Use the BYTE (unsigned char) type for your data buffer, and read the files in binary mode.
I already told you how to do it. Do not use CString it will not work. And do not convert the file contents, it will leave you with corrupt data. A file is just a stream of bytes and in moving it from one location to another you should process it as such.
I'm hitting a snag as I try to read back an array which has been written to a text file. Here's the relevant part of the code:
printf("Unable to open file.\n");
This is generating an error: [Warning] comparison between pointer and integer.
Though it runs, it is revealing that the break code which checks for a comma is not functioning as the compiler warns. Why is it claiming this is a pointer? Why is it saying anything about an integer when I've deliberately cast k as a character?
Thanks for any input. ------
Update: The problem was solved by: (a) changing the double quotes to single quotes (apostrophes) and (b) switching
below the assignment. In order to match the file derived string with one defined in code I also had to modify it:
as there is something foreign added in the file transfer process. Thanks, and if there is a mark as solved button I couldn't find it
modified 14-Feb-13 16:08pm.
Last Visit: 31-Dec-99 19:00 Last Update: 23-Mar-17 21:19