NO

Author Topic: Toolbar in rc  (Read 6507 times)

Offline Manos

  • Member
  • *
  • Posts: 35
    • The Coder's Corner
Toolbar in rc
« on: March 16, 2014, 06:14:24 pm »
Hi.
Is there a way to implement Toolbars in .rc script  like the follow ?

IDR_MAINFRAME TOOLBAR MOVEABLE PURE  24, 24
BEGIN
    BUTTON      ID_FILE_OPEN
    BUTTON      ID_FILE_SAVE
    SEPARATOR
    BUTTON      ID_EDIT_CUT
    BUTTON      ID_EDIT_COPY
    BUTTON      ID_EDIT_PASTE
END

Thank you,
Manos.

Offline Stefan Pendl

  • Global Moderator
  • Member
  • *****
  • Posts: 566
    • Homepage
Re: Toolbar in rc
« Reply #1 on: March 16, 2014, 07:07:49 pm »
If you use Open as => Text from the context menu of the .RC file in the project panel, you can enter your resources manually.

If the statements are listed at Resource-Definition Statements at MSDN, then they should be supported.
---
Stefan

Proud member of the UltraDefrag Development Team

Offline Manos

  • Member
  • *
  • Posts: 35
    • The Coder's Corner
Re: Toolbar in rc
« Reply #2 on: March 16, 2014, 08:17:36 pm »
Hi Stefan.

I have already written manually the above code but failed.
The statements TOOLBAR and BUTTON are not listed in Resource-Definition Statements at MSDN.
I must include the Toolbar in the .res file.

Manos.


LD Blake

  • Guest
Re: Toolbar in rc
« Reply #3 on: March 17, 2014, 05:53:22 am »
Hi Stefan.

I have already written manually the above code but failed.
The statements TOOLBAR and BUTTON are not listed in Resource-Definition Statements at MSDN.
I must include the Toolbar in the .res file.

Manos.

It is very unlikely you would be able to activate that toolbar if MSDN does not recognize the keywords.
Your best bet is to make the toolbar using CreateWindowEx().  You can, however, store the TBBUTTONS array in resources as RCDATA... This can be loaded into a malloced array at run time to initialize your buttons then freed when no longer needed.
 
 

Offline jj2007

  • Member
  • *
  • Posts: 508
Re: Toolbar in rc
« Reply #4 on: March 17, 2014, 08:58:25 am »
Hi Manos,

TOOLBAR is a valid identifier, but you need MFC (and header afxtoolbar.h) to use such toolbars, see LoadToolBar on MSDN. Which means Pelles C won't work for the TOOLBAR resource, sorry.
« Last Edit: March 17, 2014, 09:12:26 am by jj2007 »

Offline Manos

  • Member
  • *
  • Posts: 35
    • The Coder's Corner
Re: Toolbar in rc
« Reply #5 on: March 17, 2014, 10:38:36 am »
Thank you LD Blake and  jj2007.

I had written a DLL in VStudio that implements Toolbars from resources, (RT_TOOLBAR).
MS RC knows this.
I have now to rewrite this DLL with another way.

Manos.

LD Blake

  • Guest
Re: Toolbar in rc
« Reply #6 on: March 17, 2014, 12:03:39 pm »
Thank you LD Blake and  jj2007.

I had written a DLL in VStudio that implements Toolbars from resources, (RT_TOOLBAR).
MS RC knows this.
I have now to rewrite this DLL with another way.

Manos.

I'll take your word for what Visual Studio can do... It's C++ and it's got it's own set of tools.
 
Pelles C is not going to do it; this I know from having tried.
 
What may not be immediately obvious is that while Pelles C is a great compiler and CRT with an IDE to die for, it suffers from two very nasty limitations:
 
1) The Windows headers and libs are an incomplete set, representing only about 1/2 of what is available. 
 
2) The Windows headers and libs are largely outdated. Several have originated on Windows 2000 and never been updated. Most are from XP without updates.
 
I've raised these two points in the past and there's never been any strong interest in updating them, so I guess it is what it is.
 
« Last Edit: March 17, 2014, 12:06:34 pm by LD Blake »

Offline Manos

  • Member
  • *
  • Posts: 35
    • The Coder's Corner
Re: Toolbar in rc
« Reply #7 on: March 17, 2014, 12:39:25 pm »
 LD Blake,

I implemented a Test application in assembly using MS RC compiler
and my DLL works fine.
I think that the problem is in PoRC compiler.

Manos.

LD Blake

  • Guest
Re: Toolbar in rc
« Reply #8 on: March 17, 2014, 07:31:25 pm »
I implemented a Test application in assembly using MS RC compiler
and my DLL works fine.

I think that the problem is in PoRC compiler.

That's 1/3 of the problem. 
 
If you are working in POIDE's resource editor you will find it won't acknowledge the TOOLBAR resource type and will always present your .RC files as text, preventing use of the visual dialog and menu editors.
(A workaround for this problem is to put your toolbar in a separate .rc file, btw)
 
