|
There's a couple ideas I can throw your way, they come from the Microsoft Word MVP website under FAQ's VBA
http://word.mvps.org/
http://word.mvps.org/FAQs/MacrosVBA/AddMenu.htm
http://word.mvps.org/FAQs/MacrosVBA/LaunchExeFromToolbar.htm
http://word.mvps.org/FAQs/MacrosVBA/AttachMacroToButton.htm
I assume you are familiar with adding MS Office references into your projects. Once you've added the specific interop you want to work with, poke around there in the object browser. I was able to figure out a number of options and commands by doing so.
Still coaxing software out of the can after all these years...
|
|
|
|
|
Hallo guys...I've got a question for u.
How can we add new action on file menu when we do right click in that file?Like WinZip.When we do right click file .zip, we can see there's some actions like unzip,extract,or extract to..
Thanks for reply me..
|
|
|
|
|
HKEY_CLASSES_ROOT\exefile\shell\YourAppName\command\
YourAppName: this is what you are going to see in your right click menu.
command: you specify the path to your app exe probably with %1
For example if you have app called myapp.exe in C:\ and want to display
"start my app" on the right click menu
you said
HKEY_CLASSES_ROOT\exefile\shell\start my app\command\
in side of command you have
"C:\myapp.exe %l"l is not the number but alphabet 'L'
Just for your info
if you add the right click menu on directory
this is the place to add the same thing
HKEY_CLASSES_ROOT\Directory\shell\start my app\Command
Good Luck!
|
|
|
|
|
Thanks again for ur reply but...I still confuse.
How can we know that file,for example .zip,has been unziped or extract?Because u dont give any value for that things.
And..how can we do unzip and extract directly from that file menu?Is there any commands that might be added to your sample command(HKEY_CLASSES_ROOT\exefile\shell\start my app\command\"C:\myapp.exe %l"l )that will call to the function(ex:extract/unzip) on program(winzip)?
|
|
|
|
|
I guess i miss your point.( i am trying to meet the deadline...)
I think your have to add the extra parameter in the registery key.
so if you want to add start your app to unzip/zip you might put
two keys like the following
HKEY_CLASSES_ROOT\exefile\shell\my app unzip\command\C:\myapp.exe "unzip"
HKEY_CLASSES_ROOT\exefile\shell\my app zip\command\C:\myapp.exe "zip"
and you will see two menus in context menu. one is linking to your app with unzip parameter the other is zip. At your application side on the startup, you can see Command$ to figure out which menu has been clicked.
For example
msgbox Command$ ( you will see either "unzip" or "zip" in this case)
hope i answer your question right.
|
|
|
|
|
GREAT!!!!!Thanks a lot Van.
Ehm...but how if we wanna make both of them in one context menu?So..after we unzip,the context menu that will shows when we click again that file is zip.Is there another value, we must be added in registry or there's any function in vb that must be added to do this?
Sorry..and thank u
|
|
|
|
|
I haven't figure out yet.
I will need this in the future.
any can help?
van
|
|
|
|
|
Hi, Its great. Thanks a lot
But I have still problem with context menu.
They are:
- How can put icon in front of context menu??? Its the same as Winzip???
- How can retrieve the path and file name when I click right mouse on file. Its the same as Winzip.
Who can help me???
tramdtt
|
|
|
|
|
I recently received my free copy of VB .NET in the mail from microsoft and I'm having a little trouble. It seems as though I cannot create Mobile ASP .NET projects. However, in Visual C++ .NET I am able to create ASP .NET webservices. I receive the following error when I attempt to create the VB .NET Mobile Web Application: Error Message[^]. I am not sure if this is an IIS problem or if it is VB .NET. Any help would be appreciated.
Signature under construction.
|
|
|
|
|
Check this[^] little troubleshooting guide first.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi. I am a 15 years old and program things for fun, I happen to be working on a SNAKE game and ran into a little problem. I notice that the 'head' only eats the 'food' if it is exactly on the pixel of location as the 'food'. How can I fix this problem.
This is a copy of my head_move event procedure:
Private Sub Head_Move(ByVal sender As Object, ByVal e As System.EventArgs) Handles Head.Move<br />
<br />
If (Me.Head.Location.Y = Me.Food.Location.Y) And (Me.Head.Location.X = Me.Food.Location.X) Then 'checks wheather or not head had eaten the food<br />
createfood() 'creates new food using random number generator<br />
End If<br />
If Me.Head.Location.Y > 320 Then 'determines wheather or not head is in panel<br />
Game() 'resets all variables<br />
End If<br />
If Me.Head.Location.Y < 0 Then 'determines wheather or not head is in panel<br />
Game() 'resets all variables<br />
End If<br />
If Me.Head.Location.X > 384 Then 'determines wheather or not head is in panel<br />
Game() 'resets all variables<br />
End If<br />
If Me.Head.Location.X < 0 Then 'determines wheather or not head is in panel<br />
Game() 'resets all variables<br />
End If<br />
End Sub
superprogrammingdude is out yo.
|
|
|
|
|
superprogrammingdude wrote:
If (Me.Head.Location.Y = Me.Food.Location.Y) And (Me.Head.Location.X = Me.Food.Location.X) Then 'checks wheather or not head had eaten the food
You'd have to check if the Head.Location.X (and .Y) values fall between a range of values around where the food sits.
If (My.Head.Location.Y > (Me.Food.Location.Y - 5) AndAlso _
(My.Head.Location.Y < (Me.Food.Location.Y + 5) AndAlso _
(My.Head.Location.X > (Me.Food.Location.X - 5) AndAlso _
(My.Head.Location.X < (Me.Food.Location.X + 5) Then
'checks wheather or not head had easten the food
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I'm trying to view and print HPGL formatted graphics. Where I work wonk pop for a dll or controll, so I'm trying to roll my own.
I looked at the specs for it and thought to myself, "holy crap, this is gonna suck..."
so I opted for a different tract... I know that office 97 had the ability to import that format in, but everything after that dosent...
sooooo, i googled hpgl.exe to get the filter. I'm running office 02 and 03 and it still works.
so hers my question:
I want to use vb.net to creat a program to insert this graphic into excel, copy that pic and paste it into a picture box and view and/or print from there.
i know i can do this in a vba macro, but to back up a bit:
we have a DOS based program that scans and graphs data. when we want to print the graph it dumps the .hgl file into another dos program then to the printer through a batch file like so: c:\pp.exe test.hgl
I want to replace pp.exe w/ my program.
we can run it in a dos window, but for some reason we cant snagit, and i've tried all type of capture programs.
so with some research, I come up with this:
<br />
Private Sub insertImg()<br />
Dim ThisApplication As New Excel.ApplicationClass<br />
Dim ThisWorkBook As Excel.Workbook<br />
'ThisApplication.Visible = True<br />
Dim _stFileName As String = "c:\Test.xls"<br />
Dim _stLOGO As String = "c:\test.hgl"<br />
Dim missing As Object = System.Reflection.Missing.Value<br />
<br />
Try<br />
ThisWorkBook = ThisApplication.Workbooks.Open(_stFileName, missing, missing, 5, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing)<br />
<br />
Dim ThisSheet As Excel.Worksheet = CType(ThisWorkBook.Sheets(1), Excel.Worksheet)<br />
Dim oRange As Excel.Range = CType(ThisSheet.Cells(10, 1), Excel.Range)<br />
Dim oImage As Image = Image.FromFile(_stLOGO, False)'@@@<br />
System.Windows.Forms.Clipboard.SetDataObject(oImage, True)<br />
ThisSheet.Paste(oRange, _stLOGO)<br />
<br />
ThisSheet.Copy()<br />
picFromXl.Image = Clipboard.GetDataObject<br />
<br />
Catch oEx As Exception<br />
MsgBox(oEx.ToString, MsgBoxStyle.OKCancel, "ooops...")<br />
Finally<br />
<br />
ThisApplication.Quit()<br />
ThisWorkBook = Nothing<br />
ThisApplication = Nothing<br />
End Try<br />
End Sub 'insertImage<br />
when it gets to @@@ in the comments, it throws an exception:
An unhandled exception of type 'System.InvalidCastException' occurred in hpglViewer.exe
Additional information: Specified cast is not valid.
I just can't figure it out, any sugestions...?
Thanx,
Will
|
|
|
|
|
You trying to get the Image object to parse an .HGL file, a format which it knows nothing about. That's why your getting the InvalidCastException. You have to get Excel to import the Image for you, though I don't know, off the top of my head, how to do it. I can tell you that there is an import method (Open, I think) that is in the Excel Object Model.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
here is where i'm at now...
i open excell, insert the hgl file and it shows up, i copy it. so right there i fugure it's on the clipboard because i can paste it somewhere else.
code:
<br />
Dim xlApp As Excel.Application<br />
Dim xlBook As Excel.Workbook<br />
Dim xlSheet As Excel.Worksheet<br />
Dim obj As Object<br />
<br />
xlApp = CType(CreateObject("Excel.Application"), Excel.Application)<br />
xlBook = CType(xlApp.Workbooks.Add, Excel.Workbook)<br />
xlSheet = CType(xlBook.Worksheets(1), Excel.Worksheet)<br />
<br />
xlSheet.Application.Visible = True<br />
xlSheet.Range("A1").Select()<br />
xlBook.ActiveSheet.Pictures.Insert("C:\atest.hgl").Select()<br />
xlApp.ActiveSheet.Shapes("Picture 1").Copy()<br />
<br />
If Not System.Windows.Forms.Clipboard.GetDataObject() Is Nothing Then<br />
Dim oDataObj As IDataObject = System.Windows.Forms.Clipboard.GetDataObject()<br />
If oDataObj.GetDataPresent(DataFormats.Bitmap) Then 'this gets skiped<br />
Dim oImgObj As System.Drawing.Image = CType(oDataObj.GetData(DataFormats.Bitmap, True), Object)<br />
oImgObj.Save("c:\test.bmp", System.Drawing.Imaging.ImageFormat.Bmp)<br />
End If<br />
End If<br />
<br />
Try<br />
picHpgl.Image = CType(obj, Image)<br />
Catch ex As Exception<br />
picHpgl.Image = Nothing<br />
Finally<br />
xlBook.SaveAs(CType("c:\temp.xls", Object))<br />
xlApp.Quit()<br />
Kill("c:\temp.xls")<br />
End Try<br />
<br />
End<br />
i thought when the graphic got copied, it was copied as a bitmap... i can paste it to MS paint by hand.
so i am at a loss now...
i am useing vs.net 2003, office 2002 now, running xp...
as soon as i have found a way to attach the project and an hgl file, i will...
|
|
|
|
|
You would probably have to set a breakpoint at this line
If Not System.Windows.Forms.Clipboard.GetDataObject() Is Nothing Then
then execute your code. When that line is reached, step through the code one line at a time and watch the values that are returned from the Clipboard.Getxxxx functions. This will tell you what your missing, like the actual datatype that is being returned from the clipboard.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Is there any way to clear the Command$
Command$= ""
Erase Command$
are not working
|
|
|
|
|
VB6 I assume...
No, it's ReadOnly. Why would you want to?
There is alos no such thing an "Erase" statement, unless you coded a function or method by that name...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
i thought the erase statement cleared the contents of an array in vb.
Dim a(10) as String
Erase a
|
|
|
|
|
Whoops! You right, there is! I've been using VB since VB5 and never knoew it was there. Also, never had a reason to use it...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
What's the difference between
Dim buffer() as Byte
and
Dim buffer as Byte()
|
|
|
|
|
There isn't one. They both result in type Byte() and are equal to Nothing . They're both manipulated using the exact same methods.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
thanks dave.
so, the only difference is in style? it's up to the developer which they'd like to use? is there a preferred syntax?
-Brian
|
|
|
|
|
Not really. But in certain cases, like where you have to deserialize an XML stream back to an array, you would have to CType the XMLSerializer output to a class like this:
myClassArray = CType( myXMLSerializer.Deserialize(...), myClass() )
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
cool. so as far as initializing a array it doesn't
matter which you use. dim buffer() as byte and
dim buffer as byte() produce the same result.
it's only when casting something as an array that
you would use the array modifier on the type.
much appreciated. found this link on msdn poking
around.
http://msdn.microsoft.com/library/en-us/vbls7/html/vblrfvbspec6_8.asp?frame=true
thanks again.
-brian
|
|
|
|