Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
W

WESHILL

@WESHILL
About
Posts
16
Topics
6
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Hooking application Open file calls
    W WESHILL

    Thanks. I will have a look.

    Visual Basic css help

  • Hooking application Open file calls
    W WESHILL

    Would you happen to have a sample of this in C++ or a site that I can go to for more info?

    Visual Basic css help

  • Hooking application Open file calls
    W WESHILL

    I would like to intercept open calls by any applications that try to open files with the *.txt, for example. I would like to perform some routine before the application proceeds with the open.

    Visual Basic css help

  • Hooking application Open file calls
    W WESHILL

    Hi, I have the following Keyboard hook module and would like to convert it so that it can hook application File Open call instead. Could someone help me with this. ........................................... Module TestHook Public Const WH_KEYBOARD = 2 Public Const VK_SHIFT = &H10 Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Integer, ByVal ncode As Integer, ByVal wParam As Integer, ByVal lParam As KBDLLHOOKSTRUCT) As Integer Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Integer) As Integer Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Integer, ByVal lpfn As Integer, ByVal hmod As Integer, ByVal dwThreadId As Integer) As Integer Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Integer) As Integer Public hHook As Integer Public Function KeyboardProc(ByVal idHook As Integer, ByVal wParam As Integer, ByVal lParam As KBDLLHOOKSTRUCT) As Integer 'if idHook is less than zero, no further processing is required If idHook < 0 Then 'call the next hook KeyboardProc = CallNextHookEx(hHook, idHook, wParam, lParam) Else 'check if SHIFT-S is pressed If (GetKeyState(VK_SHIFT) And &HF0000000) And wParam = Asc("S") Then 'show the result MsgBox("Shift-S pressed ...") End If 'call the next hook KeyboardProc = CallNextHookEx(hHook, idHook, wParam, lParam) End If End Function End Module Private Sub Form_Load() hHook = SetWindowsHookEx(WH_KEYBOARD, AddressOf KeyboardProc, App.hInstance, App.ThreadID) End Sub Private Sub Form_Unload(Cancel As Integer) 'remove the windows-hook UnhookWindowsHookEx hHook End Sub ........................................... Thanks,

    Visual Basic css help

  • Operator variable reference
    W WESHILL

    Thanks.

    Visual Basic tutorial question

  • Operator variable reference
    W WESHILL

    I know it seems silly. I was hoping to limit my coding. This is what I am trying to do... I have a combo box with (=, <, >, <>) operators in it and a piece of code that executes depending on the operator the user selects. Without the option to assign the operator a variable my coding become slightly longer with the use of a select statment that checks each possible option. Thanks,

    Visual Basic tutorial question

  • Operator variable reference
    W WESHILL

    Hi, Could someone tell me if it is possible to reference an operator, such as "=" or "<" with a variable? For example: Dim Var1 as Interger Dim VarRefOperator as ????? Var1 = 10 VarRefOperator = "=" If Var1 VarOperator 10 Then ' If Var1 = 10 Msgbox("do something") End If Thanks, weshill

    Visual Basic tutorial question

  • Threading and Filewatcher
    W WESHILL

    Hi, I want to be able to respond to file changes using filewatcher and during certain changes I would like to spawn a new thread to handle the function. The code below is what I have done during testing. If I rename a single file both fsw_Renamed() and MyTest() Eventlog entries reports the same file name from e.FullPath. However, If I rename say 8 files at the same time the eventlogging in fsw_Renamed() reports each file names but MyTest() eventlogging reports only one file name 8 times. The pvThreads counter works fine in that it will increment increment 8 time. ===================================== Public pvArgs as string Public pvThreads as Integer Public Sub fsw_Renamed(ByVal sender As Object, ByVal e As System.IO.RenamedEventArgs) Handles fsw.Renamed pvArgss = e.FullPath EventLog.WriteEntry(String.Format("Hello --- " & pvArgs), EventLogEntryType. _ Information, 8888) Dim thd As New Thread(AddressOf MyTest) thd.Start() End Sub Sub MyTest() pvThreads = pvThreads + 1 EventLog.WriteEntry(String.Format("MIG ---" & pvThreads & " : " & pvArgs), _ EventLogEntryType.Information, 9999) End Sub ===================================== Could some please assist? Thanks,

    Visual Basic testing beta-testing question

  • How to create a SPARSE file in VB.NET
    W WESHILL

    I have tried this and it works beautifully. Thanks so much. I have another question... I notice when the file is sparsed I have access to that space, however, when I try to copy or delete the Sparsed file the OS treats it like a regular file. For example, instead of coping 8kb of data it tries to copy 33gb. Is there a way to view the logical size as 33gb but tell the OS to treat it as an 8kb file during these type of manipulations? Thanks, I am not sure if there is someway besig

    Visual Basic csharp tutorial question

  • FileSystemWatcher event handler
    W WESHILL

    Hi, I would like to use the FileSystemWatcher to run and external command if a file is renamed. For example, if a file is renamed to *.__old the file is copied to a new location. So far I was able to make it work for 1 or 2 simultanious changes but there could be potentially 50 to 100 changes at the same time and it appears that there is a timeout waiting on the first command to execute. Could someone tell me how I could get the FileWatcher to handle multiple commands at the same time? Thanks....

    Visual Basic tutorial question

  • How to create a SPARSE file in VB.NET
    W WESHILL

    I will give this a try. The reason for this is that I want to copy the original file to tape, for example, then create an empty file of the same name, to free up space. This file will act as a reference to remind me that I do have a file by that name on tape. I know that I could create a 0 byte file but I prefer to see the original size of the file without actually having it use the disk space. I am hoping that Sparsing would help with this. Thanks for your help.

    Visual Basic csharp tutorial question

  • How to create a SPARSE file in VB.NET
    W WESHILL

    I've tried it but it dies with the following error..... ************** Exception Text ************** System.NullReferenceException: Object reference not set to an instance of an object. at WS_NTFS.Module1.DeviceIoControl(Int64 hDevice, Int64 dwIoControlCode, String& lpInBuffer, Int64 nInBufferSize, String& lpOutBuffer, Int64 nOutBufferSize, Int64& lpBytesReturned, String& lpOverlapped) at WS_NTFS.Form1.Button1_Click(Object sender, EventArgs e) in D:\@Projects\WeshillNTFS\NTFS_5_PT2_Src\WS_NTFS\Form1.vb:line 127 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

    Visual Basic csharp tutorial question

  • How to create a SPARSE file in VB.NET
    W WESHILL

    Hi, I am trying to create a SPARSE file that reflects the size of an original file. for excample, I would like to create a 33gb(Logical) file that is physically only a few bytes. I am able to create a 0(logical/physical) byte file only with the following code but I can't seem to get the Logical value assigned. Could someone tel me what I'm missing? Module Module1 Public Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" ( _ ByVal lpFileName As String, _ ByVal dwDesiredAccess As Integer, _ ByVal dwShareMode As Integer, _ ByVal lpSecurityAttributes As Integer, _ ByVal dwCreationDisposition As Integer, _ ByVal dwFlagsAndAttributes As Integer, _ ByVal hTemplateFile As Integer) As Integer Public Declare Function SetFilePointer Lib "kernel32" Alias "SetFilePointer" ( _ ByVal hFile As Integer, _ ByVal lDistanceToMove As Integer, _ ByVal lpDistanceToMoveHigh As Integer, _ ByVal dwMoveMethod As Integer) As Integer Public Declare Function SetEndOfFile Lib "kernel32" ( _ ByVal hFile As Integer) As Integer Public Declare Function CloseHandle Lib "kernel32" ( _ ByVal hObject As Integer) As Integer Public Declare Function DeviceIoControl Lib "kernel32" ( _ ByVal hDevice As Long, _ ByVal dwIoControlCode As Long, _ |ByVal lpInBuffer As String, _ ByVal nInBufferSize As Long, _ ByVal lpOutBuffer As String, _ ByVal nOutBufferSize As Long, _ ByVal lpBytesReturned As Long, _ ByVal lpOverlapped As String) As Long End Module Public Class Form1 Inherits System.Windows.Forms.Form Const _WIN32_WINNT = 5 Public Const CREATE_ALWAYS = 2 Public Const CREATE_NEW = 1 Public Const OPEN_ALWAYS = 4 'Create if doesn't exist Public Const OPEN_EXISTING = 3 Public Const TRUNCATE_EXISTING = 5 Public Const FILE_ATTRIBUTE_ARCHIVE = &H20 Public Const FSCTL_SET_SPARSE = &H900C4 Public Const MOVEFILE_REPLACE_EXISTING = &H1 Public Const FILE_ATTRIBUTE_TEMPORARY = &H100 Public Const FILE_BEGIN = 0 Public Const FILE_SHARE_READ = &H1 Public Const FILE_SHARE_WRITE = &H2 Public Const GENERIC_READ = &H80000000 Public Const GENERIC_WRITE = &H40000000 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim h Dim d Dim n Dim dw As Integer Dim lDist As Integer h = CreateFile("D:\Wes.log", GENERIC_WRITE + GENERIC_READ, 0, 0, CREATE_ALWAYS, 0, 0) dw = 0 d = DeviceIoControl(h, FSCTL_SET_SPARSE, n, 0, n, 0, dw, 0) lDist = 8 MsgBox(h & " " & lDist) SetFilePointer(h, 0, lDist, FILE_BEGIN) CloseHandle(h)

    Visual Basic csharp tutorial question

  • Change file size
    W WESHILL

    Hi, I gave the following a try but got nowhere. Could someone assist pls. ================================================================== Imports System.Runtime.InteropServices Private Declare Auto Function CreateFile Lib "kernel32" _ Alias "CreateFileA" ( _ ByVal lpFileName As FileInfo, _ ByVal hTemplate As Long, _ ByVal dwDesiredAccess As Long, _ ByVal dwShareMode As Long, _ ByVal lpSecurityAttributes As Long, _ ByVal dwCreationDisposition As Long _ ) As Long Public Declare Ansi Function DeviceIoControl Lib "kernel32" ( _ ByVal hFile As String, _ ByVal dwIoControlCode As Integer, _ ByVal lpInBuffer As Integer, _ ByVal nInBufferSize As Integer, _ ByVal lpOutBuffer As Integer, _ ByVal nOutBufferSize As Integer, _ ByRef lpBytesReturned As Integer, _ ByVal lpOverlapped As Integer) As Boolean Const CREATE_ALWAYS = 2 Const GENERIC_READ = &H80000000 Const GENERIC_WRITE = &H40000000 Sub command1_Click() dim h h = File.Open("d:\test.txt", FileMode.Create) DeviceIoControl(wes, FSCTL_SET_SPARSE, NULL, 0, NULL, 0, 84, 0) end sub ================================================================== Thanks...

    Visual Basic tutorial

  • Change file size
    W WESHILL

    Thank Rage...This is exatly what I am looking for. One other question: Do you know how to access the DeviceIOControl in VB? All the examples I've seen so far are in C++. Thanks, Wes...

    Visual Basic tutorial

  • Change file size
    W WESHILL

    Hi, Does anyone know how I could change the size description of a file without affecting the physical size. For example we could change a file's access date/time with "File.SetLastAccessTime(Path, AccessedDateTime)". I tried the following but it used/reserved the disk space I specified with sizeInBytes. fs = New System.IO.FileStream(Path, IO.FileMode.Open) fs.SetLength(sizeInBytes) Really i would like to make a 0 byte file look like 10mb for example. Thanks Wes...

    Visual Basic tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups