dietcoke » Wed Feb 05, 2014 11:28 pm wrote:I've come across this which is relevant to anyone who uses OUtputDebugStringA to get the kernal debugging.
It doesn't work any more in 600
You have to use the W (Unicode) version of the function as below
Code: Select all
#import "kernel32.dll"
void OutputDebugStringW(string msg);
#import
===============================================================================
Hi,
I was wondering if anybody had any luck with this because my Empty4 build610 is giving problems using kernell.dll and debugview (which I have embedded in all my programs and custom charts ) .
The Empty4 seems to compile ok after changing to Unicode command but nothing happens in DEBUGVIEW ..ie. no data comes through ..
The Print commands work in Empty4 ok..so something is happening ..
Any ideas ?
Below is the code I am using if anybody wants to test it . You also need DEBUGVIEW.exe from microsoft ..avail on net.
Code: Select all
//
// send information to OutputDebugString() to be viewed and logged by
// SysInternal's DebugView (free download from Microsoft) This is ideal for
// debugging as an alternative to Print(). The function will take up to 10
// strings (or numeric) arguments to be concatenated into one debug message.
// http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx
//
#property indicator_separate_window
#import "kernel32.dll"
void OutputDebugStringW( string msg );
#import
;
void log(string s1,string s2="",string s3="",string s4="",string s5="",
string s6="",string s7="",string s8="",string s9="",string s10="")
{
string out = StringTrimRight(StringConcatenate(
WindowExpertName(), ".mq4 ", Symbol(),
" ", s1,
" ", s2,
" ", s3,
" ", s4,
" ", s5,
" ", s6,
" ", s7,
" ", s8
));
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
/*
void AlertMe(string s1,string s2="",string s3="",string s4="",string s5="",
string s6="",string s7="",string s8="",string s9="",string s10="")
{
Alert(s1,s2,s3,s4,s5,s6,s7,s8,s9,s10);
Log(s1,s2,s3,s4,s5,s6,s7,s8,s9,s10);
}
*/
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
log("TEST INIT");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
// log("test deINIT");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
//----
log("test print inti START = LOG ");
MathLog("test print inti START = LOG ");
Print("test print inti START = ",StringTrimRight(StringConcatenate(WindowExpertName(),
".mq4 ", Symbol())));
//----
return(0);
}
//+------------------------------------------------------------------+