Skip to content

Instantly share code, notes, and snippets.

@xkyii
Created July 2, 2011 11:32
Show Gist options
  • Save xkyii/1059956 to your computer and use it in GitHub Desktop.
Save xkyii/1059956 to your computer and use it in GitHub Desktop.
动态调试
//发送到记事本
void SendPad( string str )
{
//std::wstring wstr(str.begin(),str.end());
//_ReportTip( wstr, -1 );
HWND childhandle = NULL;
HWND npad = ::FindWindowA("NOTEPAD",NULL);
if (npad)
{
POINT pt; pt.x=0x14, pt.y=0x14;
childhandle = ::ChildWindowFromPoint(npad, pt);
}
for ( int i=0; i< (int)(str.size()); ++i)
{
unsigned long x = str.at(i);
::PostMessage( childhandle, 0x102, x, 1 );
}
::PostMessage( childhandle, 0x102, 0x0d, 1 );
}
#ifdef _DEBUG
#define MYTRACE DbgStrOut
#else
#define MYTRACE
#endif
#define OUTPUT_BUFF_LEN 512
void DbgStrOut(const TCHAR *fmt, ...)
{
TCHAR szOutStr[OUTPUT_BUFF_LEN];
va_list ap;
va_start(ap, fmt);
StringCbVPrintf(szOutStr, OUTPUT_BUFF_LEN, fmt, ap);
va_end(ap);
OutputDebugString(szOutStr);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment