|
In Windows, the EXE file is mapped as virtual memory. The os loader and other parts of the os perform this task. The idea of running a program from memory, even if it could be done, would be meaningless.
Not worth spending time over. Remember, using this technique, you could bypass some anti-virus programs, but the good ones out there will catch it anyway...
Bikram Singh
|
|
|
|
|
Greetings All,
I've been burning up all of my time over the past two days trying to debug this. Please help!
I've written a DLL that creates a modeless dialog (in this case allowing the user to watch an aiming video image of a Laser Tracker.) This DLL is used by various client applications including my test app.
I need the user to be able to use the arrow keys to "jog" the Tracker from the dialog. Also, all of the normal dialog keyboard control needs to work (tabbing, typing into CEdit boxes, etc.)
At first, I couldn't even get key messages in the dialog...as soon as a key was pressed (with focus on the dialog), the message came to the client app. I found a way to fix this from MS' website involving having the app call a FilterDLLMsg() func from its PreTranslateMessage(). However, now when a key is pressed in the dialog, the dialog and app freeze.
I spent a long time tracing this freeze and it seemed to be freezing around the MFC code for _AfxFindNextMnem. I was stumped and thought it had to do with a tabstop or group setting for my dialog controls. Then I tried changing the m_pMainWnd = &dlg; line in my client application's InitInstance() to m_pMainWnd = NULL; . (It's a dialog based app.)
That corrected the freeze problem, but now any AfxMessageBoxes() I call from my client app seem to belong to the desktop instead of the main app dialog. There may be other, more serious, ramifications, but I haven't tested any further.
So, I don't want to change the m_pMainWnd = &dlg; if I don't have to, but for now, it's the only way I've found to keep the DLL/app from freezing. Is that safe? I'd prefer a different solution.
Has anyone out there ever seen this type of behavior? Any ideas? My brain is getting all mushy as I haven't made much progress on this
Thanks,
Justin
|
|
|
|
|
If your problem is AfxMessageBox(), dont use it. Use
MessageBox(dlg,"some text",0,0) instead.
The desktop is the parent of the Message Box bcos MFC probably uses the m_pMainWnd, which you set to 0, as the first param to the MessageBox() function.
I dont know why the dialog should freeze, cos i havent tried it yet.
Bikram Singh
|
|
|
|
|
I am using TrackPopupMenu to display a dropdown menu from a toolbar button that has an arrow on the right side. Things are working as I expect. The menu is basically a list of items that my user checks on/off. Someone in the office has seen an application where you can click an item in a menu and the menu stays open so the user can "select" multiple menu items and then click off of the menu to close it...they now want this in my app.
Any ideas on how to keep the menu from closing after someone makes a selection?
thanks in advance
cje
|
|
|
|
|
You could try setting a WH_GETMESSAGE hook using SetWindowsHookEx() and intercept WM_LBUTTONDOWN ?
Bikram Singh
|
|
|
|
|
Hi
I need to figure out a way to communicate with an A/D converter and send and receive data bytes from the PC.
Any suggestions and comments are appreciated.
Thanks.
JB
|
|
|
|
|
What is the interface in use? USB/ParPort/Serial...what?
If serial/parport, take a good look at the CreatFile() function in MSDN.
Bikram Singh
|
|
|
|
|
Dear Bikram
thanks for your reply. I will refer to the CreateFile() function.
I am using a parallel port interface and linking the A/D converter to the PC through a SCSI cable.
thanks
JB
|
|
|
|
|
I have bunch of files in *.cpp format ( written in VC++). Presently i read the data from a text file and run the program. I want to make a GUI ( using MFC or anything else) so that user can enter the data in the GUI and hence the program reads it from there..
Please give any suggestions and ways to do it..
|
|
|
|
|
ummm probably wanna go with MFC...create a dialog based app add text boxes or whatever and goto town...
Cheers
How do I print my voice mail?
|
|
|
|
|
Hi,
I'm a newbie working on an MFC app which needs to display a simple text file of results. I have searched google as well as codeproject, but am stumped as to how i can do this.
I am guessing i'll want to derive a class from CRichEditView, and add the text from there, but how do I add text?!
If anyone has any tips, or places i could look for an answer, it would be greatly appreciated.
Thanks,
Mike
"I bet Einstein turned himself all sorts of colors before he invented the light bulb." -- Homer J.
|
|
|
|
|
How do you want to display your results...? What kind of results are they?
It would probabbly be much easier to dump your result to a listbox than using a rich edit.
How do I print my voice mail?
|
|
|
|
|
It's just a text file created by our backend that lists concentrations of different elements.
I want to display them similar to notepad, where the user can scroll up and down, to review, and print if desired.
listbox, eh? I'll look into that.
thanks.
mike
"I bet Einstein turned himself all sorts of colors before he invented the light bulb." -- Homer J.
|
|
|
|
|
mike-o wrote:
I am guessing i'll want to derive a class from CRichEditView, and add the text from there, but how do I add text?!
Assuming the text is in a variable (e.g., CString ), you can simply call the rich edit control's SetWindowText() method.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Ah, that sounds like a good plan.
thanks!
mike
"I bet Einstein turned himself all sorts of colors before he invented the light bulb." -- Homer J.
|
|
|
|
|
And you have not found my article http://www.codeproject.com/file/textfile.asp[^]? Shocking!
The class contains a member Load that directly loads the contents of a file to an edit control (or a listbox). And here ones takes time to carefully craft and upload code...
|
|
|
|
|
Hello dear programmers,
You can see me as a beginner, actually I know only what I need to know to make an application in Visual C++. I'm having an OOP problem using MFC now.
I give you a peace of code here so you know what I mean.
But first my question: My purpose is to make pointer to a class. For example, in my clientsocket Clisocket I want in my constructorparameter a pointer to the class CSockCliDoc. In a sample code wich it works fine, it is like this:
#include <wcesock.h>
class CSockCliDoc;
class CCliSocket : public CCeSocket
{
// Attributes
public:
// Operations
public:
CCliSocket(CSockCliDoc *pInDoc);
virtual ~CCliSocket();
// Implementation
protected:
private:
CSockCliDoc *pDoc;
};
What I don't understand is the second line:
class CSockCliDoc;
What is the purpose of this part of code . I know that if you want to create a new class, you begin with "class whatever" and than "{the rest of the code for wathever it is};"
Can anybody help me to understand why the second line is needed?
Thank you very much, I'm sorry for my bad English, I'm from Holland.
|
|
|
|
|
Anonymous wrote:
class CSockCliDoc;
class CCliSocket : public CCeSocket
{
CSockCliDoc is an ahead declaration. It means "I'm going to use a pointer to CSockCliDoc in the class declaration below, but I've not declared the class itself here. It is defined elsewhere."
Anonymous wrote:
Thank you very much, I'm sorry for my bad English, I'm from Holland.
That's not an excuse, you're supposed to speak good English there
|
|
|
|
|
Thanks Johan ,
But that "ahead declaration" is that a standard C++ technique, or do they use it only in MFC?
Can you give me some links where I can get more information about ahead declaration?
I'll do my best to speak english well
|
|
|
|
|
|
Forward declaration is standard, at least in all of the C++ compilers I've used. It has nothing to do with MFC.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
You need to click faster
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
Wow guys,
You are wonderful, you are really great helpers!!
Thank you very very much and may God bless you!
Peace!!
|
|
|
|
|
Hai all,
I am doing a project involving graphical drawings.
In my project, I add every drawn elements in a pointer list.
And, while drawing a new element ie on every mouse move, i redraw all the elements in the pointer list and draw the current elements with the new coordinates.
This slows down my application.
I tried Double buffering and XOR techniques but in vain.
Is there any other way to draw an element without disturbing other drawn elements?
Please help me.
With Thanks,
Arun Chakaravarthy
|
|
|
|
|
While dragging, you might want to try to invalidate only the original and new positions of the object(s) moved in the window - this way you redraw just a part of the screen.
You could also try to analyze what the bottleneck might be. I'm redrawing all of the screen in my vector editor http://www.codeproject.com/miscctrl/diagrameditor.asp[^] Hm, it starts to sound like I'm shamelessly plugging for that beast... Anyway, feel free to take a look at it and its' sibling http://www.codeproject.com/miscctrl/flowcharteditor.asp[^] - both redraw all objects as soon as one is moved, and neither of them displays any dramatic performance problems. They double buffer, btw.
If you are shuffling bitmaps, you might have another situation, but make sure that the access to the objects is as simple as possible, and that it is the drawing itself that is the problem, before you start optimizing the drawing rect.
|
|
|
|