|
No, I don't know such an application. As far as I understand you tried to do it by yourslef. I also just tried it and for me it works fine (ok, I did it with c++ builder). The main difference to your approach seems to be you send a VK_RETURN while I'm doing SendMessage(xWnd, WM_CLOSE, 0, 0);
I hope it helps
It does not solve my Problem, but it answers my question
modified 19-Jan-21 21:04pm.
|
|
|
|
|
The application itself is super easy to do...
I don't want to close the messagebox, I want to accept it, that's why the VK_RETURN.
It works in my computer without much hassle...
The problem is that my version of visual studio doesn't have the right builder options for Windows XP. That's why I'm searching for an app like that...
|
|
|
|
|
Put your sourcecode in my profile blog. I will try then to make a native W32 for you
It does not solve my Problem, but it answers my question
modified 19-Jan-21 21:04pm.
|
|
|
|
|
Have not seen how to post it in your blog...
Hope you don't mind I post it here:
#include "pch.h"
#include <iostream>
#include <stdio.h>
#include <cstdlib>
#include <windows.h>
#include <winuser.h>
#include <conio.h>
int main(int argc, char *argv[])
{
LPCTSTR windowName = "Pregunta";
int ims = 10000;
if (argc > 1) windowName = argv[1];
if (argc > 2) ims = atoi(argv[2]);
while (true)
{
HWND hHandle = ::FindWindow(NULL, windowName);
std::cout << hHandle;
std::cout << "\r\n";
if (hHandle != NULL)
{
::PostMessage(hHandle, WM_KEYDOWN, VK_RETURN, 0x001C0001);
::PostMessage(hHandle, WM_KEYDOWN, VK_DOWN, 0x00500001);
}
Sleep(ims);
}
} Thank you for taking time to do this!
PS: the compiler must not be set to unicode to accept this as valid.
modified 16-Nov-19 9:17am.
|
|
|
|
|
Hi again
Finally this does the job in my environement
HWND xWnd= FindWindow(NULL, "DlgWnd");
if (xWnd)
{
int xWatchDogCount= 0;
while(xWatchDogCount++ < 10)
{
HWND xOkBtnWnd = FindWindowEx(xWnd, NULL, NULL, "OK");
if (xOkBtnWnd)
{
PostMessage(xOkBtnWnd, WM_KEYDOWN, VK_SPACE, 0);
PostMessage(xOkBtnWnd, WM_KEYUP, VK_SPACE, 0);
}
}
}
It does not solve my Problem, but it answers my question
modified 19-Jan-21 21:04pm.
|
|
|
|
|
@Daniel_Pfeiffer posted how to get modern visual studios to be able to link for windows XP...
I'll follow that advice.
Thanks!
|
|
|
|
|
modified 19-Jan-21 21:04pm.
|
|
|
|
|
Have a look at AutoHotKey, there may be a suitable script.
|
|
|
|
|
|
That's almost the same code I've done...
Mine works perfectly (like yours) but I was not able to put the executable in windows XP...
I've got a suggestion explaining how to get Visual Studio to be able to link for XP.
I'll do that.
THANKS for answering!
|
|
|
|
|
Joan M wrote: The problem is that what is output from my Visual Studio is not compatible anymore with windows xp...
For Visual Studio 2017 or 2019:
- Open the Visual Studio Installer
- Click "Modify"
- Select the "Individual Components" tab
- Scroll down, and select the "Windows XP support for C++" option
This should enable you to target Windows XP (it will appear as a separate option in the list of toolsets)
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
SUPER!
I'll try it thanks!
|
|
|
|
|
|
thank you, I've done a small program after setting the linker to link for XP.
|
|
|
|
|
The output from Visual Studio is compatible with XP when you build with the XP-compatible toolchain.
|
|
|
|
|
Didn't know that, already done, thanks.
|
|
|
|
|
i would prefer to do a prorgram targeted approach... and wrap around the MessageBox* function so the messagebox would never appear at all, and all required would be a change from user32.dll to userMy.dll where userMy.dll i would forward all functions to user32.dll minus the MessageBox ones...
altough its also possible to do by injecting a dll on the process and detouring... and even possible with a global hooking for dialog creation (using the MessageBox template), dont know programs for that
as usually i do more targeted than generic approaches... but imo its very easy to do
|
|
|
|
|
|
There is a registry entry in Windows XP that will automatically click on the default reply for a messagebox.
See Enabling Default Reply
|
|
|
|
|
that logical appeals were more persuasive to people and emotional appeals were more persuasive to my compiler.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Be careful for what you wish
|
|
|
|
|
honey the codewitch wrote: ... and emotional appeals were more persuasive to my compiler. - but then mine would surely hate me for the 'tone' of my 'appeals'.
Message Signature
(Click to edit ->)
|
|
|
|
|
Upsetting your compiler may not be the best thing to do
"Five fruits and vegetables a day? What a joke!
Personally, after the third watermelon, I'm full."
|
|
|
|
|
Deep insight on the plight of the programmer!
|
|
|
|
|
Yeah.
"C'mon, really???"
Would result in the compiler returning "OK, I'll try harder, sorry"
|
|
|
|