Old 04-06-2008, 06:09 AM   #1
Lawrence
Human being with feelings
 
Join Date: Mar 2007
Posts: 21,551
Default The "Reaper API DLL Library" Thread

See thread title... imagine me wishing.

This is for Justin, Deric and X in the hope guys like myself and Jason Theron will benefit.

Problem:

While VB programmers are typically accustomed to making API calls to access Windows functions on a lower level than VB allows otherwise, actually creating those *.dll's that encompass functions as presented in the Reaper API are beyond many of our skill sets.


Observation:

My assumption here is that the gap that people like Jason Theron and I can't currently bridge is due to the lack of a current "library" of dll's written by those like Justin who can delve into C code and compile the API functions into usable *.dll's accesible by more people.

When discussion of the ReaperAPI came up some time ago, I (incorrectly) assumed it would be such a library of dll's that all together would make up the Reaper API library.


Premise:

The Win32 API is comprised of multiple *.dll's that perform different functions. Each dll addresses a different part of the overal OS. File System, User Interface etc, etc.

I wonder if the Reaper API could be presented in a similar way? If there's a way to (for instance) ask for the positions of all markers and get returned values back, it only has to be written in C once by the person compiling the library dll. After it's built into the DLL and presented as part of the API dll library anyone can access that function and do whatever they want with it, along with other similar functions that will in total make up a custom tool.

My thinking is while X and others are building custom dll's that do certain custom things, what is really needed by the VB community (a VERY LARGE community that can contribute GREATLY to the customization of Reasper) are similar libraries of standard dll's that allow making calls that address the different parts of Reaper.


Challenge:

To create that library of API *.dll's that can be used in VB (or any other win coding language or IDE) the same way VB users address the Win API dll's. For instance...

User32.dll Windows User Inteface API

ReaUser32.dll Reaper User Interface dll which encomapasses all of the possible functions from the current Reaper API that address the Reaper UI.

Publish relevant function calls, data types and methods. I assume that this won't only benefit VB users but C (Borland, whatever) users as well who also make calls to the Win32 API through the standard library dll files.


Conclusion:

While there is a great benefit to persons like X and Deric creating custom dll's to use in custom tools that benefit the Reaper community, and I look forward to those tools... moving the Reaper API functions to a standard set of clearly defined, documented and compiled dll's as with the WinAPI model would EXPLODE custom tool development for Reaper dramatically.

That is IF my reasoning above is viable and that can actually be done.

If X can (for instance) create a dll that allows him to set faders like in his earlier snapshot example, imagine the impact of a compiled "Mix32.dll" released by Cockos that encompasses all of the possible functions that the current API allows regarding faders, mutes or other mix controls.

VB would programmers make the declarations and calls to the dll's in their applications like they do now with the WinAPI. That's what's holding me back, most API's I use now are already compiled dll's that comprise the functions of the overall API.

Make any sense? I imagine doing a declaration simlar to the one below to address the Reaper UI. Obviously fictional API declaration below but it gets the point across... I hope.

================================================== =========

Private Declare Function SetRoutingMatrix Lib "ReaUser32" Alias "SetMatrixA" (ByVal dwExStyle As Long, ByVal lpClassName As String, ByVal lpWindowName As String, ByVal dwStyle As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As Long, ByVal hMenu As Long, ByVal hInstance As Long, lpParam As Any) As Long

================================================== =========

The above is how API functions are are declared so they can be called in VB or .Net. I'd like to do similar with the Reaper API but the compiled dll library doesn't exist.

With the functions defined for a particular dll as with the WinAPI model.

Imaginary ReaMix.dll functions

SetRoutingMatrix: Make routing connections from an array

GetROutconfig: Returns channel output routing config for the current channel.

GetRInconfig: Returns channel input routing config for the current channel.

Etc, etc, etc.... using functions that the current API can actually currently accomplish.

Last edited by Lawrence; 04-06-2008 at 08:05 AM.
Lawrence is offline   Reply With Quote
Old 04-06-2008, 06:20 AM   #2
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Hmm, it just might be possible, but have you looked at the current reaper_plugin.h? There's soooo much stuff already...Converting that to VB-callable DLL-functions would take a lot of time. (Assuming creating such a VB "proxy"-DLL is actually possible.)
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Xenakios is offline   Reply With Quote
Old 04-06-2008, 06:40 AM   #3
Lawrence
Human being with feelings
 
Join Date: Mar 2007
Posts: 21,551
Default

Quote:
Originally Posted by Xenakios View Post
Hmm, it just might be possible, but have you looked at the current reaper_plugin.h? There's soooo much stuff already...Converting that to VB-callable DLL-functions would take a lot of time. (Assuming creating such a VB "proxy"-DLL is actually possible.)
Don't think "VB callable". Just think "callable". You use Win32 API calls to those dll's in Borland or C or VC also right? The functions are predefined for your use and yet they still can be difficult to grasp at times.

Imagine if Microsoft made you write those from the C level how much more difficult it would be doing some of those things in VC, instead of just giving you the library? And again, it's still not a walk in the park.

But I hear you. If those functions could be broken out into logical groupings over time... imagine the HUGE impact on 3rd party tool developement. There are literally hundreds of programmers who might jump in who probably wouldn't otherwise take the time to write custom dll's from scatch in C.

And then there are those who simply can't since the don't know how. Like me.

Not only that but with Cockos writing the functions of the standard dll library, there would be a much lesser chance of them not operating properly since they know the ins and outs of Reaper intimately. The dll library would be the bridge to functions that are otherwise inaccessible by many.

Many...

I don't care if it's 40 dll's in the library ... I'll download and use the ones I need for the functions I need. Start with something simple (as if)... give me a dll like what you did with the snapshop faders. Something that will set and return values for an array of up to, maybe 8?, faders.

I'll call that from VB and do fader scenes with Reaper as an example or a proof of concept.

I do think if you can write and compile a dll, and then call it from another GUI app exe you write to take advantage of it... I should be able to also call it from VB after I declare it.

I hope.

Last edited by Lawrence; 04-06-2008 at 07:00 AM.
Lawrence is offline   Reply With Quote
Old 04-06-2008, 06:56 AM   #4
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Quote:
Originally Posted by Lawrence View Post
Don't think "VB callable". Just think "callable". You use Win32 API calls to those dll's in Borland or C or VC also right? The functions are predefined for your use and yet they still can be difficult to grasp at times.
Yeah, I got your point. But to be really useful, the Reaper API "bridge/proxy"-functions would need some special case handling, "behind-the-scenes" plumbing etc...Not to dismiss VB-developers or anything, but some of the stuff needed to make many things work from the Reaper APIs is bound to be beyond the abilities of an average VB-coder. Can VB, for example, handle void pointers etc? And if it can, does the average VB programmer know how to deal with those?* Maybe not, therefore, "plumbing" is almost certainly needed for the externally callable functions and so on...

I am saying this now with the shocking 2 weeks of experience of desperately trying to figure out the correct procedures to call the win32 API functions from C++ etc...The amount of "plumbing" that is done by Borland/CodeGear/The Jedi Project, for example, in Delphi is HUGE. I did, of course, use "raw" win32 functions from Delphi, too, but it wasn't a NECESSITY for about 98% of cases.

Oh, and, by the way, I am ALL +1 for the possibility of making this possible for Reaper, some day. It would be too much to ask of Cockos, right now, I would guess, though. And most other developers want to be doing and experimenting with their own stuff at this point. I don't know, Lawrence, if you know some-one who can write both C++ and Visual Basic, maybe he/she could help with this? (I remember there was even a Microsoft programmer who in almost serious face has said "Visual Basic is the best language" or something along those lines. Of course he knew C/C++/ASM, too...)

* I am not completely confidently using all this stuff myself from C++, yet. Could take months before everything is absolutely clear for me and I am able to avoid the most common access violation and memory leak scenarios.
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.

Last edited by Xenakios; 04-06-2008 at 07:14 AM.
Xenakios is offline   Reply With Quote
Old 04-06-2008, 07:11 AM   #5
Lawrence
Human being with feelings
 
Join Date: Mar 2007
Posts: 21,551
Default

Ouch.... I guess using WinAPI in VB is relatively easy comparitively speaking I suppose... given your above statement. You just declare (copy and paste the declaration from the API library add-in) and make the call.

Given that VB.net and Visual C both compile identical executable code (according to MS) I don't see the need now to ever learn C or use Visual C.

Obviously, you do need to study a Win32 API function to use it properly, to understand how it works so you can use it in your code, but actually setting it up so it's ready to fire takes all of 2 minutes. Declare it public in a module or private in a sub and call it (properly).

The hardest part for me is understanding some of the more complicated API functions, what they actually do and how to use mutiple functions to interact with each other in your code to do something that takes 3 calls to 3 different functions or whatever.

Preparing them to fire (be called) is a piece of cake in VB.

Last edited by Lawrence; 04-06-2008 at 07:18 AM.
Lawrence is offline   Reply With Quote
Old 04-06-2008, 07:20 AM   #6
Lawrence
Human being with feelings
 
