Link to home
Start Free TrialLog in
Avatar of xTrEaSoNx
xTrEaSoNx

asked on

Visual Basic 5.0 Toolbar/Menu Style

Dear Experts,
   How do you create a Toolbar and Menu that have the same style as in Visual Basic 5.0?  Such as having it raise up when you pass over the image, or in the Menu, it has pictures next to some of the words.  I'm looking for code.  Please help.
-xTrEaSoNx-
Avatar of percosolator
percosolator

go here.

http://www.mvps.org/vbnet/

Go to "Code Library", "Common Control Routines"

find the link "Changing a VB Toolbar to a Rebar-Style Toolbar"

there is code and examples.


Avatar of xTrEaSoNx

ASKER

percosolator,
   That example was part of what i needed.  But i really need to know how to put images in the menu's.  Ex: a disk next to the 'New' located in a file menu.  Do you know where there is an example for this?
-xTrEaSoNx-

Put an image list on the form.  Load the image list with your desired images.

Set the "Image List" property of the toolbar to your image list (select your toolbar, press F4).

Assign the appropriate index to each button.


This is not 20-point question.
topol. This may not be a 20-point question but EE's not just for getting points but for helping out people with their problems.

xTrEaSoNx, I'm also looking for a way of implementing menus like the ones in VB 5.0.  I read something about the CommandBar control and it says that the CommandBar can make the Office-like menus and toolbars but from what I read, I think it's only for add-ins.  I'm still looking for a way to implement that menu and toolbar style but right now I have code for a substitute for the toolbar.  Just go to

    https://www.experts-exchange.com/topics/Q.10061288

It's a question I posted about Coolbars and an expert gave me a shorter code for implementing one.
pardon the grammar.  it should be "helping people out with their problems."
About images on the menus: go to http://www.cyberhighway.com/~psy/vbthunder/index.html
Click on the Source Code link. What you need is the very first example, called OwnMenu4.zip.
Why are you so picky about your grammar?
I've got a question about grammar: what if I needed to put something like prepositional phrase inside "helping people _____ out with their problems"?
For example, "helping people with headaches out with their problems? That is awful. I think you should just leave out "out" in this and previous cases.
topol,  please don't take my comment personally. I too would like to know the answer to this question but I just don't like the idea that someone who knows an answer wouldn't give it because the question is priced very low.  I'm not hitting you on this.  I just want to see the people in this site give answers or comments not because of the points but because they would like to help.  Now, please forgive me if I have offended you.

About the grammar, I just noticed the error it right after I posted the comment.  I wanted to correct it but I can't go back to it so I just posted another comment.  It's not to give emphasis on my comment but just to correct it.

I would also like to thank you for your help even though this is not my question.   The source code would also be of help to me.
You welcome
Dear Experts,
   I've been reading your comments to this question, and I'd like to make something clear.  The reason this question is worth 20 points, is...
a) I thought it would be a simple answer, yet it involved a certain VB5 trick I was unaware of.
b) I prevously asked a hard question, which inturn, drained my points.  I had but only 30 points when I first posted this question.  I will be more than happy to raise the point value if it means that much to you.  But if you think about it, all of us are benifiting from this question.  Those of you who are trying to help, yet do not know the exact answer will find out yourself, and I will be finding out the answer.
   Topol,  
  I went to the site and downloaded that source code.  As of right now I have not had the time to try it out, but if it works I thank you very much, and I will award you with the points.  If it's not really what I'm looking for, I will continue to let this question go in hope that it will be answered.
-xTrEaSoNx-
P.S - I do not have the best of grammer/spelling skills.  So please do not start to critisize.  Thanks!
He he. When i said "it is not a 20-point question", i meant that this question is worth no more than 10 points.
topol,

     I have tried out the source code and I can't seem to make it run properly.  It creates a GPF or sometimes a stack overflow.  Have you tried it out yourself?  If you have, did it work?  I think the problem's with

 wlOldProc = SetWindowLong(hWnd, GWL_WNDPROC, AddressOf OwnMenuProc)

  in the cmdPicMnu_Click() sub.  Do you know a solution for this problem?
Well, i did try this source code, and it worked fine, but that was previous version of it. I will download it and try.
Yeah... I just downloaded the code and tried to run it.
It gives off the following error: fault# 0000005 in OLEAUT32.DLL at address 014f:65341c47. I have already emailed the author regarding this problem.
Latest news: I found out exactly what line is causing crashes.
It is the first call of CopyMem in MsgProc.
The line is:
      Call CopyMem(DrawInfo, ByVal lParam, LenB(DrawInfo))
There are two other calls of this API, and i think the problem is in wrong arguements.
I am sorry: just wanna add, that those two lines are working fine.
Another update: RtlMoveMemory function simply moves the some chunk of memory from one location to another. It is just like pointer operations in C.  I see now why it creates GPF. I tried to substitute it with RtlCopyMemory, but it told me that there is no such entry in Kernel32.dll, though it is documented and must be there.
topol,
     thanks for taking the time to fix the problem. sorry I can't help in debugging it since I'm not that familiar with APIs and windows programming.  


Woo.... I found the problem. In the line i mentioned above, it should read
       Call CopyMem(DrawInfo, ByVal lParam, LenB(lParam))
instead of
       Call CopyMem(DrawInfo, ByVal lParam, LenB(DrawInfo))
Here comes the pain: another problem, but not so severe as the previous one. In the same procedure, the line #30 from the end (counting comments) generates "Subscript out of range".
The line is
  hPrint .Left + 25, .Top + 3, Caps(DrawInfo.itemID), lTextColor
By the way, if you changed RtlMoveMemory to RtlCopyMemory in your declaration, change it back.
Is this English or Programming? I cant remember...
Snell,
This is programming



Hi friends,
If you want the code for the above problem, just open a new project in VB5.0 and wizard will ask for what type of form you want, choose explorer style instead of standard style.

In the explorer style form, you have all the toolbars and menus as you wanted. I think this code will be useful to you.Hope this works for you.

If this is not the answer you are expecting then sorry I don't know more about your problem.

Regards,
mskannan.
ASKER CERTIFIED SOLUTION
Avatar of Snell
Snell

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial