|
Thanks for ur reply.
My reqest is not selecting a submenu. I want press a button control in another apllication Dialog
Sethuraman.K
|
|
|
|
|
Yeah I understood it was for example.
if you have handle to that program you can use of this code for get handle to other controls on that forum and then send your message to a control.
for(CWnd* pWnd = needsto handle; pWnd;pWnd = pWnd ->GetNextWindow())
{
pWnd ->GetWindowTextW(str);
}
|
|
|
|
|
you must get the control id first. to get control id, you can use FindWindow and GetDlgCtrlID()...
then:
HWND hWnd = FindWindow(....);
::SendMessage( hWnd, WM_COMMAND, nButtonID, 0 );
|
|
|
|
|
Send WM_COMMAND message to the parent of the button, and set the WPARAM and LPARAM as follows
wparam = MAKEWPARAM( <id of="" the="" button="">, BN_CLICKED );
lParam = (LPARAM)<handle of="" the="" button="">;
|
|
|
|
|
Hi all,
There is a api which is used to find files inside the folder/Directory. Can anybody please tell me that api name.
Thanks in advance
|
|
|
|
|
Use CFile .
Make object of CFile and using that object open a file with file name. If File exist than it returns nonzero otherwise it will return zero.
Regards,
Manish Patel
|
|
|
|
|
You can use CFileFind(MFC) or WIN32_FIND_DATA(WIN32).
Amar
|
|
|
|
|
FindFirstFile .
Regards,
Paresh.
|
|
|
|
|
|
if u want to find exact file in a folder,
CFileFind finder;
finder.FindFile(_T("c:\\test.txt"));
if u want to find all file in a folder,
CFileFind finder;
BOOL bWorking=1;
while(bWorking)
{
bWorking=finder.FindNextFile();
TRACE("\n%s",(LPCTSTR)finder.GetFileName());
}
Sethuraman.K
|
|
|
|
|
Hello All,
I am developing Client server based Application.
for accepting multiple clients i am using CreateThread method.
Now problem is that if it accept connection from one client and doing nothing then also it requires some memory. But when client disconnects it is not freeing up that memory so as a result if multiple client connects multiple times then application will go in large memory usage and it is not reliable.
Anybody tell me what can i do so that i can free that memory.
Thanks in advance
Manish Patel
|
|
|
|
|
This isn't a problem we can solve for you. It seems obvious that you're not shutting down your thread and it's related data when the connection is terminated.
What are you doing when the connection is terminated?
But, I'll add another comment unrelated to your question. People often think that creating a thread for each connection is a good thing. It's OK if you want to handle a few connections... But if you want actual performance, you should find a way of aggregating your many connections to a small pool of threads....
The best performance for this -- is something called I/O completion. It's a method which let's you treat network communications as events. It's not simple, but it will maximize your performance in a server. You can handle a few hundred connections with just a few threads....
Though, one more thought. Servers based on windows suck....
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</A>
|
|
|
|
|
How can i create hundred connections with few thread?
Provide any example. I dont know how to create it.
Manish Patel
|
|
|
|
|
|
Peter Weyzen wrote: This isn't a problem we can solve for you. It seems obvious that you're not shutting down your thread and it's related data when the connection is terminated.
What are you doing when the connection is terminated?
When connection is terminated i am simply returning from the thread method.
Manish Patel.
B.E. - Information Technology.
|
|
|
|
|
I falsely assumed that you were allocating stuff in the connection....
How are you determining that memory is not being freed?
Is it possible that your method for determining this is flawed?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</A>
|
|
|
|
|
The key of the table is time. The is table is like
time price
2007-01-01 10.00
2007-01-02 11.00
group like this (every 10 records)
group 0: 1st 2nd ...
group 1: 11th 12th ...
group 2: 21st 22nd ...
...
Now I want to get the sum of the first record of continuous groups, for example, 10 groups, so the values are from
records: 1st 11th 21st ... 91st
Is there any efficient way?
Thanks very much.
|
|
|
|
|
Does anyone know of an application or source code that can be used to walk down all the tree of all windows in a program?
I'd like to write some test code that runs at my program's exit that visits all the windows in the program and prints information about those windows -- for example:
1. print the resource id of the window
2. print the window text (or small part there of)
3. if the window is a dialog, frame, etc, visit the sub-windows thereof and repeat the above
I'm interested in doing some automated testing understand that the task of filtering windows from the list may be really high.
Thanks,
Lowell
|
|
|
|
|
There are win32 and MFC api's to get the top level window and to get a windows children. Combine those with some recursion and you'll be well on your way
|
|
|
|
|
You can use of EnumWindows for all top-level windows when you have handle to window you can use of other APIs.
|
|
|
|
|
Thanks for the hints! I was hoping to find some utility program to help me, but I guess I'll just have to roll up my sleeves and get to work.
thanks!
Lowell
|
|
|
|
|
I like Winspector[^]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</A>
|
|
|
|
|
I've got a piece of software written by someone in my department years ago. (IE, I have no access to the source nor do I have a developer I can contact.) The problem is that this piece of software outputs information to a log.txt file that I would like to read in real time (in a console window) because when the program crashes the file stream gets closed before it can write its buffer to the actual file leaving me with 0kb log files, awesome.
My initial thought on how to do this is to first inject my own .dll in to the program (using InjLib). I could then use my own .dll to redirect any calls to CreateFile where the filename is log.txt to a new file stream. I thought at first I could just pass back a pointer to stdout, this obviously resulted in whatever was going to log.txt to write to the console window that the program already has open. This might work if the program wasn't already dumping alot of info. to that console. So I thought maybe I could create a second console window. Knowing that each .exe file can only have 1 open console I searched around code project and found a multiple console opening program that uses pipes. Here is where I am stuck. I know that fprintf writes to a buffer. The only way my 2nd console gets updated is when the original program closes the file stream. I've tried created a pipe with no buffer and hardware write through but to no avail.
I guess my question is: Is there a simpler way of redirecting a file stream to console window? Or, if not, is there some way for me to read from the buffer fprintf uses? I've tried using PeekPipe on my pipe but it doesn't see anything.
I'm not exactly sure what code snippets would help in my explanation.
modified 28-Aug-18 21:01pm.
|
|
|
|
|
How about trying to trap the file write operations and instead of redirecting them to a console window, calling flush to force the buffer to the file.
|
|
|
|
|
That's an idea but real-time access to the debugging information would be more helpful.
modified 28-Aug-18 21:01pm.
|
|
|
|