Join Date: Mar 2007
Posts: 21,551
Default

Quote:
Originally Posted by Xenakios View Post
Not to dismiss VB-developers or anything, but some of the stuff needed to make many things work from the Reaper APIs is bound to be beyond the abilities of an average VB-coder.
My point exactly.

If I make a call to a Reaper dll and send it the correct parameters with the correct data types (for example to "Set" something in Reaper) I'd need to send it the correct data types, integer, long, whatever for it to work and not generate an error.

I just need to know what those data types are ... going in and coming out for get, set, or change ... when changing a property or something, like moving a marker. If it's looking for a long data type and I send it a string... it will generate an error I suppose.

P.S. If I did know C I wouldn't be doing Reaper tools, I'd be writing iPhone apps!

Last edited by Lawrence; 04-06-2008 at 07:30 AM.
Lawrence is offline   Reply With Quote
Old 04-06-2008, 07:42 AM   #7
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Quote:
Originally Posted by Lawrence View Post

P.S. If I did know C I wouldn't be doing Reaper tools, I'd be writing iPhone apps!
Haha, funny. Well, if I had an iPhone, I'd be writing apps for it and making big $, LOL...
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Xenakios is offline   Reply With Quote
Old 04-06-2008, 07:54 AM   #8
Lawrence
Human being with feelings
 
Join Date: Mar 2007
Posts: 21,551
Default

Quote:
Originally Posted by Xenakios View Post
Haha, funny. Well, if I had an iPhone, I'd be writing apps for it and making big $, LOL...
They give you one in the dev tools. Not a REAL one.. ... an emulator in software. You don't need a real one. Honestly, if I still had my Mac Mini I'd probably be trying to learn "Objective C" right now... whatever that is. It all currently looks like Greek to me.

http://www.apple.com/quicktime/qtv/iphoneroadmap/

They get to the dev tools somewhere in the middle I think. Pretty impressive... and a potential gold mine for developers given that the iPhone has a HUGE user base and Apple provides the store for your apps.

Last edited by Lawrence; 04-06-2008 at 08:09 AM.
Lawrence is offline   Reply With Quote
Old 04-06-2008, 08:43 AM   #9
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Oh, by the way, about win32. That uses C-style APIs that are easily callable from other languages. (Windows itself being almost 100% written in C, not C++ or anything else.) There's also lot's of error handling etc done by Microsoft. So the usual case scenario with a wrongly made call to win32 functions is that simply nothing happens.

Reaper, on the other hand, uses, let's say, something different. It's like a mixture of C and C++ and maybe something else... I am almost positive it is not possible to use most of those APIs and "stuff" directly from other languages. The worst thing is, it's quite easy to crash Reaper by doing the wrong things.
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Xenakios is offline   Reply With Quote
Old 04-06-2008, 09:41 AM   #10
Lawrence
Human being with feelings
 
Join Date: Mar 2007
Posts: 21,551
Default

I still would like to try a proof (or dis-proof) of concept. Make a dll that does one very simple thing, attach it to this thread & tell me how you would call it from a custom app/GUI window you might make.

Do whatever is the easiest thing to do that can be actually seen when triggered. Then I'll try to declare it and call it from VB in a similar way.

I'd be interested to see what happens... or doesn't happen.
Lawrence is offline   Reply With Quote
Old 04-06-2008, 09:50 AM   #11
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Let me see about that...I'd need some way to test the resulting DLL etc. Maybe I could call it from a Delphi program or something...I'm not gonna install Visual Basic myself just for that

The problem I see with this, is that the DLL would need to be loaded at the same time by both Reaper and the external EXE. I think that maybe a bit tricky business.

edit : Nope, not much success. I exported this function for my Reaper plugin DLL:

Code:
__declspec(dllexport) int TestFunc(double newtime)
{
	//
	SetEditCurPos(newtime,false,false);
	//MessageBox(g_parent,"Edit Cursor Set?","Message",MB_OK);
	return 666;
}
And tried calling it from a Delphi-compiled exe, trying same methods I have used succesfully previously to run various functions from other DLLs. The Delphi exe complains about not being able to read address $00000000, which is probably quite bad. Both when Reaper was running and not. So not looking so good for starters...I will have to look a bit more into this. Hmm, actually, if I comment out the SetEditCursor() and make the MessageBox active, the messagebox shows and no error. So, exactly calling the Reaper API function causes the error...And that's a very simple function too.

I am quite positive this could be made to work, but it will require that tedious and boring "plumbing" first...
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.

