|
Ahh i guess my first post was horribly phased
Anyway yah, users can choose from the dialog box which files to be copied, but the location where the files are copied to is fixed. With "Files", i mean any types of files..
e.g. User chooses Example.txt from C:\, and it is copied to D:\.So now there's C:\Example.txt and D:\Example.txt.
The 1st question here is that i don't know how to do it.
|
|
|
|
|
The following code will handle copying of any file extension.
<br />
Dim FileDialog As New OpenFileDialog<br />
'FileInfo class has <br />
Dim myFile as System.IO.FileInfo<br />
<br />
With FileDialog<br />
if .ShowDialog() = DialogResults.Ok then<br />
'create FileInfo instance where .Filename is the fullpath of source <br />
'file. For example: C:\Example.txt<br />
myFile = new System.IO.FileInfo(.Filename)<br />
<br />
'FileInfo.Name property indicates the file name<br />
'For example: If the source file is C:\Example.txt than the FileInfo.Name<br />
'property is Example.txt<br />
myFile.CopyTo("D:\" & myFile.Name, false)<br />
<br />
'syntax: FileInfo.CopyTo(destfilename as String, forceoverwrite as Boolean)<br />
<br />
End If<br />
End With
I hope this makes sense
A.S.
|
|
|
|
|
i have a small req, that is in window application,
i have a datagrid with a check box in it, initially datagrid is empty/one blankrow . and two buttons AddButton, RemoveButton.
if i press a addButton the everytime one row has to add to the datagrid,i have to able to enter the data in datagrid,
If i select a check box of a row and press the removeButtonn that perticuler row has to remove from the datagrid.
Can anyone help me for the addButton and remButton click events with code
Thanks in advance.
ushar
raghu
|
|
|
|
|
DataGrid has to be bound to a DataSource before you can add and remove a row. Adding and removing of row has to be done in a recordset. Well I used VB6.0 and I used datagrid if I want to display the entire contents of a table. I the it does not require to be linked to a Datasource I use MSFlexGrid instead. I haven't explored it from VB.Net yet.
Hope this helps
|
|
|
|
|
hi everyone,
data types of the parameters in the pinvoke function or sub should passed by ByVal if it is a IN parameter and ByRef if it is IN/OUT parameter? just let me know if i'm correct...thanks!
|
|
|
|
|
Generally, yes. But what and how it's passed depends entirely on the parameter(s) of the function your calling. There are no hard and fast rules that work for every parameter.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I’m currently using IO.Directory.Delete(folderToDelete) to remove a folder. The problem is that it will not delete a folder that contains other folders and/or files.
Does anybody now how to remove a folder even if it has sub folders and/or files?
Could I use IO.Directory.Move(folderPathToDelete,"") or is that 'bad practice'?
Thank
Brad
|
|
|
|
|
|
|
Hello
Is there a way to retreive the action taken by a submit button with the WEBBROWSER activex?
I dont want the links, i want the exact action taken by the submit button
Page and String
tx
|
|
|
|
|
what do yuo mean by "action"? surely the action as you clearly state is to submit a form? What actual piece of info about the submit button are you after?
|
|
|
|
|
Again iam putting my question,I havse seen s/w that locks folder and files and prompt for password how can i similar achieve in vb6 and through which api
|
|
|
|
|
|
chanu1982@rediffmail.com wrote:
Again iam putting my question,I havse seen s/w that locks folder and files and prompt for password how can i similar achieve in vb6 and through which api
Wow! This is the first time you've mentioned that this is what you wanted to do with locking files and folders!
Next time, don't take 4 posts to explain what you really want to do!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Sorry sir,
I thought i annoyed you but my intention was not that , actually no one learns and become genius from by birth or from mother's belly . I have asked different question about at that time and these time and mostly you have answered thanks for that and accept sorry from these small programmer.
|
|
|
|
|
Hello
I wanted to know how to register an ActiveX.EXE file (writen in VB6).
as long as regsvr32.exe only registers ActiveX.dll and .OCX files.
I tried running the file, but it didn't help while I had a previously registered activex exe (which the same name) in some other location. when I try to create an object from the activex exe, the object returned from CreateObject is the object from the first activex..
How can I create an object from the second activex exe?
(THE FIRST ACTIVEX.EXE WAS REGISTERED BY VB6 WHILE I COMPILED IT)
Also I'd be glad if you tell me how to unregister the activex exe file?
Thanks in advance.
|
|
|
|
|
---------------------------
RegSvr32
---------------------------
Usage: regsvr32 [/u] [/s] [/n] [/i[:cmdline]] dllname
/u - Unregister server
/s - Silent; display no message boxes
/i - Call DllInstall passing it an optional [cmdline]; when used with /u calls dll uninstall
/n - do not call DllRegisterServer; this option must be used with /i
---------------------------
---------------------------
|
|
|
|
|
To extend what progload posted. You have to use RegSvr32 to unregister the first control, then you can use it to register the new one.
RegSvr32 /u c:\path\to\first\ActiveX.dll
RegSvr32 c:\path\to\new\ActiveX.dll
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi
I know the usage of regsvr32.
but you know, I said that my object is an ActiveX EXE not an ActiveX DLL.
and regsvr32 is unable to register activex exe files.
(My last file to register has an extention of .EXE rather than .DLL created using the ActiveX EXE template in vb6 projects.)
Do you know any other ways (rather than regsvr32 -which doesn't help in this case-) that help me mregister the active X exe?
Thanks
|
|
|
|
|
if it is a <activexfilename>.exe it is self-registering(does not need the flag to register),you just run it to register it or use the optional flag:
ActivexFileName.exe /regserver <<<--- optional flag
To UnRegister it, you run it with the flag like this:
ActivexFileName.exe /unregserver
Is this what your looking for?
progload
|
|
|
|
|
Thank you!
it was JUST what I was looking for.
|
|
|
|
|
I've been trying for days to write a piece of VB.NET code that will read from winamp's memory space the paths of the files from the current winamp playlist.
The GETPLAYLISTFILE command of the winamp API will only return a pointer to the position of the asked path. An article available on http://msmvps.com/ch21st/archive/2004/02/26.aspx provides a VB6 implementation of this, using the ReadProcessMemory Windows API command. Through digging and asking around, I managed to read the memory contents that winamp points to, but I can't seem to be able to decode them!
In the attached code below that contains all you need to recreate my problem. The function always returns the following giberish: "UVßwXjÝw
======================================================================
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br />
MsgBox(Me.GetPlaylistFile(0))<br />
End Sub<br />
<br />
Private Const PROCESS_VM_READ As Long = &H10<br />
Private Const IPC_GETPLAYLISTFILE = 211<br />
<br />
Private Declare Auto Function FindWindow Lib "user32" (ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr<br />
<br />
Private Declare Auto Function SendMessage Lib "user32" (ByVal hwnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As IntPtr<br />
<br />
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As IntPtr, ByRef lpdwProcessId As IntPtr) As IntPtr<br />
<br />
Private Declare Function OpenProcess Lib "kernel32" _<br />
(ByVal dwDesiredAccess As Integer, _<br />
ByVal bIneritHandle As Boolean, _<br />
ByVal dwProcessId As IntPtr) As IntPtr<br />
<br />
Private Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As IntPtr, ByRef lpBase As IntPtr, ByVal lpBuffer() As Byte, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Boolean<br />
<br />
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As IntPtr) As Boolean<br />
<br />
Private Function FindWinamp() As IntPtr<br />
Return FindWindow("Winamp v1.x", vbNullString)<br />
End Function<br />
<br />
Public Function GetPlaylistFile(ByVal TrackNo As Integer) As String<br />
Dim winampWindow As IntPtr = FindWinamp()<br />
Dim fileName As String = String.Empty<br />
<br />
If Not IsNullPtr(winampWindow) Then<br />
<br />
Dim lp As IntPtr = SendMessage(winampWindow, &H400, TrackNo, IPC_GETPLAYLISTFILE)<br />
<br />
If Not IsNullPtr(lp) Then<br />
<br />
Dim pid As IntPtr<br />
<br />
Call GetWindowThreadProcessId(winampWindow, pid)<br />
If Not IsNullPtr(pid) Then<br />
<br />
Dim hWinampProcess As IntPtr = OpenProcess(PROCESS_VM_READ, False, pid)<br />
<br />
If Not IsNullPtr(hWinampProcess) Then<br />
<br />
Dim buffer(1000) As Byte<br />
Dim bytesWritten As Integer<br />
<br />
If ReadProcessMemory(hWinampProcess, lp, buffer, buffer.Length, bytesWritten) Then<br />
<br />
fileName = System.Text.Encoding.Default.GetString(buffer)<br />
End If<br />
<br />
CloseHandle(hWinampProcess)<br />
End If<br />
<br />
End If<br />
<br />
End If<br />
<br />
End If<br />
<br />
Return fileName<br />
<br />
End Function<br />
<br />
<br />
Private Function IsNullPtr(ByVal ptr As IntPtr) As Boolean<br />
Return ptr.Equals(IntPtr.Zero)<br />
End Function<br />
|
|
|
|
|
Private Const WM_USER As Integer = &H400S
Private Const IPC_GETPLAYLISTFILE As Integer = 211
Private Const PROCESS_VM_READ As Integer = &H10S
Private Const IPC_GETLISTPOS As Integer = 125
Private Const MAX_PATH As Integer = 260
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _
ByVal lpszClassName As String, _
ByVal lpszWindowName As String _
) As Integer
Private Declare Function GetWindowThreadProcessId Lib "user32" ( _
ByVal hWnd As Integer, _
ByRef lpdwProcessId As Integer _
) As Integer
Private Declare Function OpenProcess Lib "kernel32" ( _
ByVal dwDesiredAccess As Integer, _
ByVal bInheritHandle As Integer, _
ByVal dwProcessId As Integer _
) As Integer
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" ( _
ByVal hWnd As Integer, _
ByVal Msg As Integer, _
ByVal wParam As Integer, _
ByVal lParam As Integer _
) As Integer
Private Declare Function ReadProcessMemory Lib "kernel32" ( _
ByVal hProcess As Integer, _
ByVal lpBaseAddress As Integer, _
ByRef lpBuffer As Byte, _
ByVal nSize As Integer, _
ByRef lpNumberOfBytesRead As Integer _
) As Integer
Private Declare Function CloseHandle Lib "kernel32" ( _
ByVal hObject As Integer _
) As Integer
Private hWndWinamp As Integer
Private Function GetWinampWindow() As Integer
GetWinampWindow = FindWindow("Winamp v1.x", vbNullString)
End Function
'// changed code
'// Public Function GetPlayingFileName() as String
Public Function GetFileName(ByVal iIndex As Integer) As String
Dim strFileName As String
Dim lp, lpWinamp As Integer
'// removed code
'//Dim iIndex As Integer
Dim PID As Integer
Dim bRet As Integer
Dim dwRead As Integer
Dim Buffer(MAX_PATH) As Byte
Dim Temp As String
hWndWinamp = GetWinampWindow()
If hWndWinamp = 0 Then
GetFileName = ""
Exit Function
End If
'// changed code
'// get currently playing song index number, from a zero based index
'//iIndex = SendMessage(hWndWinamp, WM_USER, 0, IPC_GETLISTPOS)
'//
'// send message to winamp and return file name and path of song
lp = SendMessage(hWndWinamp, WM_USER, iIndex, IPC_GETPLAYLISTFILE)
If lp = 0 Then
GetFileName = ""
Exit Function
End If
Call GetWindowThreadProcessId(hWndWinamp, PID)
lpWinamp = OpenProcess(PROCESS_VM_READ, 0, PID)
If lpWinamp = 0 Then
GetFileName = ""
Exit Function
End If
bRet = ReadProcessMemory(lpWinamp, lp, Buffer(0), MAX_PATH, dwRead)
Call CloseHandle(lpWinamp)
Temp = ConvertToStringFromBytes(Buffer)
strFileName = Temp.Trim
Return strFileName
End Function
Public Function ConvertToStringFromBytes(ByRef abData() As Byte) As String
Return System.Text.Encoding.Default.GetString(abData)
End Function
Private Sub Command1_Click(ByVal eventSender As System.Object, _
ByVal eventArgs As System.EventArgs) Handles Command1.Click
'// changed code
'//MsgBox(GetPlayingFileName())
MsgBox(GetFileName(0))
End Sub
|
|
|
|
|
hi
i use in my program access database.when i make setup from my program and publish it to cd and run it in another computer it dont recognize path of database
please help me
|
|
|
|
|
it might be helpful to post how your telling the program where to find the DB.
|
|
|
|