[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Visual C++ 2008 Express simple DLL sample file?



PureBytes Links

Trading Reference Links

Tomasz,

While, being a Mac guy, I am quick to vilify Microsoft.  However, in this case you are being too harsh on them.  They seem to have improved their free version for 2008 and with some more experimentation, I was able to get the free version to compile the ADK Sample project and produce the sample.dll.  Then I modified the functions.cpp slightly and made another sample.dll that functioned properly with AFL calls.
Here is what I did to make it work:

1.   I reinstalled the ADK from scratch to get rid of my previous experiments.
2.   I double clicked the Sample.dsp file which launched Visual C++ 2008 Express Edition
3.   A dialog box came up requesting to convert the project format to an updated version --I clicked Yes.  This was the key step.
4.   I did a "Build Solution" from the Build menu.
5.   The Sample.dll was generated error free and placed in the "Debug" folder.
6.   I moved the Sample.dll into the Plugins folder and started up AmiBroker.  I added a plot calling ExampleEMA.  Success.

There is a humorous side to this story also...

I modified the ExampleEMA just to make sure that it was my changes that I was seeing and not something else, since the ExampleEMA was a prebuilt function.  I called it myExampleEMA, and I changed the function to return a constant.  It worked half way????  The name changed, but it returned the exact same moving average result as before.  

I tried all kinds of changes to that function which seemed to have no effect.  I finally commented practically everything out in the function and it still returned a beautiful moving average.  My mind was going in circles tying to figure out how my changes could be ignored.  It truly seemed impossible.  It is funny that when you don't know what you are doing and in a new situation, the mind is open to the wildest speculations to explain what is happening.  

Eventually, I commented out the other two functions: exampleMACD and ExampleMA.  Finally I got a compile error message.  It turns out that there is a typo in the function table.  Both ExampleEMA and ExampleMA point to VExampleMA code.  Since the file was last modified in 2001, it must have been there for 7 years and nobody noticed until now --or at least did not bother tell AmiBroker about it.   It was lurking for all those years just waiting for a novice like me to get tricked into thinking the laws of programming physics were suddenly altered.  LOL

Now I will proceed to try and make my real dll work.

Best regards,
Dennis

On Apr 26, 2008, at 10:22 AM, Tomasz Janeczko wrote:
See also the video:

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
Sent: Saturday, April 26, 2008 4:19 PM
Subject: Re: [amibroker] Visual C++ 2008 Express simple DLL sample file?

Hello,
 
Visual C++ 2008 EXPRESS edition (FREE) is severely limited and does NOT support creating of DLLs at all.
That's why you get error when compiling it with Express edition.
Microsoft never gives useful things for free. Express editions are toys only.
 
To create DLLs you need either Standard or Professional edition, or free Borland compiler or free GCC( GNU CC)/MinGW
Sample project files for free Dec-C++ are included in the ADK.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
Sent: Saturday, April 26, 2008 2:18 PM
Subject: Re: [amibroker] Visual C++ 2008 Express simple DLL sample file?

Paul, That is exactly what my plan was and what I was attempting to do.  However, the example in the ADK would not compile error free with Visual C++ 2008 Express as I explained.  Perhaps it would with the full version, but I explained that issue in my last post to Mike.

BR,
Dennis

On Apr 26, 2008, at 2:13 AM, Paul Ho wrote:
You should start off by compiling the examples contained in the ADK. and increment things slowly so you know what could possibly cause the problem
 


From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Dennis Brown
Sent: Saturday, 26 April 2008 1:44 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Visual C++ 2008 Express simple DLL sample file?

Hello,

I took the challenge from Tomasz that anyone who is willing to learn, 
can extend AFL to do anything. My chosen task is to restore the 
scroll position of the Parameters Window after a "Reset all" button 
click --and yes, it has an important use.

Tomasz informed me that I would need to write a DLL to make this 
possible. There may be other ways, but I will try it this way.

First I have to say that I do not know C++ (other than AFL has a 
similar syntax). Next I am not very familiar with anything Windows (I 
am a Mac guy). So if I can do this (with a little help from my AB 
friends) Tomasz will be vindicated in his statements.

I determined that all I need is to make an extremely simple DLL. It 
will create the following new AFL function:

oldScrollPosition = GetSetWindowScroll(newScrollPosition);

It will simply return the current scroll position of the active 
foreground window and then set the scroll position to the supplied 
parameter. It should only be about 10 lines of C++ code.

I have found the Windows calls that will get the handle of the 
foreground window, and (with a pointer from Tomasz) calls to get and 
set the scroll thumb position on a standard window.

Everything else I need to do I can handle with AutoIt or AFL.

I have installed the free ADK and installed the free Visual C++ 2008 
Express program, and started to try to write this.

Initially I tried just Building the Sample DLL in the ADK. That 
mostly works, but gives me errors on the Plugin.cpp:

error C2491: on 5 critical lines for : Definition of dllimport 
function not allowed
these are the PLUGINAPI statements for Release, Init, 
GetFunnctionTable, SetSiteInterface, and GetPluginInfo.

Somehow, I think I really need these lines to compile for any AB DLL 
to work...

I have tried a bunch of things, and I can make it give me more errors, 
but unfortunately no less errors. So I think I need some hints or 
more help to get started.

I was wondering if anyone has an answer, or a simple DLL sample 
project file that builds error free on Visual C++ 2008 Express that 
you could email me to get me started on the right track with this?

Thanks,
Dennis



__._,_.___

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___