Last edited by Xenakios; 04-06-2008 at 10:32 AM.
Xenakios is offline   Reply With Quote
Old 04-06-2008, 10:27 AM   #12
sws
Code Monkey
 
sws's Avatar
 
Join Date: Sep 2007
Location: Madison, WI
Posts: 857
Default

Lawrence, here, try this: (untested)

https://stash.reaper.fm/oldsb/34632/reaper_test.dll
https://stash.reaper.fm/oldsb/34633/reaper_test.lib (don't necessary need the .LIB depending on how you link to the DLL)
Must be in REAPER\Plugins dir so either put your calling app there too or add Plugins to the path.

I exported one function:

int MuteTrackOne(void)

It does what it says, toggles mute on track #1.
Beware, it will probably crash if you try to call without REAPER running.
sws is offline   Reply With Quote
Old 04-06-2008, 10:38 AM   #13
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

If SWS's dll works, I'd be interested to know how it was done...
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Xenakios is offline   Reply With Quote
Old 04-06-2008, 10:54 AM   #14
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 15,721
Default

Quote:
Originally Posted by Xenakios View Post
Let me see about that...I'd need some way to test the resulting DLL etc. Maybe I could call it from a Delphi program or something...I'm not gonna install Visual Basic myself just for that

The problem I see with this, is that the DLL would need to be loaded at the same time by both Reaper and the external EXE. I think that maybe a bit tricky business.

edit : Nope, not much success. I exported this function for my Reaper plugin DLL:

Code:
__declspec(dllexport) int TestFunc(double newtime)
{
	//
	SetEditCurPos(newtime,false,false);
	//MessageBox(g_parent,"Edit Cursor Set?","Message",MB_OK);
	return 666;
}
And tried calling it from a Delphi-compiled exe, trying same methods I have used succesfully previously to run various functions from other DLLs. The Delphi exe complains about not being able to read address $00000000, which is probably quite bad. Both when Reaper was running and not. So not looking so good for starters...I will have to look a bit more into this. Hmm, actually, if I comment out the SetEditCursor() and make the MessageBox active, the messagebox shows and no error. So, exactly calling the Reaper API function causes the error...And that's a very simple function too.

I am quite positive this could be made to work, but it will require that tedious and boring "plumbing" first...
Xenakios,

That would work if you called it from a Delphi DLL that was loaded by REAPER.. the reason it doesnt work is because your EXE is in a different process..

Also, some things (for example sending WM_COMMAND messages with action commanad IDs) DO work across processes, so there's always that.

-Justin
Justin is offline   Reply With Quote
Old 04-06-2008, 10:58 AM   #15
Lawrence
Human being with feelings
 
Join Date: Mar 2007
Posts: 21,551
Default

I will try when I get home, i'm away posting on the iPhone right now.

From looking at that function I'll take it to be a simple Boolean value for on/off. The first hurdle will be trying to figure out correct formatting for the initial declaration before I try to call it.

I'll report back later after I give if a go.
Lawrence is offline   Reply With Quote
Old 04-06-2008, 10:59 AM   #16
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Quote:
Originally Posted by Justin View Post
Xenakios,

That would work if you called it from a Delphi DLL that was loaded by REAPER.. the reason it doesnt work is because your EXE is in a different process..

Also, some things (for example sending WM_COMMAND messages with action commanad IDs) DO work across processes, so there's always that.

-Justin
Ok, I suspected something along those lines. I'm interested to see if SWS came up with a more smarter and actually working solution...
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Xenakios is offline   Reply With Quote
Old 04-06-2008, 11:06 AM   #17
Lawrence
Human being with feelings
 
Join Date: Mar 2007
Posts: 21,551
Default

Quote:
Originally Posted by Justin View Post
Xenakios,

That would work if you called it from a Delphi DLL that was loaded by REAPER.. the reason it doesnt work is because your EXE is in a different process..

Also, some things (for example sending WM_COMMAND messages with action commanad IDs) DO work across processes, so there's always that.

-Justin
Is what we're discussing here possible in theory? I'd appreciate your overall thoughts on the subject.

Thanks.
Lawrence is offline   Reply With Quote
Old 04-06-2008, 11:23 AM   #18
sws
Code Monkey
 
sws's Avatar
 
Join Date: Sep 2007
Location: Madison, WI
Posts: 857
Default

Ah, I did pretty much the exact thing as Xen, don't bother trying to get mine to work. I'll keep thinking about it, though.
sws is offline   Reply With Quote
Old 04-06-2008, 01:30 PM   #19
Lawrence
Human being with feelings
 
Join Date: Mar 2007
Posts: 21,551
Default

While we're traveling down this road can anyone tell me what this means?

Lawrence is offline   Reply With Quote
Old 04-06-2008, 02:15 PM   #20
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Is this given by the Visual Basic program you tried to use for calling the reaper_test.DLL? It seems the VB runtime or some such expects the DLL to do some special registration thing upon load, but could not find the correct function from the DLL to do that. RegSvr32, I believe is the Windows executable that registers new "services" into the system. That's a way too complex thing to happen for something like this. Could you find a simpler way from VB to load the DLL and get the functions of the DLL?
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.

Last edited by Xenakios; 04-06-2008 at 02:18 PM.
Xenakios is offline   Reply With Quote
Old 04-06-2008, 02:24 PM   #21
Lawrence
Human being with feelings
 
Join Date: Mar 2007
Posts: 21,551
Default

No, that was just me trying to register the dll directly with the system... which means... yes, to the second part. Yes. Probably something that shouldn't work, I tried it anyway. I dropped the dll on top of regsvr32 just to see if it would register so that I could try to call it from VB later.

I can't import it into VB either as a reference or otherwise register it for use. It comes back as an invalid com component. I tried to make it a "managed assembly" in a project.

Funny thing though. I called the "ImportLibray" API in VB.net and pointed to the dll file with the full pathname and it didn't error out. I can only assume it loaded... or the API error handler did a "resume next" thing with no indication of an error. I'll have to do it again and go spying around the loaded assemblies and see if I can find it loaded.

P.S. I just watched some VC++ and VC# coding videos from MS and ... no thanks..

I'm not going there. Not at my age and lack of youthful patience.

Last edited by Lawrence; 04-06-2008 at 02:34 PM.
Lawrence is offline   Reply With Quote
Old 04-06-2008, 02:33 PM   #22
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

It's too bad you probably could not do what you want via Windows messages only*. Basically you could find the handle to Reaper's main window via the FindWindow function of Windows and then start sending Reaper various WM_COMMAND-messages. But I think Reaper only supports the same commands that you find from the Action List you can open by pressing the ?-key. (You can also double-click the Filter text to get the command codes that you could use for the WM_COMMAND messages...)

*Which I assume VB supports well, as it's a very basic Windows programming thing.
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.

Last edited by Xenakios; 04-06-2008 at 02:35 PM.
Xenakios is offline   Reply With Quote
Old 04-06-2008, 02:44 PM   #23
Lawrence
Human being with feelings
 
Join Date: Mar 2007
Posts: 21,551
Default

Yup, I've done a little bit of that with Reaper. I used the SetParent API function to place a toolbar on the Reaper "transport" window space and then used those commands to do some things.

I spyed the running app and then mapped the window spaces that were available to me with the WinAPI to choose one to place the toolbar inside of.

================================================== ==========
'Get the handle of the main window
DAW = FindWindow("REAPERwnd", vbNullString)

'The following window handles in Reaper are mapped to vars
' So you can drop a vb form inside any of those Reaper windows spaces

TrackList = FindWindowEx(DAW, 0, "REAPERTrackListWindow", "trackview")
TimeLine = FindWindowEx(DAW, 0, "REAPERTimeDisplay", "timeline")
Transport = FindWindowEx(DAW, 0, "REAPERVirtWndDlgHost", "Transport")
Track = FindWindowEx(DAW, 0, "REAPERVirtWndDlgHost", "")
Status = FindWindowEx(DAW, 0, "REAPERstatusdisp", "status")
Status = GetWindow(Transport, 5)

'This line placed my VB form inside the transport window space.
old_parent = SetParent(Main.hwnd, Transport)


=================================

Then I used the WM_Command to send some actions from the toolbar on the "click" procedures of the toolbar buttons.

MouseUp = False
Do Until MouseUp = True
DoEvents

PostMessage DAW, WM_KEYDOWN, VK_PLUS, &H1& 'send key command

Sleep 75
Loop


===================================

And the result was this toolbar... which actually worked and lived "inside" of the Reaper application visual space. I put it away figuring I'd develop it more when the Reaper API was released. Looks like it will stay "put away".

I was trying to dig deeper to see if I could reach some of Reaper's internal objects with the WinAPI. Many of the text boxes appeared to be exposed... and a few other things. Run Spy++ on Reaper and you'll see.

If I could code those toolbar buttons with the current Reaper API, I could do some stuff... which is kinda the point of me starting this thread, trying to find a way to do that with this VB project.

Alas... it's not to be...


Last edited by Lawrence; 04-06-2008 at 03:35 PM.
Lawrence is offline   Reply With Quote
Old 04-06-2008, 02:58 PM   #24
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Hahah, that's more than I've ever done with GUI stuff in Reaper... I tried with Delphi to do some tricks to get my own windows into Reaper, but didn't ever really succeed...

Now it's just all that difficult and boring win32/C++ stuff for me.
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Xenakios is offline   Reply With Quote
Old 04-06-2008, 03:14 PM   #25
Lawrence
Human being with feelings
 
Join Date: Mar 2007
Posts: 21,551
Default

Quote:
Originally Posted by Xenakios View Post
I tried with Delphi to do some tricks to get my own windows into Reaper, but didn't ever really succeed...
Well if you ever get back to it in Delphi, there are the working API calls two posts above.

But... you should be also able to make those calls with C++ and accomplish the same thing, get a C++ form "inside" any of those available Reaper window spaces with the SetParent API. It works... though it sounds much harder to do in C++.

How to convert that VB code to C++? I have no idea.

Below are the layouts to the available internal windows I found with SPY++.

http://www.cockos.com/forum/showpost...8&postcount=18

Good luck.

Last edited by Lawrence; 04-06-2008 at 03:56 PM.
Lawrence is offline   Reply With Quote
Old 04-08-2008, 08:52 AM   #26
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

I am now feeling completely like stopping doing this stuff myself. Win32 is just too complicated for me So I guess I am going to wait if someone makes that wrapper for VB or whatever, hahah.

I would have the time but not really the motivation to hack around all this stuff, constantly looking for tutorials and tips in vain.
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.

Last edited by Xenakios; 04-08-2008 at 08:55 AM.
Xenakios is offline   Reply With Quote
Old 04-08-2008, 09:16 AM   #27
sws
Code Monkey
 
sws's Avatar
 
Join Date: Sep 2007
Location: Madison, WI
Posts: 857
Default

Xen, I found "Programming Windows 95" by Charles Petzold extremely helpful back in the day for this stuff. Maybe you can find a copy (PDF or hard) somewhere?
sws is offline   Reply With Quote
Old 04-08-2008, 10:18 AM   #28
robg
Human being with feelings
 
Join Date: Sep 2007
Location: Paso Robles, CA
Posts: 305
Default

Quote:
Originally Posted by Lawrence View Post
Given that VB.net and Visual C both compile identical executable code (according to MS) I don't see the need now to ever learn C or use Visual C.
Close, but not quite. VB.net, and all the other .net languages, like C#, compiles to MSIL (Microsoft Intermediate Language). This is NOT x86 executable code, even though it is an .exe or .dll. When Windows sees it's MSIL, it uses the appropriate version of the .net runtime to run the app.

This is different from VB6, which had the capability to produce regular PE .exe files, but which required the VB runtime.

Compiling using C/C++ produce regular (PE) .exe/.dll files, which may or may not require the VC runtime.

Managed C++ is altogether different. It also produces MSIL.
robg is offline   Reply With Quote
Old 04-08-2008, 10:29 AM   #29
robg
Human being with feelings
 
Join Date: Sep 2007
Location: Paso Robles, CA
Posts: 305
Default

Lawrence -

I had a similar idea to yours, but with regard to writing VSTs using VB.net.