The last piece, if memory serves, is at least one header that is not included in Pelles distribution.
 
If you don't mind building from the command line, you may have better luck with the GORC compiler from the Go ASM collection.
 

Offline Manos

  • Member
  • *
  • Posts: 35
    • The Coder's Corner
Re: Toolbar in rc
« Reply #9 on: March 17, 2014, 08:06:12 pm »
Thank you LD Blake for your suggestion,
but I am building an IDE for assembly language and this IDE is a big work.
It is very difficult to build this from Command line using MS RC Compiler or other RC Compiler.
Pelle's IDE use its own RC Compiler.
How tell to Pelle's IDE to use MS RC Compiler ?
I don't think that it is possible.

Manos.
« Last Edit: March 17, 2014, 08:14:59 pm by Manos »

LD Blake

  • Guest
Re: Toolbar in rc
« Reply #10 on: March 17, 2014, 10:30:22 pm »
Thank you LD Blake for your suggestion,
but I am building an IDE for assembly language and this IDE is a big work.
It is very difficult to build this from Command line using MS RC Compiler or other RC Compiler.
Pelle's IDE use its own RC Compiler.
How tell to Pelle's IDE to use MS RC Compiler ?
I don't think that it is possible.

Manos.

It might be possible by placing the MS compiler in the Bin folder for Pelles C and manually editing the project settings... but I won't want to count on it since your changes may be overwritten.
 
Are you writing the IDE specifically in Pelles C? 
If so I genuinely don't envy the task ahead...
I know what's involved in even a tiny, special purpose IDE and I know it's no fun at all. 
 
To be honest, in your place I'd be looking for C++ tools to do this job.  You will find a lot better support with things like syntax highlighting edit controls, com and activex tools.  C++ will still let you write your code as "plain C" but the added support is there when you need it.  (POIDE was written in VC++)
 
You may want to look at Orwell's implementation of the old DEVC++ setup:  http://orwelldevcpp.blogspot.ca/   Like all IDEs this one has a couple of problems too... but at least it's 64bit C++ capable and comes with a full implementation of the Windows API. 
 
You might also consider http://www.codeblocks.org/ which will integrate nicely with the command line tools from the Microsoft SDK.   
 
You can still use POIDE as a resource editor... there's none better.
 
(btw... You do know the free compiler toolchain provided with the MSSDK does not include RC... right? You actually have to spend a thousand dollars or so to get it.)
 
 
 
 
 

Offline Manos

  • Member
  • *
  • Posts: 35
    • The Coder's Corner
Re: Toolbar in rc
« Reply #11 on: March 17, 2014, 11:21:16 pm »
Hi LD Blake.

I have written my IDE already with VC++2005 Express, in plain C, but I don't finished this yet.
I tried to translate in PelleC for better, but I am thinking to continue with PelleC,
since I have some limitations. But I don't choosed yet.
If you wish to see my IDE, that does not works yet, write me your email to send you.

Manos.


Offline Manos

  • Member
  • *
  • Posts: 35
    • The Coder's Corner
Re: Toolbar in rc
« Reply #12 on: March 18, 2014, 11:08:17 am »
The problem solved.

Vortex, an experienced programmer which is a friend of mine for about 10 years
and a contributor in my IDE, solved the problem.
The trick is the follow:

I builded a batch file named rescomp.bat.
In that I wrote: rc.exe %1 %3 %2
and in the PellesC\bin folder I puted MS RC.exe with its RCDLL.dll
together with rescomp.bat file.
In my IDE I edit ppj file like the following:
RC = rescomp.bat#
In this way, I bypass the PoRC and I tell to  PoIDE to use the MS RC instead of PoRC.
Thats All. My program works now OK.
In this way I can use Pelle's IDE for building my IDE.

Manos.

LD Blake

  • Guest
Re: Toolbar in rc
« Reply #13 on: March 18, 2014, 05:22:53 pm »
The problem solved.

Vortex, an experienced programmer which is a friend of mine for about 10 years
and a contributor in my IDE, solved the problem.
The trick is the follow:

I builded a batch file named rescomp.bat.
In that I wrote: rc.exe %1 %3 %2
and in the PellesC\bin folder I puted MS RC.exe with its RCDLL.dll
together with rescomp.bat file.
In my IDE I edit ppj file like the following:
RC = rescomp.bat#
In this way, I bypass the PoRC and I tell to  PoIDE to use the MS RC instead of PoRC.
Thats All. My program works now OK.
In this way I can use Pelle's IDE for building my IDE.

Manos.

Good to hear... the only risk is that if you change project settings it may get overwritten... but then you can just put it back.
 
Personally I create resizeable windows of any project the old fashioned way with repeated calls to CreateWindowEx(). But that is by no means manditory.
 
Good luck on your project.