| View previous topic :: View next topic |
| Author |
Message |
spectrum Expert Cheater
Reputation: 0
Joined: 27 Mar 2007 Posts: 143
|
|
| Back to top |
|
 |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Sun Apr 13, 2008 11:08 am Post subject: |
|
|
| FindWindowA/W, SendInput.
|
|
| Back to top |
|
 |
spectrum Expert Cheater
Reputation: 0
Joined: 27 Mar 2007 Posts: 143
|
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Sun Apr 13, 2008 11:24 am Post subject: |
|
|
Lmao
| Code: |
#include <windows.h>
#include <tchar.h>
HWND hNotepad;
HWND hNoteEdit;
TCHAR tszString[260];
int main( int argc, TCHAR *argv[] )
{
hNotepad = FindWindow( _T("Notepad"), NULL );
if ( !hNotepad ) return 0; // Coudnt find Notepad.
hNoteEdit = FindWindowEx( hNotepad, NULL, _T("EDIT"), NULL );
if ( !hNoteEdit ) return 0; // Coudnt find Notepad edit control.
_tcscpy( tszString, _T("Print This") );
for ( int i = 0; i <= _tcslen(tszString); i++ )
PostMessage( hNoteEdit, WM_CHAR, tszString[i], 0 );
_gettchar();
return 0;
} |
just did it in notepad, should work.
_________________
|
|
| Back to top |
|
 |
spectrum Expert Cheater
Reputation: 0
Joined: 27 Mar 2007 Posts: 143
|
Posted: Sun Apr 13, 2008 11:30 am Post subject: |
|
|
uh it doesn't compile, it says its missing a ")" before ";" token..i would correct it myself but i have no idea where that should be
_________________
C++ {||||||||||}
ASM {||||||||||} |
|
| Back to top |
|
 |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Sun Apr 13, 2008 11:46 am Post subject: |
|
|
| Why are you helping him? he should learn by himself, he can't just copy paste codes forever and he can't even fix simple errors.
|
|
| Back to top |
|
 |
spectrum Expert Cheater
Reputation: 0
Joined: 27 Mar 2007 Posts: 143
|
Posted: Sun Apr 13, 2008 11:49 am Post subject: |
|
|
ok, sorry symbol i didn't look very well into the code, i corrected it, but now really it says getchar is undeclared, that i need to use it first...
_________________
C++ {||||||||||}
ASM {||||||||||} |
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Sun Apr 13, 2008 1:29 pm Post subject: |
|
|
| getchar is a part of stdio if I remember right.
|
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Sun Apr 13, 2008 3:43 pm Post subject: |
|
|
_gettchar is its unicode equivilent. Located in tchar.h
_________________
|
|
| Back to top |
|
 |
Heartless I post too much
Reputation: 0
Joined: 03 Dec 2006 Posts: 2436
|
Posted: Sun Apr 13, 2008 4:59 pm Post subject: |
|
|
Can't you use the fstream library to write to notepad, that is much easier. Now someone is going to tell me that it is a waste of resources...
_________________
What dosen't kill you, usually does the second time. |
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Sun Apr 13, 2008 6:07 pm Post subject: |
|
|
| HornyAZNBoy wrote: | | Can't you use the fstream library to write to notepad, that is much easier. Now someone is going to tell me that it is a waste of resources... |
Maybe. Idk. I'm not that knowledgeable in FI/FO. You can right a notepad file(txt) with FI/FO. But I'm not sure if you could actually write to notepad itself. SendInput seems right.
@spectrum
Just go to http://www.msdn.com/ and search for your api there. It gives you a list of different explanations in full detail about the parameters and what they're spozed to do in the API as well as what the API does.
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Mon Apr 14, 2008 8:47 am Post subject: |
|
|
| lurc wrote: | | _gettchar is its unicode equivilent. Located in tchar.h |
gettchar is nothing more then a macro which calls getchar, which is located in stdio.h
Fixed code that works fine.
(Updated the strcpy call to use the secure version and fixed the warnings that are given while compiling @ Lv4)
| Code: | #include <windows.h>
#include <stdio.h>
#include <tchar.h>
HWND hNotepad;
HWND hNoteEdit;
TCHAR tszString[260];
int main( int argc, TCHAR *argv[] )
{
UNREFERENCED_PARAMETER( argc );
UNREFERENCED_PARAMETER( argv );
hNotepad = FindWindow( _T("Notepad"), NULL );
if ( !hNotepad ) return 0; // Coudnt find Notepad.
hNoteEdit = FindWindowEx( hNotepad, NULL, _T("EDIT"), NULL );
if ( !hNoteEdit ) return 0; // Coudnt find Notepad edit control.
_tcscpy_s( tszString, _ARRAYSIZE(tszString), _T("Print This") );
for ( int i = 0; i <= (int)_tcslen(tszString); i++ )
PostMessage( hNoteEdit, WM_CHAR, tszString[i], 0 );
_gettchar();
return 0;
} |
_________________
- Retired. |
|
| Back to top |
|
 |
rapion124 Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Mar 2007 Posts: 1095
|
Posted: Mon Apr 14, 2008 10:39 am Post subject: |
|
|
| You don't really need to know Windows APIs to make programs w/ C++. If you're using Visual C++, I believe there are pre-built classes that use APIs in the MFC libraries.
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Tue Apr 15, 2008 3:45 am Post subject: |
|
|
| rapion124 wrote: | | You don't really need to know Windows APIs to make programs w/ C++. If you're using Visual C++, I believe there are pre-built classes that use APIs in the MFC libraries. |
Well you certainly can't use an API without understanding it. (Yes, you can guess and get lucky, but you will have no skill with it.)
Windows programming almost always involves some API. (Don't say some small all like x = 1 + 1; doesn't use API, cause thats not the point of my post.)
And avoid MFC at all costs if you don't know it already. It's not much of a gain to anything with programming.
_________________
- Retired. |
|
| Back to top |
|
 |
|