My background is mostly BASIC/VB/VB.net (depending on how many of the 30 years I've been coding on & off you want to go) and assembler. I've dabbled in C++, but am not strong in it.

After looking over the VST SDK, I've concluded it will be LESS WORK to refresh myself on C++ to the ability to directly code in it, versus only refreshing myself enough to make the SDK callable from VB.net.

And this is something fairly static. With as dynamic as I expect the Reaper SDK to be, I think you'll likely find the same.

If you're an accomplished programmer of any language, you should be able to readily grok the concepts of C++.

See if your local bookstore has a copy of The C++ Programming Language: Special Edition (3rd Edition) by Bjarne Stroustrup you can peruse, and see what you think.

As a side note: if you're not backing up regularly already, do so before you start running your own C++ apps. You can not only easily crash Reaper but your whole system.
robg is offline   Reply With Quote
Old 04-08-2008, 10:33 AM   #30
JasonTheron
Human being with feelings
 
JasonTheron's Avatar
 
Join Date: Sep 2007
Location: Medford, OR
Posts: 1,207
Default

Quote:
Originally Posted by Xenakios View Post
I am now feeling completely like stopping doing this stuff myself. Win32 is just too complicated for me So I guess I am going to wait if someone makes that wrapper for VB or whatever, hahah.

I would have the time but not really the motivation to hack around all this stuff, constantly looking for tutorials and tips in vain.
Oh man!
If we had a VB wrapper I would be soooo in on this stuff!
__________________
"pff... anybody who has over 900 posts is a total dork..." -Till (Post count of 932 as of the date of this quote)

My Band - http://ischemiacore.com
Till's FR Vote Tracker - http://tillmannn.de/reaper.html -
Underground Music in Southern Oregon - http://www.myspace.com/sohcindustries
JasonTheron is offline   Reply With Quote
Old 04-08-2008, 10:36 AM   #31
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Quote:
Originally Posted by robg View Post
Lawrence -

I had a similar idea to yours, but with regard to writing VSTs using VB.net.

My background is mostly BASIC/VB/VB.net (depending on how many of the 30 years I've been coding on & off you want to go) and assembler. I've dabbled in C++, but am not strong in it.

After looking over the VST SDK, I've concluded it will be LESS WORK to refresh myself on C++ to the ability to directly code in it, versus only refreshing myself enough to make the SDK callable from VB.net.

And this is something fairly static. With as dynamic as I expect the Reaper SDK to be, I think you'll likely find the same.

If you're an accomplished programmer of any language, you should be able to readily grok the concepts of C++.

See if your local bookstore has a copy of The C++ Programming Language: Special Edition (3rd Edition) by Bjarne Stroustrup you can peruse, and see what you think.

As a side note: if you're not backing up regularly already, do so before you start running your own C++ apps. You can not only easily crash Reaper but your whole system.
The problem is not so much C/C++ but the low-level win32 Windows programming stuff. Well, I guess it just might be possible to use some higher level wrapper like MFC or JUCE, but that's not gonna be instant gratification, either. You have to do the basic plumbing into the Reaper DLL-stuff yourself or wish someone else will do that for you.

The raw win32-APIs programming style is HARD and messy. Absolutely impossible for a newbie to handle, unless he is a young genius. You will spend months, if not years, wondering about the basic stuff about windows, edit boxes, buttons, trivialities like that. And maybe THEN you can start thinking about making apps/plugins that actually do something useful...
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Xenakios is offline   Reply With Quote
Old 04-08-2008, 10:41 AM   #32
robg
Human being with feelings
 
Join Date: Sep 2007
Location: Paso Robles, CA
Posts: 305
Default

Quote:
Originally Posted by Xenakios View Post
The raw win32-APIs programming style is HARD and messy. Absolutely impossible for a newbie to handle, unless he is a young genius. You will spend months, if not years, wondering about the basic stuff about windows, edit boxes, buttons, trivialities like that. And maybe THEN you can start thinking about making apps/plugins that actually do something useful...
Too true! All of this is well past newbie level. Instant gratification = NO! Hard work = YES!

Maybe I skimmed through the wrong part of the thread, but I thought his point was to use VB so he didn't have to do GUI stuff through C++.

IMHO, GUI is the hardest thing to do in C++. At least it was in VC6. Ugly, just plain ugly, or my brain doesn't work that way. I've heard it's much easier in the more recent versions, I just haven't even looked at GUI stuff in VC 2008 yet.

Last edited by robg; 04-08-2008 at 10:46 AM.
robg is offline   Reply With Quote
Old 04-08-2008, 10:42 AM   #33
robg
Human being with feelings
 
Join Date: Sep 2007
Location: Paso Robles, CA
Posts: 305
Default

Quote:
Originally Posted by Xenakios View Post
The problem is not so much C/C++ but the low-level win32 Windows programming stuff.
What do you think Lawrence? I got the impression you were used to making Windows API calls from VB.

Also, are you using VB or VB.net?
robg is offline   Reply With Quote
Old 04-08-2008, 10:49 AM   #34
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Quote:
Originally Posted by robg View Post
What do you think Lawrence? I got the impression you were used to making Windows API calls from VB.

Also, are you using VB or VB.net?
VB handles the messy GUI stuff automatically. Pretty similar to Delphi. You drag and drop buttons etc on a "form", double-click on that designed button or whatever and the programming IDE automatically generates the relevant code section where the actual "payload" code can be manually written. With raw win32 it's completely different and requires lot's of manual code writing where even a slight mistake can lead to a disaster or at least a non-working situation.

Some little win32 API call here and there from Delphi or VB is not a big deal, the Microsoft documentation is usually sufficient for deciphering what to do.
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.

Last edited by Xenakios; 04-08-2008 at 10:56 AM.
Xenakios is offline   Reply With Quote
Old 04-08-2008, 11:09 AM   #35
Lawrence
Human being with feelings
 
Join Date: Mar 2007
Posts: 21,551
Default

Quote:
Originally Posted by robg View Post
What do you think Lawrence? I got the impression you were used to making Windows API calls from VB.
While making API calls in VB requires ...uh.. a little focus... ... once you grab the concept it's no big deal.

Google "VB API get handle" ... and you'll have dozens of examples on the net you can copy and paste into a Form_Load event, set some breakpoints and see what happens. In comparison to what I gather about doing similar in C++ it's pretty painless. Coding in VB is a joy.

I usually design almost the entire UI before I even write a line of code. Launch the app and it looks like an app, although it does nothing until you code it.

I'll do a screen capture of VB6 for those who aren't familiar with it just to show how simple it is. Anyone can learn to code basic stuff in vb in a matter of a couple of days if not hours.

Last edited by Lawrence; 04-08-2008 at 11:51 AM.
Lawrence is offline   Reply With Quote
Old 04-08-2008, 11:35 AM   #36
Lawrence
Human being with feelings
 
Join Date: Mar 2007
Posts: 21,551
Default

This 3 minute screen capture shows how ridiculously easy VB is.

http://www.theaudiocave.com/vb6/

Last edited by Lawrence; 04-08-2008 at 11:51 AM.
Lawrence is offline   Reply With Quote
Old 04-08-2008, 11:45 AM   #37
Chris_P_Critter
Human being with feelings
 
Chris_P_Critter's Avatar
 
Join Date: Mar 2008
Location: In a van, down by the river
Posts: 3,574
Default

[OT]

Here's my programming knowledge summed up in BASIC.

10 print "Chris_P_Critter is DUMB compared to y'all"
20 goto 10
30 end

You are all ROCKET SCIENTISTS!



[/OT]
Chris_P_Critter is offline   Reply With Quote
Old 04-08-2008, 01:19 PM   #38
Lawrence
Human being with feelings
 
Join Date: Mar 2007
Posts: 21,551
Default

Dude, Justin and Deric and the "true" coders of the world are in a whole nother class from VB'ers like myself. It's like a self taught keyboard player and a person who's been classically trained on the piano since they were 4.

They both can do things that a non-musician can't do and to the untrained eye (or ear) at a club gig doing a solo they might look and sound similarly skilled at times ... trust me, they're not.

I'm no rocket scientist (though I do play one on TV ). I have however seen Justin building a nuke on YouTube so...

Point being, I could teach you (or anyone) "basic" VB in a few days over the Internet and you'll be writing useful programs all by yourself. It's really that easy.

OTOH, what they do (at that level) really takes years to learn.

P.S. Your code above is an endless loop with no escape clause. Don't be so hard on yourself.

Last edited by Lawrence; 04-08-2008 at 01:39 PM.
Lawrence is offline   Reply With Quote
Old 04-09-2008, 07:16 AM   #39
Chris_P_Critter
Human being with feelings
 
Chris_P_Critter's Avatar
 
Join Date: Mar 2008
Location: In a van, down by the river
Posts: 3,574
Default

Oh - I hear you. I guess what I was implying is: There isn't a day that goes by where I am not completely astounded by the intellect and resourcefulness of the folks in this Reaper community.



Sorry for the second OT! Carry on!
Chris_P_Critter is offline   Reply With Quote
Old 05-16-2008, 01:17 AM   #40
hereander
Human being with feelings
 
Join Date: Mar 2008
Posts: 100
Default

Quote:
Originally Posted by Lawrence View Post
================================================== ==========
'Get the handle of the main window
DAW = FindWindow("REAPERwnd", vbNullString)

'The following window handles in Reaper are mapped to vars
' So you can drop a vb form inside any of those Reaper windows spaces

TrackList = FindWindowEx(DAW, 0, "REAPERTrackListWindow", "trackview")
TimeLine = FindWindowEx(DAW, 0, "REAPERTimeDisplay", "timeline")
Transport = FindWindowEx(DAW, 0, "REAPERVirtWndDlgHost", "Transport")
Track = FindWindowEx(DAW, 0, "REAPERVirtWndDlgHost", "")
Status = FindWindowEx(DAW, 0, "REAPERstatusdisp", "status")
Status = GetWindow(Transport, 5)

'This line placed my VB form inside the transport window space.
old_parent = SetParent(Main.hwnd, Transport)


=================================
How did you find those handles? I launched reaper and then spy++ but I could find any of these. I'd also like to try to add some stuff to the gui
hereander is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 04:25 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.