|
Roger,
I'm pretty sure that FindWindow will return a valid hwnd for any window currently in the zorder. You need only pass the window title to the function to return the hwnd.
Check the docs or search msdn for FindWindow.
Good luck,
Frank
|
|
|
|
|
The windows I am mostly working with are child windows with no title. I noticed the FindWindow function takes one of two parameters, class name or window name. What do you do if you do not have a title for the window? How do you find the class name?
|
|
|
|
|
You can use Spy++ to retrieve the class name. It should have been installed with VC++ 6. Spy will allow you to select a window to "spy" and then it will give you all the relevant information about that window.
You can also use spy to "spy" on window messages. Nice utility.
Frank
|
|
|
|
|
Thank ya much, never used Spy++, could be a neat adventure.
|
|
|
|
|
When using Spy++ I can find the correct dialog, but all of the dialogs that are open have the same classname, #32770 (that is the classname for ALL dialogs on the application). How do I differentiate between thm when using FindWindow and using the class name parameter?
|
|
|
|
|
Hello,
I think you are on the wrong track with FindWindow.
Why don't you just store the pointers to the ChildWindows in a nice collection class (e.g. in the parent or in your application object) when they are created, and remove them when you destroy them. You can even make them searchable on a particular key (hey, you are the boss, so you decide what the key should be).
Then don't use (p_whatever)->SendMessage(...); // p_whatever is a pointer to a CWnd
but use
HWND theWindow = (p_whatever)->GetSafeHwnd();
if (theWindow != NULL)
{
SendMessage(theWindow, ...);
}
or better use PostMessage.
better still when sending messages to other threads use
PostThreadMessage.
Don't over-complicate things...
|
|
|
|
|
Thanks for the advice, I am currently using PostMessage back to the main window then handling messages from there. Although your advice sounds very interesting about storing them as they are created. It is nice to be the boss and be able to do it how you want isn't it, THANKS!!!
|
|
|
|
|
Notice that in his original question he did not specify that the dialogs he is trying to find were created by him. Since they are, GBO's suggestion is more relevant. This is what happens when questions are not clear.
|
|
|
|
|
Environment: VisualC6.0, no MFC.
How can I assign (eg. F9,F10,F11,F12) hotkeys to select a page on tabcontrol independently? (I'd like to add PgUp-next page and PgDn-prev page, but if anyone can help me, I'll able to do it)
Any help and sourcecode will be appreciated greatly.
---
AkelA
|
|
|
|
|
This seemes easily ehougn done. I'd like to know if there is a class (custom or standard) for accessing Serial ports nearly the same as Socket ports. Once opened and initialized, the reading/writing/closing is nearly the same. The socket has to be able to be a server socket as well, supporting binding and waiting of incoming connections.
Does anyone know of such a class?
|
|
|
|
|
Anyone know how I can find what the path name for "My Documents" is? For the windows and windows/system directory I can use GetWindowsdirectory etc, but what about the "My Documents" directory.
Thanks for any help at all.
Jerry
|
|
|
|
|
isn't it along the lines of
<windowssystemdirectory>\profiles\<username>\My Documents
?
Stephen
|
|
|
|
|
Call SHGetSpecialFolderLocation() and pass it CSIDL_PERSONAL . If you know your target systems will always have the Active Desktop shell, you can use the easier SHGetSpecialFolderPath() API instead.
|
|
|
|
|
|
I have a problem It is About an MSDN sample DBMON.
I will describe the problem irrelative to DBMON and will be
hoping for a generic if not specific answer.
DBMON captures outputdebugstring generated by different processes.
I have implemented it over a network using DCOM. where the ouput
generated by DBMON is seen on client machine through connection points.
It captures OutputDebugString from the processes of that machine in
two scenerios only
1 >>.> If the user on the client machine (where the user is calling DBMON
on the server) is in the local administrator group of the server
machine.
2 >>.> If both user on the server and client machines are same ( I mean
same users not same group ).
There is one another strange thing going on that if the
server process on the server machine itself generates any
outputdebugstring it captures it (only)also irrespective of the
above two conditions. (Does it mean that the remote process
originated by client runs under clients security context .... ?
At least the second situation above have made me think about that )..
---------------- NOW -------------------
I only need a mechanism by which if i can only give the user an option
to connect remotely from one of its local administrator group members
if he is not in first or second situation. I no a password and login
name window will do the trick but donot know how to transfer the access
rights of the currently login client to the one provided in the window
by the client to logon remotely....
If I could just do that................
|
|
|
|
|
I have little problem... i want to create dlg based on HTML, but i encountered problem. In mshtml.dll is function called ShowModelessHTMLDialog, but i cant find any informations concerning it (no, ShowHTMLDialog wont help
Anyone knows how to use it? Or maybe anyone know for any source of html viewer that could be used without restrictions (copyright, etc.)?
|
|
|
|
|
Hi,
Hope this is the right place to post this question.
I'm writing an add-in in the MSVC++ 6.0 Environment.
In the add-in I write to the 'macro' tab of the output window( The window where the build info, search info, etc. is displayed.). The content that is written to this window is in the format of the error messages generated by the VC6 compiler. This helps to go to the source line where the error has occured.
My problem is that I wish to read from the macro tab of this output window the content of the error message (viz. error number, error description etc.) from the add-in code.
Is there any way I can do it? It is easy to write to this window as an API(PrintToOutputWindow) in the IApplication class is provided. didn't find anyway to read from it.
Can anyone help me?
Thanks in advance.
Achyut.
|
|
|
|
|
>> In the add-in I write to the 'macro' tab of the output >> window
If YOU are writing to 'macro' tab I think you can analyze that text immediately
Or you want to get something else?
Mike.
|
|
|
|
|
thanks for replying.
Yeah, I can do that then and there. But since I write the warnings generated by compiler to the 'macro' tab, I click on them later when I browse thru each warning. So I want the info of the warning I click on (rather doubleclick on).
Is that possible?
-Achyut
|
|
|
|
|
Standart macros window allow you to open any file at any line.
As I understand you want something more.
I think you can spend several days and write code that subclass macros window, then catch doubleclick, then find selected line, then...
I think you should make your own window with your design.
And in that window you can do anything you like.
Mike
|
|
|
|
|
Has anyone successfully used ICM? I’m trying to write some color correction software using ICM and am running into what appear to be major bugs. I have the same software running on the Macintosh with ColorSync (the Macintosh equivalent of ICM) very well. If anyone does know ICM I’d really like to hear what you think of the following problems:
Originally, my calls to TranslateColors would often crash. I was passing arrays of the ICM COLOR structure along with pixel counts. After hours of pouring through all code and documentation, I debugged into ICM's 80x86 assembly code and found that it
expects 16 bytes per pixel. The COLOR structures are only 8 bytes per pixel so this doesn't make any sense. I can work around this immediate problem by allocating twice as much space for my buffers as necessary but this is a strong warning sign that either I’m doing something seriously wrong or that the current release of ICM isn’t usable.
My image comes through roughly correctly which indicates that I’m formatting my pixel data as ICM is expecting it. However I often get strong bizarre casts in the images I get back from TranslateColors. Especially when going from CMYK to RGB, the images look terrible.
Is anyone aware of sample code that uses TranslateColors?
Is anyone aware of free software that will use ICM (preferably through TranslateColors) on an image?
Are there any other Internet resources for ICM development?
Thanks,
Kurt
|
|
|
|
|
Hi!
I wonder how to get the parent process of a child process.
My problem is that when the father accidently dies - the son should too.
thanks, peters
|
|
|
|
|
http://www.codeproject.com/threads/interprocesssync.asp
|
|
|
|
|
hi , i am very new to programming hook function and creating dll . I need to know how to use this sysmsgfilter hook function to detect wm_paint message for all active application so that i can detect when an active application refreshes its screen. I know i need to write this into a dll but dont how to do it.
|
|
|
|
|
Hi,
You need to write this into a dll. Here is an example that implements keyboard hooks. Yours is similar. You can modify this:
<br />
<br />
#include "stdafx.h"<br />
#include "SystemHook.h"<br />
#include <stdlib.h><br />
<br />
#define ID_CMD_KEYPRESSED WM_USER+200<br />
<br />
HWND ghWndMain;
static HHOOK hHook;
static BOOL bHookInstalled;
<br />
HINSTANCE ghDLLInst;
<br />
<br />
<br />
BOOL APIENTRY DllMain( HANDLE hModule, <br />
DWORD ul_reason_for_call, <br />
LPVOID lpReserved)<br />
{<br />
switch (ul_reason_for_call)<br />
{<br />
case DLL_PROCESS_ATTACH:<br />
case DLL_THREAD_ATTACH:<br />
case DLL_THREAD_DETACH:<br />
case DLL_PROCESS_DETACH:<br />
break;<br />
}<br />
ghDLLInst=(HINSTANCE)hModule;<br />
return TRUE;<br />
}<br />
<br />
<br />
SYSTEMHOOK_API int nSystemHook=0;<br />
<br />
SYSTEMHOOK_API int fnSystemHook(void)<br />
{<br />
return 42;<br />
}<br />
<br />
CSystemHook::CSystemHook()<br />
{ <br />
return; <br />
}<br />
<br />
SYSTEMHOOK_API LRESULT CALLBACK KeyboardProc(<br />
int code,
WPARAM wParam,
LPARAM lParam)
{<br />
if (code>=0) <br />
{<br />
if(HIWORD(lParam) & 0x8000) <br />
{<br />
if(!GetKeyState(VK_RMENU))<br />
{<br />
HWND h=::FindWindow(NULL,"WinScheduler");<br />
PostMessage(h, ID_CMD_KEYPRESSED , wParam, lParam);<br />
}<br />
else<br />
{<br />
}<br />
}<br />
}<br />
return (int)CallNextHookEx(hHook, code, wParam, lParam); <br />
}<br />
<br />
SYSTEMHOOK_API int WINAPI InstallHook (HWND hWnd, BOOL bCode )<br />
{<br />
int nReturn = 1;<br />
ghWndMain = hWnd;
<br />
if (bCode == bHookInstalled) <br />
return 0; <br />
<br />
if (bCode) <br />
{ <br />
hHook=(HHOOK)SetWindowsHookEx(WH_KEYBOARD,(HOOKPROC)KeyboardProc,ghDLLInst,0); <br />
if (!hHook) <br />
return 0; <br />
bHookInstalled = TRUE; <br />
} <br />
else <br />
{ <br />
nReturn = UnhookWindowsHookEx(hHook); <br />
bHookInstalled = FALSE; <br />
} <br />
return nReturn; <br />
}<br />
<br />
#ifdef SYSTEMHOOK_EXPORTS<br />
#define SYSTEMHOOK_API __declspec(dllexport)<br />
#else<br />
#define SYSTEMHOOK_API __declspec(dllimport)<br />
#endif<br />
<br />
class SYSTEMHOOK_API CSystemHook {<br />
public:<br />
CSystemHook(void);<br />
};<br />
<br />
extern SYSTEMHOOK_API int nSystemHook;<br />
<br />
SYSTEMHOOK_API int fnSystemHook(void);<br />
<br />
SYSTEMHOOK_API LRESULT CALLBACK KeyboardProc(int code,WPARAM wParam,LPARAM lParam);<br />
SYSTEMHOOK_API int WINAPI InstallHook (HWND hWnd, BOOL bCode );<br />
Mustafa Demirhan
|
|
|
|