|
Thank you for your reply. I’m trying to change it according to my application..
Sorry for my delay
chatura
|
|
|
|
|
Hi, If you need to relate an extension type to your application, you can do it using the windows utilites, or a vb code. in windows, it's done using folder options in explorer. but in code I can help you, you should create some keys in the registry, it's very simple. you can also assign an Icon and add commands to it when you right click on a file like Edit in MyApplication or CompileFile... tell me if you need it.
but if you need that after having the type related, how to open it so:
when you double click on file, it's automatically sent to the related application as arguments. you can select multiple files and press enter so all files will be sent to you application as array of arguments.
you can catch all argument while loading application. someone tell you how using C#
but can you tell wich version of VB you use? is it vb.net or vb2005? so I can help you also...
OmarMallat
|
|
|
|
|
Sure... I'm using VB.Net 2005
I’m very sorry do not try to change the application which associate “.sln” files. They are solution files. I changed my extension. it is “.shln” files.
Sorry for my delay
chatura
|
|
|
|
|
I have this code in VS 2003
Private mobjListener As TcpListener
mobjListener = New TcpListener(5000)
mobjListener.Start()
ByVal client As TcpClient
client = mobjListener.AcceptTcpClient
dim strIpAddress as string
strIpAddress = client.Client.RemoteEndPoint.ToString
but the property Client is protected so...
so i want to get the ip address of the client without using mobjListener.acceptSocket
Regards,
Maher
|
|
|
|
|
You don't have a choice here. You can't get the address from the TcpClient object. So, you'll have to use AcceptSocket.
Dim clientSocket As Socket = mobjListener.AcceptSocket()
Dim clientAddress As IPAddress = CType(clientSocket.RemoteEndPoint, IPEndPoint).Address
Now, for some reason, MS left out the ability to create a TcpClient from a Socket object, sooo, make it yourself...
Public Class MyTcpClient
Inherits TcpClient
Public Sub New(ByVal s As Socket)
Me.Client = s
Me.Active = True
End Sub
End Class
.
.
.
Dim client As TcpClient = New MyTcpClient(clientSocket)
(code lifted from Experts Exchange...)
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
well acctully we can do this with out using AcceptSocket.
it is by using Reflection
and here is the code
PropertyInfo property = client.GetType().GetProperty("Client", BindingFlags.Instance | BindingFlags.NonPublic );
MethodInfo method = property.GetGetMethod( true );
Socket socket = ( Socket ) method.Invoke( client, null );
Regards,
Maher Abu Zer
|
|
|
|
|
You're still getting it from the Socket...
To each his own!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Sir ,
I want to add the desktop node in treeview and finally it should have my computer node , network neighbour node etc.
Please help me.
Thanks and Regards
Pankaj Garg
|
|
|
|
|
|
Hi All,
I posted this question in lots of places but i didnt get any satisfactory answer.
I am using a webchart tool called Mycos ( A web control)
I create a single chart with following code:
MycosChartWeb1.DataSource = CreateData()
MycosChartWeb1.DataBind()
creating single chart is not a big deal if i have a standard query with no parameter called ID.
if createData() is of type:
Private Function CreateData() As DataSet
Dim id As String
objConn = New SqlConnection(dbPath)
cmd = New SqlCommand("select period,scorecard,actual,target from ShirePlan where measureID='2.1.1.1' and period like '%2003%' ", objConn)
'cmd = New SqlCommand("select period,scorecard,actual,target from ShirePlan where measureID='" & ID & "'", objConn)
Dim da As New SqlDataAdapter(cmd)
Dim ds As New DataSet
da.Fill(ds)
Return ds
End Function
but in my case i have ID which ranges from zero to N records.
I need to create dataset for each ID like for measureID 2.1.1.1 i need to create new dataset and bind it to mycos
again for new measureID i have to do same.
Some one told me to use Dataview and someone said something i really dont know how to achieve this
please help me
many thanks in forward
|
|
|
|
|
Performance will suffer each time you have to go back to the database to get the records you need. Your best shot is to use a DataView on your DataTable so it returns all the records with at ID. It's a different View of the table. DataViews can be reconfigured quickly so...
What you'd probably do is retrieve a small table with all the UNIQUE (hint, hint) ID's you're going to use, then retrieve all the records that contain all the ID's you want in a seperate table.
Now, you'll iterate through the first table, with the ID's, and use each, one at a time, to build a DataView on the second table that will return only the records with that ID. You can then use the data in that DataView to bind to your control.
Dim dv As New DataView(dataTable)
With dv
.AllowDelete = False
.AllowEdit = False
.AllowNew = False
.RowFilter = String.Format("ID='{0}'", idToFind)
.Sort = "CompanyName DESC"
End With
' Bind you control to this DataView
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-- modified at 11:01 Thursday 2nd March, 2006
|
|
|
|
|
we want code in vb of thinning or skeletonization using hilditch algorithm( 2 passes) of colored image in vb. and also chain coding in same vb. pls help!
ami_doll2004@yahoo.com
|
|
|
|
|
After about 2 minutes on Google, it doesn't look like anyone has written any. So, if you "want code", you'll have to write it yourself.
As for "chain coding", you'll have to explain that further. I don't know what you're talking about here...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Okay here is what I want to do, I have an idea of how to do it but I am getting lost and my code is not helping me. I would like to take a grayscale image that is relatively dark and find the bright spots in it, say if I took a picture of the night sky, I would like to find all of the stars. I also want to find the center of each of these bright spots and log the x-y coordinates of them while putting a little red dot where the center of the white spot is, maybe 4px.
Here is what I have so far:
OpenPreviewWindow(lstDevices.SelectedIndex)
ToClipBoard()
ClosePreviewWindow(lstDevices.SelectedIndex)
Dim data As IDataObject
Dim bmap As Image
Data = Clipboard.GetDataObject()
If Data.GetDataPresent(GetType(System.Drawing.Bitmap)) Then
bmap = CType(Data.GetData(GetType(System.Drawing.Bitmap)), Image)
imgCapture.Image = bmap
End If
Dim objGr As Graphics = imgCapture.CreateGraphics
Dim imgHDC As IntPtr = objGr.GetHdc
Dim arrPixels(235, 315)
Dim x, y As Integer
For x = 0 To 235
For y = 0 To 315
arrPixels(x, y) = GetPixel(imgHDC, x, y)
Next
Next
Okay now that opens my camera, takes a snapshot, copies it to the clipboard, and closes the camera. The image is 320x240 and the loop gets the pixel color for each pixel. Now the problem with this code is that for a lot (75% or more) of the pixels it returns "-1" for the color, as if I am out of bounds on my x-y coords. The graphics object is to handle the .hDC in .NET 2005.
I want to know if there is a better way or faster way of going about this rather than pixel by pixel in a double loop scenario. Also I have no idea how to go about the second half of my program. Any help and example code will be greatly appreciated.
-Russ
-- modified at 22:43 Wednesday 1st March, 2006
|
|
|
|
|
Russ,
Can you give us a little more info...
What type of image is it your putting on the clipboard.. is it a bitmap, jpg.. ect. It makes a difference, you can not convert it from one format to another by just putting it on the clipboard. (most digital cameras are jpeg's) so if it is, you'll need to make sure its also taken off the clipboard as jpeg in your code first, then you can convert it to a bmp.
progload
|
|
|
|
|
 Here is my module for capturing the image, I believe it is capturing it in bitmap.
Module modCam
Const WM_CAP As Short = &H400S
Const WM_CAP_DRIVER_CONNECT As Integer = WM_CAP + 10
Const WM_CAP_DRIVER_DISCONNECT As Integer = WM_CAP + 11
Const WM_CAP_EDIT_COPY As Integer = WM_CAP + 30
Const WM_CAP_SET_PREVIEW As Integer = WM_CAP + 50
Const WM_CAP_SET_PREVIEWRATE As Integer = WM_CAP + 52
Const WM_CAP_SET_SCALE As Integer = WM_CAP + 53
Const WS_CHILD As Integer = &H40000000
Const WS_VISIBLE As Integer = &H10000000
Const SWP_NOMOVE As Short = &H2S
Const SWP_NOSIZE As Short = 1
Const SWP_NOZORDER As Short = &H4S
Const HWND_BOTTOM As Short = 1
Dim hHwnd As Integer ' Handle to preview window
Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, _
<MarshalAs(UnmanagedType.AsAny)> ByVal lParam As Object) As Integer
Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos" (ByVal hwnd As Integer, _
ByVal hWndInsertAfter As Integer, ByVal x As Integer, ByVal y As Integer, _
ByVal cx As Integer, ByVal cy As Integer, ByVal wFlags As Integer) As Integer
Declare Function DestroyWindow Lib "user32" (ByVal hndw As Integer) As Boolean
Declare Function capCreateCaptureWindowA Lib "avicap32.dll" _
(ByVal lpszWindowName As String, ByVal dwStyle As Integer, _
ByVal x As Integer, ByVal y As Integer, ByVal nWidth As Integer, _
ByVal nHeight As Short, ByVal hWndParent As Integer, _
ByVal nID As Integer) As Integer
Declare Function capGetDriverDescriptionA Lib "avicap32.dll" (ByVal wDriver As Short, _
ByVal lpszName As String, ByVal cbName As Integer, ByVal lpszVer As String, _
ByVal cbVer As Integer) As Boolean
Public Sub SaveImage()
Dim data As IDataObject
Dim bmap As Image
data = Clipboard.GetDataObject()
If data.GetDataPresent(GetType(System.Drawing.Bitmap)) Then
bmap = CType(data.GetData(GetType(System.Drawing.Bitmap)), Image)
frmMain.imgCapture.Image = bmap
bmap.Save("target.bmp", Imaging.ImageFormat.Bmp)
End If
End Sub
Public Sub ToClipBoard()
SendMessage(hHwnd, WM_CAP_EDIT_COPY, 0, 0)
End Sub
Public Sub LoadDeviceList()
Dim strName As String = Space(100)
Dim strVer As String = Space(100)
Dim bReturn As Boolean
Dim x As Integer = 0
Do
bReturn = capGetDriverDescriptionA(x, strName, 100, strVer, 100)
If bReturn Then frmMain.lstDevices.Items.Add(strName.Trim)
x += 1
Loop Until bReturn = False
End Sub
Public Sub OpenPreviewWindow(ByVal iDevice As Integer)
Dim iHeight As Integer = frmMain.imgCapture.Height
Dim iWidth As Integer = frmMain.imgCapture.Width
hHwnd = capCreateCaptureWindowA(iDevice, WS_VISIBLE Or WS_CHILD, 0, 0, 640, _
480, frmMain.imgCapture.Handle.ToInt32, 0)
If SendMessage(hHwnd, WM_CAP_DRIVER_CONNECT, iDevice, 0) Then ' Connect to device
SendMessage(hHwnd, WM_CAP_SET_SCALE, True, 0) 'Set the preview scale
SendMessage(hHwnd, WM_CAP_SET_PREVIEWRATE, 1, 0) 'Set the preview rate in milliseconds
SendMessage(hHwnd, WM_CAP_SET_PREVIEW, True, 0) 'Start previewing the image from the camera
SetWindowPos(hHwnd, HWND_BOTTOM, 0, 0, frmMain.imgCapture.Width, frmMain.imgCapture.Height, _
SWP_NOMOVE Or SWP_NOZORDER) 'Resize window to fit in picturebox
Else
DestroyWindow(hHwnd)
End If
End Sub
Public Sub ClosePreviewWindow(ByVal iDevice As Integer)
SendMessage(hHwnd, WM_CAP_DRIVER_DISCONNECT, iDevice, 0)
DestroyWindow(hHwnd)
End Sub
End Module
|
|
|
|
|
Russ,
Yes, looks like a bitmap, thanks for letting me see the code...
Ok, you can change your code to this, to get it grayscale...
data = Clipboard.GetDataObject()
If data.GetDataPresent(GetType(System.Drawing.Bitmap)) Then
bmap = CType(data.GetData(GetType(System.Drawing.Bitmap)), Image)
imgCapture.Image = bmap
Dim bm As New Bitmap(bmap)
Dim X As Integer
Dim Y As Integer
Dim clr As Integer
'
'Adjust your grayscale here:
'
For X = 0 To bm.Width - 1
For Y = 0 To bmap.Height - 1
clr = (CInt(bm.GetPixel(X, Y).R) + _
bm.GetPixel(X, Y).G + _
bm.GetPixel(X, Y).B) \ 3
bm.SetPixel(X, Y, Color.FromArgb(clr, clr, clr))
Next Y
Next X
imgCapture.Image = bm
End If
Hope that helps..
progload
|
|
|
|
|
Oh, the image is already captured as grayscale by a setting in my camera. I would like to find the bright spots of the image and locate the x-y coordinates of them and then put a red dot on top of those coordinates. Thanks.
-Russ
|
|
|
|
|
Hello,
I am working on a function that displays the differences in two files. However, this can take minutes when the files are 1 MB or greater. is there a quick way to compare two files on a byte to byte basis and return the offset of the differing bytes and the bytes located there?
Thanks.
|
|
|
|
|
There's nothing that will do it for you, if that's what you're asking. I'd probably start by reading a good size block of each file into its own buffer, then compare what's in the buffers. Reading one byte at a time from each file and comparing will probably be the slowest way you can do it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I was afraid to hear that. Sadly, that is how I am currently doing it. Thanks for the reply.
|
|
|
|
|
In mp3 files there are tags/properties of Artist Name, Song Name, Album Name. Is there any way through which i can fetch these values (provided i have a list of mp3 files) into variables.
Pls help
Thanks 
|
|
|
|
|
|
Thanks 
|
|
|
|
|
Hi,
I am facing a strange problem in this. When i try to trap the value of artist and title as:
dim artist as string
artist = objMP3V1.Frame(MP3ID3v1.FrameTypes.Artist)
dim title as string
title = objMP3V1.Frame(MP3ID3v1.FrameTypes.title)
dim new Name as string
newName = artist + title
The variable 'newName' does not contain the values of both title and artist. It only contains of artist whereas individually i am able to see the values of artist (msgbox(artist)) and title (msgbox(title)).
Pls reply within half hour.......
|
|
|
|
|