|
Ever seen the tab control on Windows messenger? I know that it is actually a web page but I got the idea of somehow turning it into a windows forms control. However, I got into a snag custom drawing the tabcontrol. I can't seem to resize it so that it has space to display an icon instead of text nor can I custom draw the tab itself, just the same old boring rectangle - not the cool, new curved tabs like messenger. Any ideas?
|
|
|
|
|
Hi
Is there a function that let me create a shortcut to an app?
say on the desktop?
Thanks
|
|
|
|
|
There is no function in the .NET BCL that will handle this. You will have to use the Microsoft Scripting Runtime (set a COM reference to this!), create a Windows Scripting Shell object and use it to create the shortcut. Something like this (I think!):
Dim WshShell As New WScript.Shell
Dim oShellLink As WScript.Shortcut = WshShell.CreateShortcut(strDesktopPath & "\Shortcut Script.lnk")
oShellLink.TargetPath = WScript.ScriptFullName
oShellLink.WindowStyle = 1
oShellLink.Hotkey = "CTRL+SHIFT+F"
oShellLink.IconLocation = "notepad.exe, 0"
oShellLink.Description = "Shortcut Script"
oShellLink.WorkingDirectory = strDesktop
oShellLink.Save
I haven't tested this code, but it should look SOMETHING like this. I don't have Visual Studio where I'm at work, so I would have to wait until I got home to create a runnable example.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
See if you can consider creating shortcut at the time of deployment wherever you need using Setup projects. I suppose, this would be the best .NET solution.
BK
|
|
|
|
|
Hi
Im writing a app and I have a problem. I want my app will add one menuitem on menu system of Window???
Example::: When I open Window Explorer, click right mouse button on a folder, will appear one menupopup of window. I want on that menu will contain my menuitem. Its the same as Winzip application. Winzip has one menuitem on menu system of Window after you installed winzip...
Who can help me????
Thanks
Good luck
tramdtt
|
|
|
|
|
You'd have to associate your application with windows as being able to handle that particular file type. You'd have to be able to get the ProgID of your application then add that ProgID to the registry.
Your App's ProgID
HKEY_CLASSES_ROOT\Your_App
Default=Your App Name
\curver
Default=Your_Company.Your_App.Version
friendlyname=@Your_App
\shell\open\Command
Default=%Path to your App%\Your_App.exe %1
Then place something like this into
HKEY_CLASSES_ROOT\*.Your_App_File_Type
Default=Your_Company.Your_App.Version
Or if you want to handle folder types, look for the '*' filetype. If your really curious, you can find the Winzip registry entries there too.
Phew!!! There must be an easier way!!! If you find it, find me!!!
|
|
|
|
|
Before you tackle adding items to the Shell Context Menu, you might want to read Creating Context Menu Handlers[^] on MSDN. There are links in that article going to other pages that give additional background information that you will probably have to follow in order to completely grasp what is going on and why.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
Can anybody tell me How to find some application is running in system tray or not using Visual Basic.
I want to know only the appliction running in system tray not all the processes running in system.
So, if some specified application is running in system tray i need to close it. So how can i achieve this using vb6.
Thanking you all
Praveen
|
|
|
|
|
pampatipraveen wrote:
I want to know only the appliction running in system tray not all the processes running in system.
There is no difference between the two. They are both normal processes. The icon in the Tray is controlled entirely by the application. You'll still have to iterate through the entire process list to find the processes your looking for and then close them.
TaskList in VB6[^]
Once you have the app you're trying to close, then closing it is a whole other matter. You must take care when closing an app. It's not as easy as it may sound...
Kill An App Gently[^]
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
In side of my application i am launching outlookexpress
with email address and subject line with content. in the content
i want to have hyperlink text just you can do "insert->hyperlink" in
outlookexpress
str_Temp = mailto:info@mydomain.com?&Subject="hello"&body="click here"
ShellExecute Me.hWnd, "open", str_Temp, vbNull, vbNull, SW_SHOWNORMAL
I want to have Click here as hyperlink not just text line.
I tried to put click here for the body
but when i launch outlookexpress, content is only text.
I don't know how can i achieve this.
Thanks in advance
shin
|
|
|
|
|
This is the stupidest question. I'm quite new to VB, and i'm trying to find out what is the escape character.
For example, I am trying to do the following:
Formula = "This is a "STRING" inside a string"
How can I make it so that the " chars are escaped in the center part.
In C/C++/C#, i can escape with \
Thanks in advance,
Jon
|
|
|
|
|
Put two quote marks together. There is no escape character in VB...
Dim formula As String
formula = "This is a ""STRING"" inside a string"
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Another way to do that would be to use the ChrW() function. 34 is the Char number of the quote, so you could say,
Dim Formula As String = "This is a " & ChrW(34) & "STRING" & ChrW(34) & " inside as string"
Aaron Eldreth
TheCollective4.com
My Articles
While much is too strange to be believed,
Nothing is too strange to have happened.
- T. Hardy
|
|
|
|
|
You could... but which way is less typing and, therefore, less prone to errors?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks guys, both methods worked.
In fact, i read up on the CHR(34) method... and thats what I used.
What is the difference with CHR and CHRW?
Here was my final result:
Formula = "=IF(A" & RowPtr & "=" & Chr(34) & Chr(34) & "," & Chr(34) & Chr(34) & ",E5)"
Pretty ugly looking code. I think VB should consider an escape char in the next release
|
|
|
|
|
This is taken straight out of the MSDN documentation:
Public Function Chr(ByVal CharCode As Integer) As Char
Public Function ChrW(ByVal CharCode As Integer) As Char
Chr uses the Encoding class in the System.Text namespace to determine if the current thread is using a single-byte character set (SBCS) or a double-byte character set (DBCS). It then takes CharCode as a code point in the appropriate set. The range can be 0 through 255 for SBCS characters and -32768 through 65535 for DBCS characters. The returned character depends on the code page for the current thread, which is contained in the ANSICodePage property of the TextInfo class. TextInfo.ANSICodePage can be obtained by specifying System.Globalization.CultureInfo.CurrentCulture.TextInfo.ANSICodePage .
ChrW takes CharCode as a Unicode code point. The range is independent of the culture and code page settings for the current thread. Values from -32768 through -1 are treated the same as values in the range +32768 through +65535.
Numbers from 0 through 31 are the same as standard, nonprintable ASCII codes. For example, Chr(10) returns a linefeed character.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
have some xml document describing our database.
I have an element
in side of that document for empty element, but
when I parse it using DOM in VB
For Each rowElement In xmlDoc.documentElement.childnodes
str_content = rowElement.childnodes(0).nodeValue
Next
when I have NULL in the element I have application error
said "NULL is not properly used". I tried to filter the
NULL by
If rowElement.childnodes(0).nodeValue = NULL then
....
however, vb doesn't recognize this null
do you think i should not use
for empty element in the first place?
there is another solution?
Thanks for help
shin
|
|
|
|
|
If I read the documentation correctly, the only way you can have a null value for a CDATA section is if it looks like this:
<![CDATA[]]>
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|
I found some software that can get the computer id. I'm doing a project that needs to get the computer id for security. Could somebody help me and show me how to get computer id in vb.net?
Thanks a bunch.
John
|
|
|
|
|
I take it your looking for the ComputerName, or NETBIOS Name, of the computer?
You can get that from the Environment.MachineName property.
Dim compName As String = Environment.MachineName
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I would like to know if there is a way to show the progress, using the progressbar, of the dataadapter fill command.
|
|
|
|
|
No. This is because the DataAdatper doesn't fire any events that you could use as progress. On top of that, the DataAdapter can't tell you how many records it is GOING to retrieve before it starts retrieving them. You'd have to do a query to get the number of records your GOING to retrieve, then do multiple queries in blocks of, say, 10 records at a time to fill the dataset and, in between those blocks of records, update the ProgressBar.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Please help me.
I want to build a xp themed numericupdown control, I Inherits NumericUpDown class and use API function to draw board and updown button in Onpaint events.
But it doesn't work,the numericupdown isn't redrawed. And I found if I inherits UserControl it works perfect.
Source Code:(only paint,no other function)
Imports System.Drawing
Imports System.Windows.Forms
Namespace WaterSoft
<toolboxbitmap(gettype(xpnumericupdown))> _
Public Class XPNumericUpDown
'Inherits NumericUpdown doesn't work
Inherits NumericUpDown
'Inherits UserControl it work perfect,someone can test it.
'Inherits UserControl
Private Structure RECT
Public left As Integer
Public top As Integer
Public right As Integer
Public bottom As Integer
End Structure
Private Declare Function IsAppThemed Lib "uxtheme.dll" () As Boolean
Private Declare Function IsThemeActiveXP Lib "uxtheme.dll" Alias "IsThemeActive" () As Boolean
Private Declare Unicode Function OpenThemeData Lib "uxtheme.dll" _
(ByVal hwnd As IntPtr, ByVal pszClassList As String) As IntPtr
Private Declare Unicode Function CloseThemeData Lib "uxtheme.dll" _
(ByVal hTheme As IntPtr) As Integer
Private Declare Unicode Function DrawThemeBackground Lib "uxtheme.dll" _
(ByVal hTheme As IntPtr, ByVal hDC As IntPtr, _
ByVal iPartId As Integer, ByVal iStateId As Integer, _
ByRef pRect As RECT, _
ByRef pClipRect As RECT _
) As Integer
Private rectUp As RECT
Private rectDown As RECT
Public Sub New()
MyBase.New()
' This call is required by the Windows Forms Designer.
'InitializeComponent()
' Add any initialization after the InitializeComponent() call.
Me.SetStyle(ControlStyles.DoubleBuffer _
Or ControlStyles.UserPaint _
Or ControlStyles.AllPaintingInWmPaint _
Or ControlStyles.ResizeRedraw, _
True)
Me.UpdateStyles()
End Sub
#Region "其它函数"
Private Function IsThemedXP() As Boolean
Dim intVer As Integer
intVer = Environment.OSVersion.Version.Major * 10 + Environment.OSVersion.Version.Minor
If intVer >= 51 And IsThemeActiveXP And IsAppThemed Then
Return True
Else
Return False
End If
End Function
#End Region
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
MyBase.OnPaint(e)
Application.DoEvents()
If IsThemedXP() Then
If True Then 'Me.UpDownAlign = LeftRightAlignment.Left Then
rectUp.left = 1
rectDown.left = 1
Else
rectUp.left = Me.Width - 18
rectDown.left = Me.Width - 18
End If
With rectUp
.top = 1
.right = .left + 17
.bottom = .top + 9
End With
With rectDown
.top = 11
.right = .left + 17
.bottom = .top + 9
End With
Dim br As Brush = New SolidBrush(Me.BackColor)
e.Graphics.FillRectangle(br, e.ClipRectangle)
br.Dispose()
Dim hTheme As IntPtr = IntPtr.Zero
Dim hDC As IntPtr = e.Graphics.GetHdc()
Dim rectPic As RECT
With rectPic
.left = 0
.top = 0
.right = Me.Width
.bottom = Me.Height
End With
Select Case Me.Enabled
Case True
hTheme = OpenThemeData(Me.Handle, "Edit")
DrawThemeBackground(hTheme, hDC, 1, 1, rectPic, rectPic)
CloseThemeData(hTheme)
hTheme = OpenThemeData(Me.Handle, "Spin")
DrawThemeBackground(hTheme, hDC, 1, 1, rectUp, rectUp)
CloseThemeData(hTheme)
hTheme = OpenThemeData(Me.Handle, "Spin")
DrawThemeBackground(hTheme, hDC, 2, 1, rectDown, rectDown)
CloseThemeData(hTheme)
Case False
hTheme = OpenThemeData(Me.Handle, "Edit")
DrawThemeBackground(hTheme, hDC, 1, 4, rectPic, rectPic)
CloseThemeData(hTheme)
hTheme = OpenThemeData(Me.Handle, "Spin")
DrawThemeBackground(hTheme, hDC, 1, 4, rectUp, rectUp)
CloseThemeData(hTheme)
hTheme = OpenThemeData(Me.Handle, "Spin")
DrawThemeBackground(hTheme, hDC, 2, 4, rectDown, rectDown)
CloseThemeData(hTheme)
End Select
e.Graphics.ReleaseHdc(hDC)
End If
End Sub
Protected Overrides Sub OnSizeChanged(ByVal e As System.EventArgs)
MyBase.OnSizeChanged(e)
Me.Refresh()
End Sub
End Class
End Namespace
|
|
|
|
|
The reason your OnPaint method doesn't work, is because the Numeric Up/Down control is derrived from the Windows common control, and Windows handles the drawing of the NUD.
To accomplish what you want, you need to derrive from the Control or UserContrl (which you have), and do the painting yourself.
Aaron Eldreth
TheCollective4.com
My Articles
While much is too strange to be believed,
Nothing is too strange to have happened.
- T. Hardy
|
|
|
|
|