I am working with MFC.
I am loading an external DLL using LoadLibrary and call a function within this DLL.
This function opens a dialog box and this dialog box has several controls.
I have the HWND and ids of the dialog box and controls.
I want to register to the getFocus event of one of the controls (On runtime).
I was looking for a long time and couldn't find any helpful function or example, could any one help ?
what are you exactly trying to achieve by registering for onfocus()? afaik every control is derived from CWnd and every CWnd receives a WM_SET_FOCUS event when it receives a focus. if your control is child of dialog and you dont want to override the default class of control, then maybe you need to check whether your dialog received the WM_SET_FOCUS when one of its child gets the focus as a dialog can never have focus - only its child can have focus.
And if you can get the setfocus function call, you can easily signal your main application from the dll.. or not??
There is the login dll of windows GinaDLL.dll
In this DLL there is a function that opens a dialog box for entering the login username and password.
I want to use the functionallity of this DLL and not override the whole DLL.
I want to know when the user is typing in the username edit box and when he is typing in the password edit box.
Since this is an external dll, I can't use the DECLARE_MESSAGE_MAP, BEGIN_MESSAGE_MAP and END_MESSAGE_MAP macros.
I dont know of any simpler way than using CFileFind::FindFile to enumerate through all files, find if they are image files and then if they are then extracting the bitmap from them using Gdiplus and then storing that bitmap for subsequent display.
hehehehe.. who knows he may have something better to say about my approach and in criticizing or approving that, he may arrive at better solution. moreover, i am trying to bring spiritual touch to my programming skills and I believe that our inner soul knows all the answers. only they need to be brought to surface. glad you appreciate it.
It's returning NULL in pMainWnd ...
If this is the case I have get the main window handle...
hMutex = CreateMutex(NULL,TRUE,TEXT("vision client"));
if(hMutex == INVALID_HANDLE_VALUE)
AfxMessageBox("Unable to create Mutex");
AfxMessageBox("Application is already Opened !!!");
The above code will ristrict the application to open mutliple instances.And it gives the message like "Application is already Opened !!!" . and closes the second instance[_exit(0)].
Instead of giving message I have to activate (maximize)the application if user clicks again on the application icon.
haha.. so that is the problem.
how about using FindWindow() function? Inside the MainFrame::OnCreate, give a name to your window using SetWindowText and then you can use FindWindow to find the window that matches the name you gave earlier. that is one of the ways.
SetWindowText("My magic window");
If mutex already exists,
HWND hWnd = FindWindow(NULL, "My magic window")
if(hWnd && ::IsIconic(hWnd))
//maximize or restore it
//bring it to top or set it as foreground window
I have created an application in VC++ using VS2008 in a development machine which runs on Vista, now i need to run that application in a target machine which runs on windows XP SP2 which does not have vc++ dlls or any thing.
i need a help for redistributing the dependent dlls for the application so that it should run well in target machine.
this is the manifest file created for the application ...