<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Enter simulieren]]></title><description><![CDATA[<p>Hallo</p>
<p>Ich hab ein kleines Problem mit dem Programm. Das Programm soll einen Text an eine andere Anwendung schicken und dort absenden. Die Nachricht senden klappt einwandfrei und kommt auch dort an wo sie soll. Das Problem ist jenes, das sich der Enterdruck nicht ausführen läßt bzw keine Wirkung hat.<br />
Das ganze passiert in einen JavaApplet von einem Browser (Zielanwendung). Hier mal der Sourcecode: (Sorry für den schlechten QC, fang erst an mit der API <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /> )</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &lt;cstdlib&gt;
#include &quot;resource.h&quot;
using namespace std;

extern int __argc;
extern char **__argv;

char szCaption[80];
char szTime[10];
UINT_PTR uTimer = 1;

HWND hWndMainWin;
HWND hWndSec;
HWND hWndEdit;

INT_PTR CALLBACK DlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
{
	DialogBox(hInstance, MAKEINTRESOURCE(IDD_BOT), NULL, DlgProc);
}

INT_PTR CALLBACK DlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch(msg)
	{
		case WM_INITDIALOG:
		{
			return TRUE;
		}

		case WM_COMMAND:
		{
			switch(LOWORD(wParam))
			{
				case IDC_GO:
				{
					if(!GetDlgItemText(hWnd, IDC_WINCAPTION, szCaption, 80))
					{
						MessageBox(hWnd,&quot;ENTER THE WINDOW CAPTION&quot;,&quot;BotError&quot;,MB_OK|MB_ICONERROR);
					}
					else
					{
						if(!GetDlgItemText(hWnd,IDC_TIME,szTime,10))
						{
							MessageBox(hWnd,&quot;ENTER A POSITIVE INTEGER VALUE&quot;,&quot;BotError&quot;,MB_OK|MB_ICONERROR);
						}
						else
						{
							hWndMainWin = FindWindow(NULL,szCaption);
							hWndSec = FindWindowEx(hWndMainWin, NULL, &quot;SunAwtCanvas&quot;, NULL);
							hWndEdit = FindWindowEx(hWndSec, NULL, &quot;Edit&quot;, NULL);
							if((hWndMainWin == NULL)||(hWndSec == NULL)||(hWndEdit == NULL))
							{
								MessageBox(hWnd,&quot;HANDLE NOT FOUND&quot;,&quot;BotError&quot;,MB_OK|MB_ICONERROR);
							}
							else
							{
								int i = atoi(szTime);
								i = i * 1000;
								SetTimer(hWnd,uTimer,i,NULL);
							}
						}
					}
					return TRUE;
				}

				case IDC_STOP:
				{
					KillTimer(hWnd, uTimer);
					return TRUE;
				}

				case IDC_EXIT:
				{
					KillTimer(hWnd, uTimer);
					EndDialog(hWnd,wParam);
					return TRUE;
				}
			}
		}
		return TRUE;

		case WM_TIMER:
		{
			//??? TEXTDATEI NUTZEN ???
			char text[] = &quot;Test message.&quot;;

			SetFocus(hWndEdit);
			SendMessage(hWndEdit,WM_SETTEXT,0,(LPARAM)text);
			//Enter sim.
			SendMessage(hWndEdit,WM_SETTEXT,0,(LPARAM)0x13);

			//SendMessage(hWndEdit,WM_KEYUP,VK_RETURN,1);

			//keybd_event(VK_RETURN,0,0,0);
			//keybd_event(VK_RETURN,0,KEYEVENTF_KEYUP,0);

			return 0;
		}
	}
	return FALSE;
}
</code></pre>
<p>Bei WM_TIMER liegt das Problem nach Enter sim.</p>
<p>PS: Ich hab schon fast alles ausprobiert was im Forum zu finden war, doch nichts funktioniert so recht <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/105738/enter-simulieren</link><generator>RSS for Node</generator><lastBuildDate>Sat, 30 May 2026 21:06:43 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/105738.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 02 Apr 2005 08:41:43 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Enter simulieren on Sat, 02 Apr 2005 08:41:43 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Ich hab ein kleines Problem mit dem Programm. Das Programm soll einen Text an eine andere Anwendung schicken und dort absenden. Die Nachricht senden klappt einwandfrei und kommt auch dort an wo sie soll. Das Problem ist jenes, das sich der Enterdruck nicht ausführen läßt bzw keine Wirkung hat.<br />
Das ganze passiert in einen JavaApplet von einem Browser (Zielanwendung). Hier mal der Sourcecode: (Sorry für den schlechten QC, fang erst an mit der API <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /> )</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &lt;cstdlib&gt;
#include &quot;resource.h&quot;
using namespace std;

extern int __argc;
extern char **__argv;

char szCaption[80];
char szTime[10];
UINT_PTR uTimer = 1;

HWND hWndMainWin;
HWND hWndSec;
HWND hWndEdit;

INT_PTR CALLBACK DlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
{
	DialogBox(hInstance, MAKEINTRESOURCE(IDD_BOT), NULL, DlgProc);
}

INT_PTR CALLBACK DlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch(msg)
	{
		case WM_INITDIALOG:
		{
			return TRUE;
		}

		case WM_COMMAND:
		{
			switch(LOWORD(wParam))
			{
				case IDC_GO:
				{
					if(!GetDlgItemText(hWnd, IDC_WINCAPTION, szCaption, 80))
					{
						MessageBox(hWnd,&quot;ENTER THE WINDOW CAPTION&quot;,&quot;BotError&quot;,MB_OK|MB_ICONERROR);
					}
					else
					{
						if(!GetDlgItemText(hWnd,IDC_TIME,szTime,10))
						{
							MessageBox(hWnd,&quot;ENTER A POSITIVE INTEGER VALUE&quot;,&quot;BotError&quot;,MB_OK|MB_ICONERROR);
						}
						else
						{
							hWndMainWin = FindWindow(NULL,szCaption);
							hWndSec = FindWindowEx(hWndMainWin, NULL, &quot;SunAwtCanvas&quot;, NULL);
							hWndEdit = FindWindowEx(hWndSec, NULL, &quot;Edit&quot;, NULL);
							if((hWndMainWin == NULL)||(hWndSec == NULL)||(hWndEdit == NULL))
							{
								MessageBox(hWnd,&quot;HANDLE NOT FOUND&quot;,&quot;BotError&quot;,MB_OK|MB_ICONERROR);
							}
							else
							{
								int i = atoi(szTime);
								i = i * 1000;
								SetTimer(hWnd,uTimer,i,NULL);
							}
						}
					}
					return TRUE;
				}

				case IDC_STOP:
				{
					KillTimer(hWnd, uTimer);
					return TRUE;
				}

				case IDC_EXIT:
				{
					KillTimer(hWnd, uTimer);
					EndDialog(hWnd,wParam);
					return TRUE;
				}
			}
		}
		return TRUE;

		case WM_TIMER:
		{
			//??? TEXTDATEI NUTZEN ???
			char text[] = &quot;Test message.&quot;;

			SetFocus(hWndEdit);
			SendMessage(hWndEdit,WM_SETTEXT,0,(LPARAM)text);
			//Enter sim.
			SendMessage(hWndEdit,WM_SETTEXT,0,(LPARAM)0x13);

			//SendMessage(hWndEdit,WM_KEYUP,VK_RETURN,1);

			//keybd_event(VK_RETURN,0,0,0);
			//keybd_event(VK_RETURN,0,KEYEVENTF_KEYUP,0);

			return 0;
		}
	}
	return FALSE;
}
</code></pre>
<p>Bei WM_TIMER liegt das Problem nach Enter sim.</p>
<p>PS: Ich hab schon fast alles ausprobiert was im Forum zu finden war, doch nichts funktioniert so recht <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/758012</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/758012</guid><dc:creator><![CDATA[VirtualDreams]]></dc:creator><pubDate>Sat, 02 Apr 2005 08:41:43 GMT</pubDate></item><item><title><![CDATA[Reply to Enter simulieren on Sat, 02 Apr 2005 17:47:58 GMT]]></title><description><![CDATA[<p>such hier mal nach keybd_event...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/758427</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/758427</guid><dc:creator><![CDATA[keysimulator]]></dc:creator><pubDate>Sat, 02 Apr 2005 17:47:58 GMT</pubDate></item><item><title><![CDATA[Reply to Enter simulieren on Sat, 02 Apr 2005 17:53:18 GMT]]></title><description><![CDATA[<p>sorry, aber guck mal bei WM_TIMER in meinem source nach, ich habs schon damit versucht. klappt nicht so ganz.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/758430</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/758430</guid><dc:creator><![CDATA[VirtualDreams]]></dc:creator><pubDate>Sat, 02 Apr 2005 17:53:18 GMT</pubDate></item><item><title><![CDATA[Reply to Enter simulieren on Sun, 03 Apr 2005 11:49:18 GMT]]></title><description><![CDATA[<p>Hab deinen Beitrag jetzt nicht ganz durchgelesen, aber versuch s mal mit SendInput.</p>
<p>Greets<br />
M.T.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/758886</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/758886</guid><dc:creator><![CDATA[Manuel]]></dc:creator><pubDate>Sun, 03 Apr 2005 11:49:18 GMT</pubDate></item><item><title><![CDATA[Reply to Enter simulieren on Sun, 03 Apr 2005 12:20:43 GMT]]></title><description><![CDATA[<p>Hmm, das hab ich auch schon gefunden, nur komm ich nicht so recht klar mit der Funktion :(. Hat dafür jemand vlt mal ein kleines Bsp? Das wäre wirklich nett.<br />
Ansonsten schau ich es mir jetzt nochmal an.</p>
<p>EDIT:</p>
<p>Hab jetzt folgendes Ausprobiert:</p>
<pre><code class="language-cpp">void pressKey(int vKey) 
{ 
    KEYBDINPUT ki={0}; 
    ki.wVk = vKey; 
    ki.wScan = MapVirtualKeyEx(vKey, 0, GetKeyboardLayout(0)); 
    ki.time = 10; 

    INPUT ipEvent; 
    ipEvent.type = INPUT_KEYBOARD; 
    ipEvent.ki = ki; 

    SendInput(1,&amp;ipEvent,sizeof(INPUT)); 
}
</code></pre>
<p>Aber beim compilieren hagelt es fehler ohne ende das er KEYBDINPUT, INPUT und SendInput nicht kennen würde..., hab doch aber die windows.h eingebunden.</p>
<pre><code>g:\Entwicklung\VisualC++\Bot\main.cpp(119) : error C2065: 'KEYBDINPUT' : undeclared identifier
g:\Entwicklung\VisualC++\Bot\main.cpp(119) : error C2146: syntax error : missing ';' before identifier 'ki'
g:\Entwicklung\VisualC++\Bot\main.cpp(119) : error C2065: 'ki' : undeclared identifier
g:\Entwicklung\VisualC++\Bot\main.cpp(119) : error C2059: syntax error : '{'
g:\Entwicklung\VisualC++\Bot\main.cpp(119) : error C2143: syntax error : missing ';' before '{'
g:\Entwicklung\VisualC++\Bot\main.cpp(119) : error C2143: syntax error : missing ';' before '}'
g:\Entwicklung\VisualC++\Bot\main.cpp(120) : error C2228: left of '.wVk' must have class/struct/union type
        type is ''unknown-type''
g:\Entwicklung\VisualC++\Bot\main.cpp(120) : error C3861: 'ki': identifier not found, even with argument-dependent lookup
g:\Entwicklung\VisualC++\Bot\main.cpp(121) : error C2228: left of '.wScan' must have class/struct/union type
        type is ''unknown-type''
g:\Entwicklung\VisualC++\Bot\main.cpp(121) : error C3861: 'ki': identifier not found, even with argument-dependent lookup
g:\Entwicklung\VisualC++\Bot\main.cpp(122) : error C2228: left of '.time' must have class/struct/union type
        type is ''unknown-type''
g:\Entwicklung\VisualC++\Bot\main.cpp(122) : error C3861: 'ki': identifier not found, even with argument-dependent lookup
g:\Entwicklung\VisualC++\Bot\main.cpp(124) : error C2065: 'INPUT' : undeclared identifier
g:\Entwicklung\VisualC++\Bot\main.cpp(124) : error C2146: syntax error : missing ';' before identifier 'ipEvent'
g:\Entwicklung\VisualC++\Bot\main.cpp(124) : error C2065: 'ipEvent' : undeclared identifier
g:\Entwicklung\VisualC++\Bot\main.cpp(125) : error C2228: left of '.type' must have class/struct/union type
        type is ''unknown-type''
g:\Entwicklung\VisualC++\Bot\main.cpp(125) : error C2065: 'INPUT_KEYBOARD' : undeclared identifier
g:\Entwicklung\VisualC++\Bot\main.cpp(125) : error C3861: 'ipEvent': identifier not found, even with argument-dependent lookup
g:\Entwicklung\VisualC++\Bot\main.cpp(126) : error C2228: left of '.ki' must have class/struct/union type
        type is ''unknown-type''
g:\Entwicklung\VisualC++\Bot\main.cpp(126) : error C3861: 'ipEvent': identifier not found, even with argument-dependent lookup
g:\Entwicklung\VisualC++\Bot\main.cpp(126) : error C3861: 'ki': identifier not found, even with argument-dependent lookup
g:\Entwicklung\VisualC++\Bot\main.cpp(128) : error C2070: ''unknown-type'': illegal sizeof operand
g:\Entwicklung\VisualC++\Bot\main.cpp(128) : error C3861: 'SendInput': identifier not found, even with argument-dependent lookup
g:\Entwicklung\VisualC++\Bot\main.cpp(128) : error C3861: 'ipEvent': identifier not found, even with argument-dependent lookup
g:\Entwicklung\VisualC++\Bot\main.cpp(128) : error C3861: 'INPUT': identifier not found, even with argument-dependent lookup
</code></pre>
<p>Bitte Helfen! THX</p>
]]></description><link>https://www.c-plusplus.net/forum/post/758892</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/758892</guid><dc:creator><![CDATA[VirtualDreams]]></dc:creator><pubDate>Sun, 03 Apr 2005 12:20:43 GMT</pubDate></item><item><title><![CDATA[Reply to Enter simulieren on Sun, 03 Apr 2005 12:56:39 GMT]]></title><description><![CDATA[<p>Möglicherweise musst du erst noch definieren, das Win98 dein Minimal-System (laut MSDN/PSDK läuft SendInput() ab win98):<br />
<a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winprog/winprog/using_the_windows_headers.asp" rel="nofollow">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winprog/winprog/using_the_windows_headers.asp</a></p>
<p>...oder deine Windows-Header sind einfach nicht neu genug. In dem Falle dürfte das installieren des Platform SDKs helfen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/758961</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/758961</guid><dc:creator><![CDATA[geeky]]></dc:creator><pubDate>Sun, 03 Apr 2005 12:56:39 GMT</pubDate></item><item><title><![CDATA[Reply to Enter simulieren on Sun, 03 Apr 2005 13:04:40 GMT]]></title><description><![CDATA[<p>Hmm, ich hab VC++ .NET 2003, dürfte ja wohl neu genug sein, oder? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /><br />
Ich schau mir den Link mal an, vlt klappts ja.</p>
<p>THX</p>
<p>EDIT:</p>
<p>Ok, comp. hat geklappt, aber jetzt sind neue Errors da. hab mich an den Link gehalten und die Macros für WinXP genommen und nun das... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<pre><code>g:\Entwicklung\VisualC++\Bot\main.cpp(1) : error C2008: '&gt;' : unexpected in macro definition
g:\Entwicklung\VisualC++\Bot\main.cpp(2) : error C2008: '&gt;' : unexpected in macro definition
c:\Programme\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\Windows.h(24) : fatal error C1017: invalid integer constant expression
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/758962</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/758962</guid><dc:creator><![CDATA[VirtualDreams]]></dc:creator><pubDate>Sun, 03 Apr 2005 13:04:40 GMT</pubDate></item><item><title><![CDATA[Reply to Enter simulieren on Sun, 03 Apr 2005 13:11:13 GMT]]></title><description><![CDATA[<p>Bei #define das &quot;&gt;=&quot; noch mit drin ?!</p>
<pre><code class="language-cpp">// Mindest-System: WinXP
#define _WIN32_WINDOWS 0x0501
#define WINVER 0x0501

#include &lt;windows.h&gt;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/758976</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/758976</guid><dc:creator><![CDATA[geeky]]></dc:creator><pubDate>Sun, 03 Apr 2005 13:11:13 GMT</pubDate></item><item><title><![CDATA[Reply to Enter simulieren on Sun, 03 Apr 2005 13:13:08 GMT]]></title><description><![CDATA[<p>ja, hatte das &quot;&gt;=&quot; noch mit drinn, *ups* habs jetzt entfernt und läßt sich super compilieren.</p>
<p>THX</p>
]]></description><link>https://www.c-plusplus.net/forum/post/758978</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/758978</guid><dc:creator><![CDATA[VirtualDreams]]></dc:creator><pubDate>Sun, 03 Apr 2005 13:13:08 GMT</pubDate></item></channel></rss>