|
I want to get text data from another program by this function.
::SendMessage(hwnd,WM_GETTEXT,0,(LPARAM)pchData)
So,I need hwnd of destination Edit Ctrl, but I don't know how to get it.
Please help me to solve this problem
|
|
|
|
|
If you have the handle of the parent window, then you can use EnumChildWindows to search for the EDIT one.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
If the target application is always the same, you may use Spy++ to identify your editbox.
Otherwise, ChildEnumWindow is a possibility, but then you will need another way to check if the returned handles are really these you awaited (maybe IsKindOf ?)
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
Do not feed the troll ! - Common proverb
|
|
|
|
|
I think your answer is EnumDesktopWindows
|
|
|
|
|
If what you need is to retrieve the content of an edit control from another application, you can't. GetWindowText can retrieve only a caption (if any) from a window owned by another process.
Since an edit control does not have a caption, you'll retrieve a null string. Otherwise, one could easily read a password from a password edit control.
It could be possible to use an injection in the process, using VirtualAlloc and VirtualProtect, inject code in the target executable, allocate a buffer in the other executable' space, call there the WM_GETTEXT (in that exe) and then pass back to your exe the content of the buffer (IPC, MapViewOfFile, your choice). This is the way to retrieve, for example, the content of a listview (a lot of times I saw people asking how to read the content of OE list). I don't know the technique in detail, I just saw it once - but I think you have already the information to start looking for. Good luck.
|
|
|
|
|
How would I get the full path of where an application is saved and started from in a C++ application??
|
|
|
|
|
User GetCurrentDirectory()
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
GetCurrentDirectory can be different many times, like depending on the parent process currentdirectory, or "Startin Folder" of a short cut or how setcurrentdirectory() etc
|
|
|
|
|
And why do you say this to me?
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
brahmma wrote: And why do you say this to me?
You suggested to use GetCurrentDirectory() for retrieving the application path.
|
|
|
|
|
The question itself is not very clear. See here[^] And so did I suggest GetCurrentDirectory(). If you were *of any help* to the person who asked the question, go tell him what you know.
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
brahmma wrote: The question itself is not very clear. See here[^] And so did I suggest GetCurrentDirectory().
Whichever way you interpret the question, your answer would not work. Do not expect to getaway after posting wrong answers in public forums.
brahmma wrote: If you were *of any help* to the person who asked the question, go tell him what you know.
The right answer was already posted and voted see here [^] so i did not want to repeat the same answer.
|
|
|
|
|
suhredayan® wrote: Whichever way you interpret the question, your answer would not work.
Huh? GetCurrentDirectory() does return the current directory. I have not suggested anything wrong. GetCurrentDirectory or GetModuleFileName, or even something else; depending on the user's need he has to choose what he wants.
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
Some times what you need is
GetModuleFileName .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Wheres this program when you run your project or when a program is running?
|
|
|
|
|
I don't understand what means "path where application is saved".
If what you need is the folder from where application was started, use GetModuleFileName(NULL) or GetCommandLine to retrieve the full exe path and then PathRemoveFileSpec to get only the path.
GetCurrentDirectory can be altered during program execution (not to mention that the application itself can be configured to run in other directory than the directory where the application resides).
|
|
|
|
|
To get complete path of the current application....
TCHAR szPath[MAX_PATH];
GetModuleFileName(AfxGetApp()->m_hInstance, szPath, MAX_PATH);
Use CreateProcess() to start an application.
|
|
|
|
|
i have fetch two values duration and bitrate from the .wmv file header.
for duration i am using the GetTimeFormat.is it ok?
that values get into following datatypes
1)duration in QWORD. i have convert it into WCHAR.
2)bitrate in DWORD. I have convert it into WCHAR.
suppose the DURATION = 389660000 it will display in hh:mm:ss format like 00:00:10
bitrate = 103080 it will display in Kbps or Mbps.
amit
|
|
|
|
|
The timestamps in WMVs are generally in 100ns units.
Divide by 10000000 to get seconds, divide seconds by 60 to get minutes, etc...
Mark
|
|
|
|
|
Hello. I'm having a problem instantiating a COLeVariant object. The
snippet of code that fails is:
void CMyDoc::CreateIEObject()
{
m_pIE = new CWebBrowserApp; // this is a COLeDispatchDriver
derived class... GOOD
m_pIE->CreateDispatch("InternetExplorer.Application"); // GOOD
COLeVariant noArg; // this does not work // BAD!
m_pIE->Navigate("www.yahoo.com", noArg, noArg, noArg, noArg); //
BAD!
m_pIE->SetVisible(TRUE); // GOOD
}
The function is supposed to instantiate an IE browser and go to the
webpage specified in Navigate. I get the following compile errors:
: error C2065: 'COLeVariant' : undeclared identifier
: error C2146: syntax error : missing ';' before identifier 'noArg'
: error C2065: 'noArg' : undeclared identifier
I have included in <afxdisp.h> file.
I have verified that COLeVariant is defined in afxdisp.h. What could I be
doing wrong?
manu
|
|
|
|
|
manu_2205 wrote: COLeVariant noArg; // this does not work // BAD!
Because , it must be COleVariant not COLeVariant .
|
|
|
|
|
On previous message he writes COleVariant
|
|
|
|
|
i changed COLeVariant to COleVariant
Still now it generate compile time error.
manu
|
|
|
|
|
manu_2205 wrote: Still now it generate compile time error
What ? Is the error same as above ?
|
|
|
|
|