|
-
October 12th, 2001, 10:18 AM
#1
running a C program from inside VB
Hi all
I have a C compiled code that I want to run from inside VB5.
The program run but it is not doing what it does if I run it from the explorer. I guess the problem is that it was written under DOS.
In fact it has a dos.h library and using a ABSREAD function.
1. is it possible to run it anyway from inside VB and obtain a desired result?
thanks in advance
elporti
2. Can someone help me to find another funtion that replaces ABSREAD with another that could run under Windows(95/98)?
-
October 13th, 2001, 02:04 AM
#2
Re: running a C program from inside VB
1. probably not. at least i don't think it would be easy.
2. what specifically are you trying to read from the disk? my assumption based off of what ABSREAD does, you should look at the DeviceIOControl function.
Software is like sex, it's better when it's free - Linus Torvalds
Software is like sex, it's better when I get paid for it. - me
-
October 13th, 2001, 04:59 PM
#3
Re: running a C program from inside VB
I guess you should run it using the built-in DOS. The problem is that you don't know which file it is (well, i don't... i guess there is a way to know). In winXP for example its cmd.exe so you should run cmd.exe c:\myprog.exe, i guess it should have the same results as using explorer.
----------
The @host is everywhere!
----------
-
October 14th, 2001, 03:01 PM
#4
Re: running a C program from inside VB
I am trying to determine if the proper diskette is placed in the A rive. When you use Absread you are reading data written in a disk.
What I am trying to do is to translate the AbsRead function (working under DOS) to a functions that would do the same under Windows. I have found that there is a library called FS_DirectDiskIO that could be the one I am looking for but I dont know if it belongs to C, C++, visual, C#, etc. Maybe someone knows and could help me.
elporti
-
October 14th, 2001, 04:37 PM
#5
Re: running a C program from inside VB
What are you searching for on the drive? A file? The volume name?
Software is like sex, it's better when it's free - Linus Torvalds
Software is like sex, it's better when I get paid for it. - me
-
October 15th, 2001, 08:02 AM
#6
Re: running a C program from inside VB
Yes, I am trying to read the volume name. Any suggestion of how can I do it?
elporti
-
October 15th, 2001, 08:12 AM
#7
Re: running a C program from inside VB
You can use the GetVolumeInformation API call.
'\\ Declaration
Declare Function GetVolumeInformation & _
Lib "kernel32" Alias "GetVolumeInformationA" & _
(byval lpRootPathName as string, byval & _
lpVolumeNameBuffer as string, byval & _
nVolumeNameSize as Long, lpVolumeSerialNumber as & _
Long, lpMaximumComponentLength as Long, & _
lpFileSystemFlags as Long, byval & _
lpFileSystemNameBuffer as string, byval & _
nFileSystemNameSize as Long) as Long
HTH,
Duncan
-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com
Check out the new downloads - ImageMap.ocx is the VB control that emulates an HTML image map, EventVB.OCX for adding new events to your VB form and adding System Tray support simply, MCL Hotkey for implemenmting system-wide hotkeys in your application...all with source code included.
-
October 15th, 2001, 12:48 PM
#8
Re: running a C program from inside VB
Thank you Duncan for your reply. It sounds like it is what I'm looking for.
Could you write an example of how to call this function? It would be something like
qcode = GetVolumeInformation(A,,,,,) ??
elporti
-
October 15th, 2001, 04:17 PM
#9
Re: running a C program from inside VB
You could use the FileSystem object. In your project, set a reference to Microsoft Scripting Runtime.
Dim fso as FileSystemObject
Dim d as Drive
set fso = new FileSystemObject
set d = fso.GetDrive("a:")
If d.IsReady then
MsgBox d.VolumeName
End If
set fso = nothing
set d = nothing
Software is like sex, it's better when it's free - Linus Torvalds
Software is like sex, it's better when I get paid for it. - me
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|