|
|
CmyView base on CEditView class, that not support funtion .SetSel() and .ReplaceSel()
|
|
|
|
|
You'll need to call GetEditCtrl() first.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Hi,
I have an application running and I have created a modeless dialog box, named it Log window.
I need this dialog to display in it's edit box, all the log information that the actual application sends.
eg:
The actual application opens files, writes to it, closes it.
The log windows should print "File opened succesfully", "abcd data written to file", "File closed" etc.
With whatever info I have, I think I will create some thread which will continuously read a global CString and keep updating the edit box in log window. But, will this slow down the application as the thread is continously reading the string.
Another option is to call a update_log() function after each operation and this function updates the log.
These are just ideas and I am not very sure of how to implement these or anything better.
Is there a better method . how ??
please help!!
- KK
|
|
|
|
|
Hello.
I suggest you do like this:
Prepare the text line (to be logged) in your main program.
Send it to the modeless dialog by means of a SendMessage-command.
Set the message ID to something higher than VM_USER, in order to aviod conflict with the ordinary Windows messages.
Track that message ID in the modeless dialog and display the text.
|
|
|
|
|
""Prepare the text line (to be logged) in your main program"" - OK
""Send it to the modeless dialog by means of a SendMessage-command."" - not familiar with SendMesage - will find out.
""Track that message ID in the modeless dialog and display the text."" - How. Should some thread be running to display the meesage whenever a new message comes?
- KK
|
|
|
|
|
As far as i understand if u want to have
every minute update in the Log Screen (dialog)
then u need to have a dedicated thread working
behind it .
A thread wont be so costly for this work just
u need to suspend the thread for some small time
if it aquires more resources.
else SendMessage is fine
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
Hello.
I assume your modeless dialog has got a Windows message loop.
If that's the case, then the logging text will come as a message in the standard message loop.
So all you have to do in the modeless dialog, is catch the specific ID (the ID you gave when you sent the logging message), get the message and then display it.
There is no need for an explicit thread in your modeless dialog.
I'm sure it will get clearer as you investigate the SendMessage func.
Unfortunately, I don't have the time to give you an example.
But search in CP for SendMessage, I'm sure you will get a lot of hits on the subject.
Good luck.
Kakan
|
|
|
|
|
I got it working. Thanks a lot.
BTW, in class wizard, I could not see OnMessage(). I had to type manually in MesageMap. Why ?
- KK
|
|
|
|
|
Great! That's the way to do it.
I don't know why MS have hidden OnMessage in ClassWizard.
Keep up the good programming!
Kakan.
|
|
|
|
|
kk_vp wrote: BTW, in class wizard, I could not see OnMessage(). I had to type manually in MesageMap. Why ?
Probably because the message you wanted to process is unknown to ClassWizard.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Can anybody tell me how can i acces the first bytes at the entrypoint of an exe. I know the PE layout, format, but i don't know how i can translate the entrypoint to fileoffset and HOW i read those bytes?
I'm waiting for any kind of suggestion (or sample code).
|
|
|
|
|
What are you trying to accomplish by modifying an EXE directly?
I can't think of a valid reason for doing so, especially wanting to modify the entry point. Your post (and the previous one) sounds like you want help writing a virus.
Software Zen: delete this;
|
|
|
|
|
I want to write a tool like PEid's PE signature viewer. A tool for compiler detection (by signature bytes).
|
|
|
|
|
Does this tool detect the compiler or the linker?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
this tool will try to detect the compiler (and the cryptor or exe modifier)
|
|
|
|
|
I know the linker writes information to the EXE that can be retrieved, but are you sure that the compiler does too?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
I only know that every exe has a signature bytes at the entrypoint of the exe. (i mean that the first 128 bytes at the entrypoint are the signature bytes, they help to identify the compliler). And these signature bytes are modified by the protectors, packers.
|
|
|
|
|
zooley wrote: Can anybody tell me how can i acces the first bytes at the entrypoint of an exe.
HANDLE hFile = CreateFile(..., GENERIC_READ, FILE_SHARE_READ, ...);
DWORD dwRead;
BYTE byte1, byte2;
ReadFile(hFile, &byte1, 1, &dwRead, NULL);
ReadFile(hFile, &byte2, 1, &dwRead, NULL);
...
CloseHandle(hFile); zooley wrote: ...but i don't know how i can translate the entrypoint to fileoffset...
What exactly do you mean by this?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Any suugestions all welkomed. Thanx!
|
|
|
|
|
zooley wrote: Any suugestions all welkomed.
What's wrong with the one I offered?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
it is good, thanx for it.
|
|
|
|
|
I am trying to incorporate headers from one program into another. The host program compiles fine until I add my stdafx.h which includes:
#include afxwin.h // MFC core and standard components
#include afxext.h // MFC extensions
#include afxdisp.h // MFC Automation classes
#include afxdtctl.h // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include afxcmn.h
//(syntax edited for posting)
it then generates errors such as these in which there seems to be an ambiguity between winsock.h and winsock2.h:
c:\Documents and Settings\Brenaman\Desktop\UAV Simulator\use\SourceCode\use_ios\Globals\globals_socket_ext.h(13): error C2146: syntax error : missing ';' before identifier 'socketData'
c:\Documents and Settings\Brenaman\Desktop\UAV Simulator\use\SourceCode\use_ios\Globals\typedefs.h(41): error C2501: 'gameport::capability' : missing storage-class or type specifiers
c:\Documents and Settings\Brenaman\Desktop\UAV Simulator\use\SourceCode\use_ios\Globals\globals_socket_ext.h(15): error C2501: 'recvSockAddr' : missing storage-class or type specifiers
I've tried various things:
#define _WINSOCKAPI_ in various places to disinclude winsock.h in windows.h.
Editing windows.h to include winsock2 instead of winsock.
Various #include sequences.
Thank you in advance for any help.
- Chris
|
|
|
|
|
Did u try changing the seqence of the include fine
i also faced the same problem with the socket file,
i dont remeber what i did to solve the problem but
the stdafx if defined before the winsock header file
I have declared the Objects of winsock as global variables.
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
As a rule, you don't #include stdafx.h in other .h files; you just make it the first #include in your .cpp files.
DON'T modify windows.h . Ever. Millions of people use it, as-is, perfectly successfully without editting it.
Take a look at the winsock samples to see what you're doing wrong.
Software Zen: delete this;
|
|
|
|