Help! I Can't Find My Entry Point! - Page 1
Forum section: electronics / general

author: SuzyC
author_rank: Frequent Contributor
timestamp: April 28, 2015, 11:52:23 am
content: I am trying to use VB6 or VB2010 to make a program to use the PC's parallel port to input a lot of debug data from my MCU code work and display/graph the results to debug my MCU projects.The VB2010 Suite Project which compiles without error is attached below.However, XP prohibits direct access to the parallel port and what's worse, VBasic(VB6) and VB.net has no built-in port out and inp commands.So, after hours of searching for a way to access the parallel port using Vb, going through tens of damaged links and crap run-around advice on many forum websites, I finally found a utility that works with an included pre-compiled sample .exe program The download also includes its source code and binaries, etc. However, even though I can run the sample winio.exe program to run perfectly and although i can compile the code to create the winio32.dll using Visual Studio 2010,I cannot get the .dll entry point or be able to add the Winio32.dll to the Windows XP registry so I can get it to work with any C or VB PC program.On Windows XP SP3 I get the error registering the .dll. When using REGSVR32.exe..".dll is loaded, but cannot find entry point."Can anyone help me find it?Take a look, the whole Winio original code and VB2010 solution shabang and source is attached.PS, I have already tried other programs supposed to work with XP and and got nothing but sobs and sorrow with:InpOut32.dll (crashes VB6)PORTTALK22 (Works with extreme legacy QBASIC but doesn't have an interface to VB6 or VB.net)Win95io (Slows PC to slower than snail marathons)UserPort(slows down the PC!)Just because I want to use the Parallel Port on my PC shouldn't get you all to call me a "serial" killer.

author: neslekkim
author_rank: Super Contributor
timestamp: April 28, 2015, 12:06:56 pm
content: the winio32.dll is not an com-component/registerable dll..Did you try the samples ?If you read the sample source, you see that LoadLibrary is used to load the dll at runtime, and the methods are declared like this:[UnmanagedFunctionPointer(CallingConvention.StdCall)]private delegate bool SetPhysLongType(IntPtr PhysAddr, UInt32 PhysVal);which is interop-definitions.Just make sure you have the files in the same folder as the running exe, and you should be good to go.

author: SuzyC
author_rank: Frequent Contributor
timestamp: April 28, 2015, 12:29:26 pm
content: Thanks, neslekkim, I wish I knew as much about this as you, and the samples(already provided .exe compiled work) but how do I modify my code to tell VB2010 to use the load library code you suggest?I can't find the loader code you describe in the successfully compiled VB2010 program initialization below(Which fails when clicking on the VB2010 IDE "start debug"..with errors)// ---------------------------------------------------- //// WinIo v3.0 //// Direct Hardware Access Under Windows //// Copyright 1998-2010 Yariv Kaplan ////http://www.internals.com//// ---------------------------------------------------- //using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Runtime.InteropServices;using System.Diagnostics;namespace DumpPort{public unsafe partial class Form1 : Form{[DllImport("kernel32.dll")]private extern static IntPtr LoadLibrary(String DllName);[DllImport("kernel32.dll")]private extern static IntPtr GetProcAddress(IntPtr hModule, String ProcName);[DllImport("kernel32")]private extern static bool FreeLibrary(IntPtr hModule);[UnmanagedFunctionPointer(CallingConvention.StdCall)]private delegate bool InitializeWinIoType();[UnmanagedFunctionPointer(CallingConvention.StdCall)]private delegate bool GetPortValType(UInt16 PortAddr, UInt32* pPortVal, UInt16 Size);[UnmanagedFunctionPointer(CallingConvention.StdCall)]private delegate bool SetPortValType(UInt16 PortAddr, UInt32 PortVal, UInt16 Size);[UnmanagedFunctionPointer(CallingConvention.StdCall)]private delegate bool ShutdownWinIoType();IntPtr hMod;public Form1(){InitializeComponent();}private void Form1_Load(object sender, EventArgs e){// Check if this is a 32 bit or 64 bit systemif (IntPtr.Size == 4){hMod = LoadLibrary("WinIo32.dll");}else if (IntPtr.Size ==8){hMod = LoadLibrary("WinIo64.dll");}if (hMod == IntPtr.Zero){MessageBox.Show("Can't find WinIo dll.\nMake sure the WinIo library files are located in the same directory as your executable file.", "DumpPort", MessageBoxButtons.OK, MessageBoxIcon.Error);this.Close();}IntPtr pFunc = GetProcAddress(hMod, "InitializeWinIo");if (pFunc != IntPtr.Zero){InitializeWinIoType InitializeWinIo = (InitializeWinIoType)Marshal.GetDelegateForFunctionPointer(pFunc, typeof(InitializeWinIoType));bool Result = InitializeWinIo();if (!Result) //============== THIS IS THE ERROR Msg I AM GETTING ============={MessageBox.Show("Error returned from InitializeWinIo.\nMake sure you are running with administrative privileges and that the WinIo library files are located in the same directory as your executable file.", "DumpPort", MessageBoxButtons.OK, MessageBoxIcon.Error);FreeLibrary(hMod);this.Close();}}btnGetValue_Click(this, null);}private void btnQuit_Click(object sender, EventArgs e){IntPtr pFunc = GetProcAddress(hMod, "ShutdownWinIo");if (pFunc != IntPtr.Zero){ShutdownWinIoType ShutdownWinIo = (ShutdownWinIoType)Marshal.GetDelegateForFunctionPointer(pFunc, typeof(ShutdownWinIoType));ShutdownWinIo();FreeLibrary(hMod);}this.Close();}private void btnGetValue_Click(object sender, EventArgs e){IntPtr pFunc = GetProcAddress(hMod, "GetPortVal");if (pFunc != IntPtr.Zero){UInt16 PortAddr;UInt32 PortVal;PortAddr = UInt16.Parse(txtPortAddr.Text, System.Globalization.NumberStyles.HexNumber);GetPortValType GetPortVal = (GetPortValType)Marshal.GetDelegateForFunctionPointer(pFunc, typeof(GetPortValType));// Call WinIo to get valuebool Result = GetPortVal(PortAddr, &PortVal, 1);if (Result){txtValue.Text = PortVal.ToString("X");}else{MessageBox.Show("Error returned from GetPortVal", "DumpPort", MessageBoxButtons.OK, MessageBoxIcon.Error);}}}private void btnSetValue_Click(object sender, EventArgs e){IntPtr pFunc = GetProcAddress(hMod, "SetPortVal");if (pFunc != IntPtr.Zero){UInt16 PortAddr;UInt32 PortVal;PortAddr = UInt16.Parse(txtPortAddr.Text, System.Globalization.NumberStyles.HexNumber);PortVal = UInt32.Parse(txtValue.Text, System.Globalization.NumberStyles.HexNumber);SetPortValType SetPortVal = (SetPortValType)Marshal.GetDelegateForFunctionPointer(pFunc, typeof(SetPortValType));// Call WinIo to set valuebool Result = SetPortVal(PortAddr, PortVal, 1 );if (!Result){MessageBox.Show("Error returned from SetPortVal", "DumpPort", MessageBoxButtons.OK, MessageBoxIcon.Error);}}}}}

author: neslekkim
author_rank: Super Contributor
timestamp: April 28, 2015, 12:39:38 pm
content: From form_load:Code:// Check if this is a 32 bit or 64 bit systemif (IntPtr.Size == 4){hMod = LoadLibrary("WinIo32.dll");}else if (IntPtr.Size == 8){hMod = LoadLibrary("WinIo64.dll");}It's and rudimentary check for 64bit os, and using LoadLibrary to load the dll right there.then you check here if the library was loaded:Code:if (hMod == IntPtr.Zero){MessageBox.Show("Can't find WinIo dll.\nMake sure the WinIo library files are located in the same directory as your executable file.", "DumpPort", MessageBoxButtons.OK, MessageBoxIcon.Error);this.Close();}your problem can be related to your os, if you have 64bit operating system, and it does not work, try to go to project properites, and change the platform from AnyCPU to x86 and see if it works better (Not sure if the 32bit components will work at all on 64bit os, but try)Because the library is loaded this way, you need to do things like this to call the actuall functions:Code:InitializeWinIoType InitializeWinIo = (InitializeWinIoType)Marshal.GetDelegateForFunctionPointer(pFunc, typeof(InitializeWinIoType));If these functions:Code:[UnmanagedFunctionPointer(CallingConvention.StdCall)]private delegate bool InitializeWinIoType();[UnmanagedFunctionPointer(CallingConvention.StdCall)]private delegate bool GetPortValType(UInt16 PortAddr, UInt32* pPortVal, UInt16 Size);[UnmanagedFunctionPointer(CallingConvention.StdCall)]private delegate bool SetPortValType(UInt16 PortAddr, UInt32 PortVal, UInt16 Size);[UnmanagedFunctionPointer(CallingConvention.StdCall)]private delegate bool ShutdownWinIoType();was declared with the DllImport attribute, then you could have called them directly without the fuzz,, but it's done like this to able to have same source for the two platforms.I haven't found any information about the libraries, so i don't have anything to read or write through this, otherwise i could have tested on my computer to see how it works.Read a bit about platform invoke (p/Invoke) here:https://msdn.microsoft.com/en-us/library/aa288468(v=vs.71).aspx

author: SuzyC
author_rank: Frequent Contributor
timestamp: April 28, 2015, 12:46:46 pm
content: Thanks again, neslekkim!I cannot fathom the depth of your knowledge! (I'm aghast how little I know about programming at this level!)I can tell you that I am using XP SP3 X86 and I am setting X86 as the type and I compiled using this compile setting directive.However, I would have to go back to hacking college and get my pHD to try get to fully understand your suggestions.I am not dumb, but I guess ignorant applies here.I don't know how to marshal my code and I think I shot the sheriff.

author: SuzyC
author_rank: Frequent Contributor
timestamp: April 28, 2015, 01:03:04 pm
content: This is the error I get on attempting to debug the VB2010 studio compiled program on my X86 platform, even after setting the compile option to "Any Platform"BTW, I am the one and only, the Administrator and I have the privileges.The successfully compiled project using VB2010 is attached.

author: PA0PBZ
author_rank: Super Contributor
timestamp: April 28, 2015, 01:09:11 pm
content: Administrator rights are sometimes not enough, try the Right Click -> Run as Administrator thing.

author: SuzyC
author_rank: Frequent Contributor
timestamp: April 28, 2015, 01:14:02 pm
content: Thanks PAOPBZ, tried invoking VB2010 IDE with "run as Administrator", which I already am anyway, same result!

author: SuzyC
author_rank: Frequent Contributor
timestamp: April 28, 2015, 01:18:59 pm
content: Ok, so the marshal is after me..Help!How do I modify the VB2010 code to use this helpful suggestion?Code: InitializeWinIoType InitializeWinIo = (InitializeWinIoType)Marshal.GetDelegateForFunctionPointer(pFunc, typeof(InitializeWinIoType));

author: neslekkim
author_rank: Super Contributor
timestamp: April 28, 2015, 02:32:42 pm
content: On Windows XP.. hm, if you are administrator(have administrator rights) on that computer, you shouldn't need to do runas, since XP is way before this, Vista and newer on the other hand is more difficult.Not sure what is going on, but i would rewrite the code to basic pinvoke instead of using the loadlibrary and that marshalcasting to see if that would work better.Are you using your own compiled version of the dll's, or are you using the ones that is provided?, and did you put all those files in the same folder as your compiled code? the .sys and .dll files?

author: PA0PBZ
author_rank: Super Contributor
timestamp: April 28, 2015, 02:42:51 pm
content: Quote from: neslekkim on April 28, 2015, 02:32:42 pmAh yes, my bad. It's been a while since I used XP...

author: SuzyC
author_rank: Frequent Contributor
timestamp: April 28, 2015, 02:56:58 pm
content: Thanks again neslekkim,You would rewrite to basic pinvokes but i am just able to marshal my resources with the knowledge I have(I could ask for a prayer from the Buddhist priests living next door.)The net result s is I just don't have enough C to C around this program, I do VB.I have attached above the exact VB.net 2010 files and also the original downloaded source files, binaries etc.I don't have the programming knowledge to create my own .dll.Please examine the Winio.zip attached Win.net solution that can't start the .dll needed to get my wheels to turn.I am using only the ones, the source and resources that were provided in the Winio.zip.All the files seem to be there, (and the results were successfully compiled without error) after being converted by VB2010.netThe mentioned files in the error statement were all copied to the X86\Release folder after compilation and didn't make any change to the doomed result.

author: neslekkim
author_rank: Super Contributor
timestamp: April 28, 2015, 03:02:49 pm
content: you are not going to create your own dll, you are only going to use the dll's that are included in that zip file.The zipfiles you have added are all the same thing, there are no VB code there, only C++ and C# code.

author: SuzyC
author_rank: Frequent Contributor
timestamp: April 28, 2015, 03:11:12 pm
content: I can use the .dll provided with the included sample .exe program..no problem, works perfect, but I need to compose my own VB6 or VB.net 2010 program to have the use of inp and out commands with VB so I can input and output to the printer port registers and that is not possible as I get the error message that the .dll cannot be started or else the Winio.dll file cannot be found(which in itself is odd, since the .dll is called Winio32.dll).As fishermen and more professional programmers say, "I just can't find the hooks!"Ok, the code does seems to be C, but can you show this lady a way to get access to the parallel ports.The only way I know how to program MCU's is with C and on the PC I am only knowledgeable enough to compose programs with QBASIC, VB6 or VB.net 2010.

author: neslekkim
author_rank: Super Contributor
timestamp: April 28, 2015, 04:22:03 pm
content: Paste your VB declarations for the methods here. .

author: Mechatrommer
author_rank: Super Contributor
timestamp: April 28, 2015, 04:30:30 pm
content: VB6 users only:step 1: check def file, here easy...Code:EXPORTSInitializeWinIoShutdownWinIoMapPhysToLinUnmapPhysicalMemoryGetPhysLongSetPhysLongGetPortValSetPortValInstallWinIoDriverRemoveWinIoDriverstep 2: find it the declaration in *.h or anywhere. lucky! its in winio.h, here...Code:WINIO_API bool _stdcall InitializeWinIo();WINIO_API void _stdcall ShutdownWinIo();WINIO_API PBYTE _stdcall MapPhysToLin(tagPhysStruct &PhysStruct);WINIO_API bool _stdcall UnmapPhysicalMemory(tagPhysStruct &PhysStruct);WINIO_API bool _stdcall GetPhysLong(PBYTE pbPhysAddr, PDWORD pdwPhysVal);WINIO_API bool _stdcall SetPhysLong(PBYTE pbPhysAddr, DWORD dwPhysVal);WINIO_API bool _stdcall GetPortVal(WORD wPortAddr, PDWORD pdwPortVal, BYTE bSize);WINIO_API bool _stdcall SetPortVal(WORD wPortAddr, DWORD dwPortVal, BYTE bSize);WINIO_API bool _stdcall InstallWinIoDriver(PWSTR pszWinIoDriverPath, bool IsDemandLoaded = false);WINIO_API bool _stdcall RemoveWinIoDriver();step 3: translate it into vb syntaxesCode:public declare function InitializeWinIo lib "WinIo32.dll" () as booleanpublic declare sub ShutdownWinIo lib "WinIo32.dll" ()public declare function MapPhysToLin lib "WinIo32.dll" (byref PhysStruct as tagPhysStruct) as byte...i did few only, the rest is you have to get your arse moving and repeat after me like above, its late here. and i cant find where the tagPhysStruct definition, or i dont dig deep enough. tips: pointer = byref, not pointer (arg duplicate) = byval. need help? ask for more tomorrow, otherwise you get the idea. you may not be interested anyway...step 4: copy/modify it into your favourite *.basstep 5: make test or real function calls in your fav *.frm, *.cls et alstep 6: compile,run,test,debug.repeat step 4-6,correct definition in step 3 as necessary. loop until success.step 7: have fun.

author: Wilksey
author_rank: Super Contributor
timestamp: April 28, 2015, 04:45:30 pm
content: I just downloaded your attachment, put it into VS 2010 C# Express, and it built with no errors, put the 32 bit .sys and .dll in the folder with the binaries and it let me run with breakpoints etc, not sure what the issue is, but the samples run "out of the box"

author: Mechatrommer
author_rank: Super Contributor
timestamp: April 28, 2015, 04:46:00 pm
content: btw parallel port is dead. try learning ftdi usb... fwiw

author: neslekkim
author_rank: Super Contributor
timestamp: April 28, 2015, 04:47:11 pm
content: Quote from: Wilksey on April 28, 2015, 04:45:30 pmI think she want to use this in Visual Basic .net.. little bit different syntax.

author: Wilksey
author_rank: Super Contributor
timestamp: April 28, 2015, 05:21:02 pm
content: Ohh,Just create a C# wrapper DLL and call it from managed code in VB.net

author: SuzyC
author_rank: Frequent Contributor
timestamp: April 28, 2015, 07:54:34 pm
content: Thanks nestlekkim and you other boys, but as far as wrappers go, I couldn't tell a wrapper from Eminem.Thanks for your input, but I can't get my output to work, Wilksey.I don't have a clue what I am doing wrong, my exact code is attached..but anyway..this is all in C not VB.I haven't composed a program in VB yet because I don't know how to convert this C.net code to VB, even if I could somehow get the code, as is to work.But I declare, I have composed hundreds of programs in VB and they are not so complicated as working with C, but my functions function.

author: SuzyC
author_rank: Frequent Contributor
timestamp: April 28, 2015, 08:06:29 pm
content: Mechattrommer, you say, "btw parallel port is dead. try learning ftdi usb... fwiw"First one to call me a serial killer..I knew it would happen.I guess I am living in my own parallel universe.I would have problems trying to get a USB based interface to work with VB as well..I don't have a clue how to do this.Could you tell me how to do this with a visual basic program so I could input/output to a MCU?

author: Wilksey
author_rank: Super Contributor
timestamp: April 28, 2015, 09:36:19 pm
content: Ok,Parallel is one of the easier hardware interfaces to work with next to RS232, so there is no issue using it, you just don't find that interface on many systems these days, even embedded systems are lacking the port.Anywho,What language are you ULTIMATELY trying to make this work with?You mention VB, and C, and VS2010, so are you trying to make this work with VB6, VB.NET or C?

author: SuzyC
author_rank: Frequent Contributor
timestamp: April 29, 2015, 12:37:23 am
content: Thanks for your help, Wilksey.As far as I can tell, the parallel interface, as legacy as it has become, is still so much easier to get to work with to create a PC to MCU interface than USB or even most serial protocols. That is, if I only new how to jump through the software hoops to implement them in Microsoft's hardware crippled VB variants.I want to work with VB6 (It seems so much easier to work with, so much less complicated than VB.net) or VB.net 2010. I have no trouble creating the code to do what I want with VB6. VB.net takes about 5x as much time to accomplish anything but I have created some serious programs with it.I don't have much knowledge about C++ programming especially because it often involves dealing with the Windows API or with creating code for interfacing with hardware and .dll creation and even the GUI with maybe hundreds of poorly documented and even some needed undocumented esoteric system functions and Win API calls..all this seems horribly daunting to attempt without years of university IT curriculum, then work experience in the real world, must be followed by a few years of on the job experience with fellow coders to be any good at it.

author: Wilksey
author_rank: Super Contributor
timestamp: April 29, 2015, 01:11:59 am
content: Well, serial requires no low level hardware driver like the parallel port does, USB CDC will create a serial port (virtual) so you can essentially drop the MSCOMM control and start working with that.So you want to use VB6, not sure the difference between VB.NET and VB.NET 2010, they are both VB.NET, just one uses a specific framework revision. Anyway, you say you can get VB6 to do what you want it to do with code and that you have no trouble.VB essentially hides all of the API side of things and "wraps" it up into Forms etc, which is just a "CreateWindow" API call.So, my confusion is, you say you can code VB6 to do what you need, so what is the question?

author: SuzyC
author_rank: Frequent Contributor
timestamp: April 29, 2015, 01:17:42 am
content: I can code VB or VB.net 2010 to accomplish non-hardware complicated software goals.My question is how to get VB or VB.net 2010 to do what I want since i want to be able to use the XP PC parallel port, to have access to manipulate the parallel port registers, to use inp(port,data) and out(port,data) and so have full and direct control of the parallel port hardware.My whole post is exactly about how to get access to the parallel port, to work with XP using VB6 or VB.net 2010.

author: Wilksey
author_rank: Super Contributor
timestamp: April 29, 2015, 01:26:34 am
content: QuoteSo you are having trouble getting VB6 to do what you want?The VB6 way is how Mechatrommer has explained with API calls to the DLL, the VB.NET way is just porting the code across from C#.You seemed to imply by the quote that you have VB6 already working but want to get it working in VB.NET.I can probably have a 5 minute look at it tomorrow if nobody else has replied in the meanwhile, just trying to get it clear what you are after.

author: SuzyC
author_rank: Frequent Contributor
timestamp: April 29, 2015, 01:45:38 am
content: Mechattrommer, you say, "btw parallel port is dead. try learning ftdi usb... fwiw"I don't know anything about getting a USB based interface to work with VB as well..I don't have a clue how to do this.Could you explain how to do this with a visual basic program tp input/output bytes with a simple handshake PC<---> FTDI<-->MCU?Where to I get the info I would need to learn how to use FTDI USB solutions with VB?

author: SuzyC
author_rank: Frequent Contributor
timestamp: April 29, 2015, 01:50:00 am
content: Thanks Wilksey, but No, I don't have the parallel port working with any language, that is, working with anything newer than QBASIC.

author: rs20
author_rank: Super Contributor
timestamp: April 29, 2015, 02:00:59 am
content: Quote from: Wilksey on April 29, 2015, 01:26:34 amQuote from: SuzyC on April 29, 2015, 01:45:38 amSuzyC, Wilksey is referring toMechatrommer's post #15, which explains exactly how to get these functions that you need.

author: Wilksey
author_rank: Super Contributor
timestamp: April 29, 2015, 02:03:56 am
content: I used to use INPOUT32 to read from the port, you do have to make sure that your base address is as expected though (usually 378H).Have a look here:http://www.codeproject.com/Articles/15020/Reading-from-Parallel-Port-using-Inpout-dllLow level routines such as inp and out will crash if you get the address wrong don't forget, so you need to look in "device manager" to make sure the base address is correct!With regards to FTDI, it just creates a "COM" port on your machine, which you can use the .NET SerialPort or the ACTIVE-X MSCOMM OCX in VB6 to essentially create a terminal to communicate with the device. There are other ways but this is the best method.Easiest way to learn is to get a few USB -> RS232 adaptors and a null modem cable, or a dual USB to RS232 adaptor and null modem cable and simulate a comms link.Out of interest, what are you planning on doing with your parallel port? I've used it to drive an LCD and LED matrix before and also as a interface between the PC and a set of I2C and SPI sensors with a CPLD in between to do the interfacing, but moved on to RS232 after that as it was easier to drop a RS485 transceiver and run a bus.

author: SuzyC
author_rank: Frequent Contributor
timestamp: April 29, 2015, 03:05:52 am
content: Thanks Wilksley, I took a look at the FTDI sample programs downloadable from their website, but I am sure that the simplicity of working with the parallel port is preferable to the USB handshake latency, and I saw there is possible problems of PC shutdown and crashing, and I also saw that there is a significantly greater coding complexity using the FTDI with a serial code interface in VB.I want my MCU to use a periodic timed fixed-length serial stream, send debug packets of info from my PIC projects just using a single pin on the MCU, use the RS232 Async UART, the TX pin to output at the fastest baud rate with no handshake to a fast (64MHz clock) dedicated mcu's IRQ pin acting as an I/O cache/buffer to immediately catch the TX stream output, buffer this fast stream and cache this data. For this, I can use another PICC or Arduino dev. board. which then re-transmits this data at high speed to a VB program using the PC parallel port, using the parallel port control lines to make a handshake interface. All this so I can then log, save this data, or display a lot of data in near real-time from my MCU, else to debug program code, even graph this data to see my MCU's program operation, or to examine vars etc. I want the PC and MCU to work as fast as possible and not slow down the PC, wasted time managing complex handshaking.Ok, to put it in another way, I am just creating my own any MCU chip universal MCU development/debugging system.

author: Mechatrommer
author_rank: Super Contributor
timestamp: April 29, 2015, 05:40:46 am
content: Quote from: SuzyC on April 29, 2015, 01:45:38 ami made the ftdi "wrapper" so to speak a while ago. i havent get back to ftdi project, so i may be rusted... strictly speaking.... for VB6 fanboys only (attached zip) you need to figure that out OSSHW is all about "lack of documentation"Quote from: SuzyC on April 29, 2015, 12:37:23 ammourning will not help. you give me one "hardware not crippled" IDE and i'll buy you a coffee.Quote from: SuzyC on April 29, 2015, 12:37:23 amso you want to do VB through hardware access all in 1 day? not even with API calls? good luck! there are meaner beast than windows API... win driver development that is... and i've not touch it since i dont develop windows compatible hardware back then during "learning period" and to get USB license for a device can break a bank. do you think the "learning period" is 1 or 3 days like? i've been VB for ~15years and am still self learning... that my reply #15 is consisted in that 15 years of learning and you got it in 1 night and the zip below is weeks of sweat. make your 1st step today or never!Quote from: SuzyC on April 29, 2015, 03:05:52 amyou keep talking archaic terminology. IRQ, ie "interrupt request" vector in PC (in real time), in "Newer Windowss" is dead! unless you go back to DOS or Win311

author: SuzyC
author_rank: Frequent Contributor
timestamp: April 29, 2015, 09:16:33 am
content: Mechatrommer, I don't think you understood my explanation, I intend to use an MCU IRQ on an external MCU that grabs the data stream from the project MCU being monitored/debugged. This intermediary MCU then uses the parallel port register's handshake lines, with the PC. This caching MCU has a PC-MCU handshake that does not use PC IRQ's, the PC just uses polling of port control pins.Although a VB interface to the parallel port may have taken quite some time for someone to develop a successful software method, I assume that we don't all have to go to the trouble of re-inventing the wheel with a legacy port interface.Isn't it the purpose of this forum to share helpful software techniques so to both get help and help others with software/hardware problems?I know that interfacing hardware like the parallel port to VB will require API, that is quite obvious.

author: Wilksey
author_rank: Super Contributor
timestamp: April 29, 2015, 10:33:24 am
content: So, you're sending a serial data stream over a parallel bus?You're reading far too much into the FTDI scenario, the FTDI driver will create a VCP on your machine which allows you to access a Serial (COM) port, if you have never done serial port stuff then you won't understand, but after your project I would certainly make time to learn to how interface a MCU -> RS232 transceiver -> PC and write a little "terminal" program to learn how it all works.Did you check your LPT base address in device manager to make sure it was 378H?Try the codeproject example I linked to, it didn't crash, but I don't have a PC with a parallel port any more!

author: deephaven
author_rank: Frequent Contributor
timestamp: April 29, 2015, 10:45:11 am
content: Trying to directly drive the LPT port in Windows XP or later OS's is a bad idea, you won't be able to stop the OS periodically accessing the port and messing with your interface.

author: Mechatrommer
author_rank: Super Contributor
timestamp: April 29, 2015, 11:31:28 am
content: Quote from: SuzyC on April 29, 2015, 09:16:33 amyes we just did, its just depends on how you interpret it. i guess the people who are very well versed in what you really want have already long gone. so we gave you the advice of today. one stated he dont have parallel port around anymore, heck i dont even have serial in my 6yrs old pc here. how can we help? cheers

author: mikerj
author_rank: Super Contributor
timestamp: April 29, 2015, 11:36:42 am
content: Quote from: deephaven on April 29, 2015, 10:45:11 amWhy would the OS periodically access the port? I have bit bashed I2C and SPI through a parallel port on XP, Vista and Windows 7 with no problems at all, other than overall speed.

author: deephaven
author_rank: Frequent Contributor
timestamp: April 29, 2015, 11:41:24 am
content: Quote from: mikerj on April 29, 2015, 11:36:42 amI don't know, but that was what was reported by our software guy when we went from W95 to XP.

author: Wilksey
author_rank: Super Contributor
timestamp: April 29, 2015, 11:52:01 am
content: Sounds like a softie blaming hardware!XP upwards have no issues using a parallel port, the OS only does what it is told, it doesn't need to access the port periodically.I have used LPT on XP quite a few times and have had no issues at all.

author: SuzyC
author_rank: Frequent Contributor
timestamp: April 29, 2015, 01:57:48 pm
content: Well I declare, it is time for me to halt my exceptions and take your pointers and try to learn how to do this myself!Mechattrommer, it's time for me to learn something about C# or C++ to solve this problem.Question, I assume your code snippet hints for Winio applies to Visual Basic.Net 2010?public declare function InitializeWinIo lib "WinIo32.dll" () as booleanpublic declare sub ShutdownWinIo lib "WinIo32.dll" ()public declare function MapPhysToLin lib "WinIo32.dll" (byref PhysStruct as tagPhysStruct) as byteI know this is a newbie question, but in conversion, how do I know when to use "byref" rather than "byval"? in the conversion?Also, I have not succeeded in getting the native C code version of Winio to work..others say it worked ok when the .dll was copied to the correct directory..I need some clarification here. If I compile the converted to .net 2010 C code for a "Release" result, then if I just copy the Winio32.dll to the Release folder it should work? The Winio32.dll doesn't need to be also to be Windows\System32 ?First, I need to get this program to work in C, then convert it to VB.net 2010.

author: neslekkim
author_rank: Super Contributor
timestamp: April 29, 2015, 02:54:17 pm
content: The sample code IS C#, can't you just use that?Some times you say that the samples work fine, next you say you cannot use them.. Do they work or not?Quote from: SuzyC on April 29, 2015, 01:57:48 pmThis is VB6 code as he stated earlier, Look at this to see the difference in declarations for C#, VB.net and VB6:http://www.pinvoke.net/default.aspx/kernel32.outputdebugstringQuote from: SuzyC on April 29, 2015, 01:57:48 pmThis is one of the first things you need to know, if you have created lots of applications before, and you DON'T know what byref and byval means, i don't belive your earlier statement.Atleast google it..http://www.dotnetperls.com/byval-byrefQuote from: SuzyC on April 29, 2015, 01:57:48 pmOr you can take the two files as I mentioned earlier, BOTH the dll AND the sys file, and add them in your project, and mark them as files to be copied to your output folder on build, so you don't need to copy manually.Quote from: SuzyC on April 29, 2015, 01:57:48 pmNo, you need either to learn C#, You don't need to convert this to VB.net (and forget the 2010 thing, vs2010 can use .net v2.0 and up to .net v4.0, that is what you need to choose)If you absolutely need to use VB, it's best to just create an small C# classlibrary, copy the code that was defined in the samples for the winio declarations, and then use this classlibrary from VB, that is what is meant with an wrapper, but if you search around on pinvoke.net, you will find enough information to be able to convert the code to vb.net, but you need to try to read an search a bit to learn this.

author: nitro2k01
author_rank: Frequent Contributor
timestamp: April 29, 2015, 03:06:25 pm
content: Seriously, do yourself a favor and go serial. When you're using the parallel port, your thread needs to be running for each bit you transfer. With a serial port, all timing sensitive parts are abstracted away. On the PC side, you have a standard interface that is still maintained, and is rather portable between platforms. On the microcontroller side, you have a hardware UART, so that the CPU only needs to be busy once for every byte, instead of once for every bit. A byte goes in on one side and comes out on the other side. Easy. FT232 offers a maximum of 3 MBaud. Is this enough for your application?It is true that USB can only handle data transfers a maximum of 1000 times per second, but if you're sending larger packets than 1 byte, that shouldn't be a huge problem. Only if you send one byte from the PC and stall until you get a byte back will this be a problem.

author: Wilksey
author_rank: Super Contributor
timestamp: April 29, 2015, 05:12:15 pm
content: First of all, read the post that neslekkim has posted, it contains some useful pointers.I second dropping 2010 from the VS/VB.NET, 2010 is just the edition that as around when .NET 3.5 / 4 was released (can't remember which one). you have 2013 now perhaps newer, I still use 2010.VB6 and VB.NET are 2 completely different languages.C and C# is NOT the same, the examples are in C# (C SHARP).Take one of the examples, compile it, run it, it will complain it can't find some files, find the "bin\x86\release" folder where the .exe is, and copy the .dll and the .sys to that folder, if you still get errors or issues and you are compiling on a x86 system then there must be some underlying issue with the hardware or hardware driver, as this works "out of the box" for me, i've done it on XP x32 and 7 x32, if you are running on x64 make sure the architecture is set to x86 explicitly rather than "any".

author: SuzyC
author_rank: Frequent Contributor
timestamp: April 29, 2015, 10:55:47 pm
content: Thanks Wilksey, I just realized that I didn't copy over the Winio32.sys file. I didn't think that I needed it, didn't know that it was needed to include this file for X86 32-bit windows. I will try adding the .sys file to the Release folder and this should get it to work with C# in .net 2010.Update, InpOut32.dll does workwith my VB6 VBasic basic program, the VB IDE was "having a problem and must close." issue when I entered a port number used on a PCI Parallel Port card of 0xDFE0 for either an input or output. It does work ok with any port# <32767. Seems the integer type in the .Dll is a signed 16-bit integer.Thank you very much Neslekkim for your detailed help.A compiled version Winio.exe came with the .zip file downloaded and that worked with a click on my Desktop.My compiled .net 2010 would not work, but as I noted above, it might be because I hadn't copied the .sys file to the Release directory. It compiles to have a result compatible with .net ver 2.5.I would like to learn more about C#, but I can see it is quite different and sophisticated compared to MCU C, but my first impression just looking at keywords shows it has great capability if one knows how to use it. I am going to check out the links tomorrow you posted.Nitro2k01: Thanks for your suggestion. I succeeded in getting Inout32.dll to work and made a loop test on my PC.My VB6 program running in the VB IDE managed to achieve >260 thousand loops each second.Dim N as LongDim T, u as IntegerT=TimerDoIt:out &H378, 0u=inp(&H378)N=N+1if(Timer-T)<10 then goto DoItEndThat's pretty fast, and there is only two short lines of initialization to use InpOut32.dll so as to create an interface to this .dll to VB6.Needless to say, when the program is inputting and outputting in a continuous loop, my 6-core PC is always running at least one core at >50% of computing capacity according to the Task Manager graph.

author: SuzyC
author_rank: Frequent Contributor
timestamp: April 30, 2015, 12:26:37 am
content: Many Thanks to Everyone who offered their comments and help!Thanks nitro2kO1,All PC motherboards's with a Parallel Port have a bidirectional single port used as a byte-wide input and output port so I don't get it that you say the PC is doing business by the bit, it is obviously inputting and outputting one byte at a time.I would very much like to see a listing of a VB.net or VB6 interface to the USB serial solution.This is all it takes in VB6:Private Declare Function Inp Lib "inpout32.dll" _Alias "Inp32" (ByVal PortAddress As Integer) As IntegerPrivate Declare Sub Out Lib "inpout32.dll" _Alias "Out32" (ByVal PortAddress As Integer, ByVal Value As Integer)You can argue about the speed but I love the absolute simplicity of this PC to external world hardware interface solution.

author: nitro2k01
author_rank: Frequent Contributor
timestamp: April 30, 2015, 12:46:29 am
content: Quote from: SuzyC on April 30, 2015, 12:26:37 amI thought for some reason from your description that you were only using one pin and was clocking individual bits. The general point still stands though, no timing intensive work is being offloaded to hardware, and you effectively dedicate one CPU core just for transferring the data. Plus, LPT ports will start to go away, and will be harder to access for every Windows version.For a serial port, You need the MSComm control. However, I'm not sure if you can open a port at 3 MBaud in VB6 (even if the port supports it) or if you are restricted to standard baud rates.https://msdn.microsoft.com/en-us/library/aa259393(v=vs.60).aspx

author: SuzyC
author_rank: Frequent Contributor
timestamp: April 30, 2015, 01:00:36 am
content: According to Microsoft MSDN and using MSComm, all you need to do is:Use the MSComm control in Visual Basic .NET to access serial portsBecause no Microsoft .NET Framework classes exist to access the communications resources that connected to your computer, you can use the MSComm control in Microsoft Visual Basic 6.0. The MSComm control provides serial communications for your application by enabling the transmission and reception of data through a serial port. To implement basic serial communications by using a modem, follow these steps:(There are some caveats: This example uses 9600 baud, only applicable up to VB.net 2003 and to establish communication with the LPTx port, you must stop the Print Spooler service. To do this, use the Services tool)in Administrative Tools.Start Microsoft Visual Studio .NET.On the File menu, point to New, and then click Project.Under Project Types, click Visual Basic Projects.Under Templates, click Console Application.In the Name box, type MyConsoleApplication, and then click OK.By default, Module1.vb is created.Right-click the MyConsoleApplication project, and then click Add Reference.Click the COM tab, click Microsoft Comm Control 6.0 under Component Name, click Select, and then click OK.Note To use the MSComm control, you must install the related COM components of Microsoft Visual Basic 6.0 on the same computer that has Microsoft Visual Studio .NET installed.For more information about license issues when you use Visual Basic 6.0 controls in Visual Studio .NET, click the following article number to view the article in the Microsoft Knowledge Base:318597 Errors when you use Visual Basic 6.0 controls in Visual Studio .NETReplace the code in Module1.vb with the following code example.Imports MSCommLibModule Module1Sub Main()'New a MSComm controlDim MSComm1 As MSCommMSComm1 = New MSComm' Buffer to hold input string.Dim Buffer As String' Use the COM1 serial port.MSComm1.CommPort = 1' 9600 baud, no parity, 8 data, and 1 stop bit.MSComm1.Settings = "9600,N,8,1"' Tell the control to read the whole buffer when Input is used.MSComm1.InputLen = 0' Open the serial port.MSComm1.PortOpen = TrueConsole.WriteLine("Open the serial port.")' Tell the control to make the Input property return text data.MSComm1.InputMode() = InputModeConstants.comInputModeText'Clear the receive buffer.MSComm1.InBufferCount() = 0' Send the attention command to the modem.MSComm1.Output = "ATV1Q0" & Chr(13)Console.WriteLine("Send the attention command to the modem.")Console.WriteLine("Wait for the data to come back to the serial port...")' Make sure that the modem responds with "OK".' Wait for the data to come back to the serial port.DoBuffer = Buffer & MSComm1.InputLoop Until InStr(Buffer, "OK" & vbCrLf)' Read the "OK" response data in the serial port.' Close the serial port.Console.WriteLine("Read the OK response data in the serial port.")MSComm1.PortOpen = FalseConsole.WriteLine("Close the serial port.")End SubEnd ModuleUse platform invoke services to call Win32 API functions in Visual Basic .NET to access serial and parallel portsTo do this, follow these steps:Start Microsoft Visual Studio .NET.On the File menu, point to New, and then click Project.Under Project Types, click Visual Basic Projects.Under Templates, click Console Application.In the Name text box, type MyConsoleApplication, and then click OK.By default, Module1.vb is created.Add the following code to Module1.vb before the Module Module1 statement:Option Strict On' Define a CommException class that inherits from the ApplicationException class,' and then throw an object of type CommException when you receive an error message.Class CommExceptionInherits ApplicationExceptionSub New(ByVal Reason As String)MyBase.New(Reason)End SubEnd ClassDeclare structures, constants, and references to external functions that are in Kernel32.dllTo call unmanaged functions from your managed Visual Basic .NET application, you must declare references to the structures that you pass as parameters to the unmanaged functions, and you must declare the constants that you pass as parameters to the unmanaged functions. To do this, add the following code to Module1.vb after the Module Module1 statement:'Declare structures.Public Structure DCBPublic DCBlength As Int32Public BaudRate As Int32Public fBitFields As Int32 'See Comments in Win32API.TxtPublic wReserved As Int16Public XonLim As Int16Public XoffLim As Int16Public ByteSize As BytePublic Parity As BytePublic StopBits As BytePublic XonChar As BytePublic XoffChar As BytePublic ErrorChar As BytePublic EofChar As BytePublic EvtChar As BytePublic wReserved1 As Int16 'Reserved; Do Not UseEnd StructurePublic Structure COMMTIMEOUTSPublic ReadIntervalTimeout As Int32Public ReadTotalTimeoutMultiplier As Int32Public ReadTotalTimeoutConstant As Int32Public WriteTotalTimeoutMultiplier As Int32Public WriteTotalTimeoutConstant As Int32End Structure'Declare constants.Public Const GENERIC_READ As Int32 = &H80000000Public Const GENERIC_WRITE As Int32 = &H40000000Public Const OPEN_EXISTING As Int32 = 3Public Const FILE_ATTRIBUTE_NORMAL As Int32 = &H80Public Const NOPARITY As Int32 = 0Public Const ONESTOPBIT As Int32 = 0'Declare references to external functions.Public Declare Auto Function CreateFile Lib "kernel32.dll" _(ByVal lpFileName As String, ByVal dwDesiredAccess As Int32, _ByVal dwShareMode As Int32, ByVal lpSecurityAttributes As IntPtr, _ByVal dwCreationDisposition As Int32, ByVal dwFlagsAndAttributes As Int32, _ByVal hTemplateFile As IntPtr) As IntPtrPublic Declare Auto Function GetCommState Lib "kernel32.dll" (ByVal nCid As IntPtr, _ByRef lpDCB As DCB) As BooleanPublic Declare Auto Function SetCommState Lib "kernel32.dll" (ByVal nCid As IntPtr, _ByRef lpDCB As DCB) As BooleanPublic Declare Auto Function GetCommTimeouts Lib "kernel32.dll" (ByVal hFile As IntPtr, _ByRef lpCommTimeouts As COMMTIMEOUTS) As BooleanPublic Declare Auto Function SetCommTimeouts Lib "kernel32.dll" (ByVal hFile As IntPtr, _ByRef lpCommTimeouts As COMMTIMEOUTS) As BooleanPublic Declare Auto Function WriteFile Lib "kernel32.dll" (ByVal hFile As IntPtr, _ByVal lpBuffer As Byte(), ByVal nNumberOfBytesToWrite As Int32, _ByRef lpNumberOfBytesWritten As Int32, ByVal lpOverlapped As IntPtr) As BooleanPublic Declare Auto Function ReadFile Lib "kernel32.dll" (ByVal hFile As IntPtr, _ByVal lpBuffer As Byte(), ByVal nNumberOfBytesToRead As Int32, _ByRef lpNumberOfBytesRead As Int32, ByVal lpOverlapped As IntPtr) As BooleanPublic Declare Auto Function CloseHandle Lib "kernel32.dll" (ByVal hObject As IntPtr) As BooleanBefore you can access a serial port or a parallel port, you must obtain a handle to the appropriate port and then configure the port communications. To do this, add the following initialization code to Module1.vb after the Sub Main statement.Note To establish communication with the LPTx port, you must stop the Print Spooler service. To do this, use the Services tool in Administrative Tools.' Declare the local variables that you will use in the code.Dim hSerialPort, hParallelPort As IntPtrDim Success As BooleanDim MyDCB As DCBDim MyCommTimeouts As COMMTIMEOUTSDim BytesWritten, BytesRead As Int32Dim Buffer() As Byte' Declare the variables to use for encoding.Dim oEncoder As New System.Text.ASCIIEncodingDim oEnc As System.Text.Encoding = oEncoder.GetEncoding(1252)' Convert String to Byte().Buffer = oEnc.GetBytes("Test")Try' Access the serial port.Console.WriteLine("Accessing the COM1 serial port")' Obtain a handle to the COM1 serial port.hSerialPort = CreateFile("COM1", GENERIC_READ Or GENERIC_WRITE, 0, IntPtr.Zero, _OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, IntPtr.Zero)' Verify that the obtained handle is valid.If hSerialPort.ToInt32 = -1 ThenThrow New CommException("Unable to obtain a handle to the COM1 port")End If' Retrieve the current control settings.Success = GetCommState(hSerialPort, MyDCB)If Success = False ThenThrow New CommException("Unable to retrieve the current control settings")End If' Modify the properties of the retrieved DCB structure as appropriate.' WARNING: Make sure to modify the properties according to their supported values.MyDCB.BaudRate = 9600MyDCB.ByteSize = 8MyDCB.Parity = NOPARITYMyDCB.StopBits = ONESTOPBIT' Reconfigure COM1 based on the properties of the modified DCB structure.Success = SetCommState(hSerialPort, MyDCB)If Success = False ThenThrow New CommException("Unable to reconfigure COM1")End If' Retrieve the current time-out settings.Success = GetCommTimeouts(hSerialPort, MyCommTimeouts)If Success = False ThenThrow New CommException("Unable to retrieve current time-out settings")End If' Modify the properties of the retrieved COMMTIMEOUTS structure as appropriate.' WARNING: Make sure to modify the properties according to their supported values.MyCommTimeouts.ReadIntervalTimeout = 0MyCommTimeouts.ReadTotalTimeoutConstant = 0MyCommTimeouts.ReadTotalTimeoutMultiplier = 0MyCommTimeouts.WriteTotalTimeoutConstant = 0MyCommTimeouts.WriteTotalTimeoutMultiplier = 0' Reconfigure the time-out settings, based on the properties of the modified COMMTIMEOUTS structure.Success = SetCommTimeouts(hSerialPort, MyCommTimeouts)If Success = False ThenThrow New CommException("Unable to reconfigure the time-out settings")End If' Write data to COM1.Console.WriteLine("Writing the following data to COM1: Test")Success = WriteFile(hSerialPort, Buffer, Buffer.Length, BytesWritten, IntPtr.Zero)If Success = False ThenThrow New CommException("Unable to write to COM1")End If' Read data from COM1.Success = ReadFile(hSerialPort, Buffer, BytesWritten, BytesRead, IntPtr.Zero)If Success = False ThenThrow New CommException("Unable to read from COM1")End IfCatch ex As ExceptionConsole.WriteLine(Ex.Message)Finally' Release the handle to COM1.Success = CloseHandle(hSerialPort)If Success = False ThenConsole.WriteLine("Unable to release handle to COM1")End IfEnd TryTry' Parallel port.Console.WriteLine("Accessing the LPT1 parallel port")' Obtain a handle to the LPT1 parallel port.hParallelPort = CreateFile("LPT1", GENERIC_READ Or GENERIC_WRITE, 0, IntPtr.Zero, _OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, IntPtr.Zero)' Verify that the obtained handle is valid.If hParallelPort.ToInt32 = -1 ThenThrow New CommException("Unable to obtain a handle to the LPT1 port")End If' Retrieve the current control settings.Success = GetCommState(hParallelPort, MyDCB)If Success = False ThenThrow New CommException("Unable to retrieve the current control settings")End If' Modify the properties of the retrieved DCB structure as appropriate.' WARNING: Make sure to modify the properties according to their supported values.MyDCB.BaudRate = 9600MyDCB.ByteSize = 8MyDCB.Parity = NOPARITYMyDCB.StopBits = ONESTOPBIT' Reconfigure LPT1 based on the properties of the modified DCB structure.Success = SetCommState(hParallelPort, MyDCB)If Success = False ThenThrow New CommException("Unable to reconfigure LPT1")End If' Retrieve the current time-out settings.Success = GetCommTimeouts(hParallelPort, MyCommTimeouts)If Success = False ThenThrow New CommException("Unable to retrieve current time-out settings")End If' Modify the properties of the retrieved COMMTIMEOUTS structure as appropriate.' WARNING: Make sure to modify the properties according to their supported values.MyCommTimeouts.ReadIntervalTimeout = 0MyCommTimeouts.ReadTotalTimeoutConstant = 0MyCommTimeouts.ReadTotalTimeoutMultiplier = 0MyCommTimeouts.WriteTotalTimeoutConstant = 0MyCommTimeouts.WriteTotalTimeoutMultiplier = 0' Reconfigure the time-out settings, based on the properties of the modified COMMTIMEOUTS structure.Success = SetCommTimeouts(hParallelPort, MyCommTimeouts)If Success = False ThenThrow New CommException("Unable to reconfigure the time-out settings")End If' Write data to LPT1.' Note: You cannot read data from a parallel port by calling the ReadFile function.Console.WriteLine("Writing the following data to LPT1: Test")Success = WriteFile(hParallelPort, Buffer, Buffer.Length, BytesWritten, IntPtr.Zero)If Success = False ThenThrow New CommException("Unable to write to LPT1")End IfCatch ex As ExceptionConsole.WriteLine(Ex.Message)Finally' Release the handle to LPT1.Success = CloseHandle(hParallelPort)If Success = False ThenConsole.WriteLine("Unable to release handle to LPT1")End IfEnd TryConsole.WriteLine("Press ENTER to quit")Console.ReadLine()

author: neslekkim
author_rank: Super Contributor
timestamp: April 30, 2015, 05:20:42 am
content: You still mix vb6 with vb.net.. Don't use MSComm in .net, use System.IO.Ports:http://www.ontrak.net/serialport.htm

author: SuzyC
author_rank: Frequent Contributor
timestamp: April 30, 2015, 12:53:30 pm
content: neslekkim...Thanks Again!The original downloaded winio.zip came with the C code and binaries and sources required to create the Winio.exe application and Winio.dll.I immediately noticed upon examining the C source files with Wordpad that they had .net calling conventions, were not compatible with VB6.I have Visual Studio 2010 and so I used this to try to compile the C code. Upon first opening with VS2010, they needed to be updated to be used by the C IDE in Visual Studio 2010.. and this was successful without error. However, I could not get the output files to debug and I attached to my posts here the revised Wino.zip with the converted source files.Update: I copied the Winio32.dll and Winio32.sys files to the Release directory and it works perfect in C# IDE..but it ain't no VBasic code yet.My confusion arises from Vis Studo 2010 showing that it has support for C++ 2010, C# 2010 and Visual F# and the converted code does not expose the type of code generated..though definitely I clearly understand now that the code produced is not Vis Studio VBasic 2010, my choice to work with if I could convert the code.

author: neslekkim
author_rank: Super Contributor
timestamp: April 30, 2015, 01:09:05 pm
content: Don't touch the C code, that is there for those who really want to know how this is done on an lower level.Where did you see .net calling conventions in the C code???Look again at the files in the SAMPLES folder, those are the files you need to concentrate on, and those are CS files, which is the fileextension for C#

author: SuzyC
author_rank: Frequent Contributor
timestamp: April 30, 2015, 01:20:48 pm
content: Thanks again neslekkim,In honor of all things honest and yet ignorant, I simply opened the C files with Wordpad and could quickly C that the coding looked like nothing that resembles what I have C'n so far in my short life.. too quick a glance, too little expertise to make a judgement, I was just not C sharp enough for me to tell.Ps, thanks for you help. Now I know it is CS.

author: Wilksey
author_rank: Super Contributor
timestamp: April 30, 2015, 02:39:34 pm
content: I presume from your previous post that you can now get the inpout32 to work, so is there a reason why you still want this WinIO thing in VB rather than C#?

author: SuzyC
author_rank: Frequent Contributor
timestamp: April 30, 2015, 04:44:39 pm
content: Thanks again Wilksey, you've been been very generous with your help I want you to know that I do appreciate your comments!The reason why..because I I don't know my entry point from my elbow about C# programming.

author: Wilksey
author_rank: Super Contributor
timestamp: April 30, 2015, 05:27:46 pm
content: So is it purely to learn C# and how it translates to VB or are you still trying to get WinIO to VB for technical reasons (rather than just to understand the differences between C# and VB)?

author: SuzyC
author_rank: Frequent Contributor
timestamp: April 30, 2015, 05:43:12 pm
content: Thanks Wilksey, it is both. I would like to work with a programming language like C# that might be able in a .net environment be able to create more powerful software than will be able to run on a computer with a Windows operating system >=XP.

author: neslekkim
author_rank: Super Contributor
timestamp: April 30, 2015, 07:17:54 pm
content: Using VB.Net or C# is same same, you can do the same on both languages, don't worry about that.You can use same libraries, same .net, works on same platforms and so on.I have used vb6, vb.net in the past, but converted to C# around 2003, but that is mostly because I like the syntax better, and working with peers who use same language.Learning C# is an good idea, depending on the teams you are working with, but if you are working alone, you should chose what is working for you.You can download Reflector fromhttp://www.red-gate.com/products/dotnet-development/reflector/with this tool, you can look at .net compiled dll's, and you can chose to show the decompiled code as C# or VB.net, which can be a good way to learn also.

author: Wilksey
author_rank: Super Contributor
timestamp: April 30, 2015, 08:53:49 pm
content: VB6 will run on Windows 8.1, just so you know, the only thing it won't do (or can't natively) is create x64, but I believe there was a new linker / compiler which extended this feature, might be wrong.

author: Mechatrommer
author_rank: Super Contributor
timestamp: May 01, 2015, 06:39:30 am
content: Quote from: Wilksey on April 30, 2015, 08:53:49 pmplease dont believe or dream it and yes you are wrong. VB6 is dead along with LPT et al. i'm the last mohican who is still using it... edit: if somehow you cant resist the temptation, you have to dig the archive though...http://www.javaxt.com/Tutorials/Visual_Studio/Compiling_64_bit_apps_using_Visual_Studio_6_and_Windows_Platform_SDK

author: mikerj
author_rank: Super Contributor
timestamp: May 01, 2015, 06:44:08 am
content: Quote from: Mechatrommer on May 01, 2015, 06:39:30 amVB6 might not have Microsoft support any more but it's far from dead. There are still a large number of businesses and individuals using it.

author: Mechatrommer
author_rank: Super Contributor
timestamp: May 01, 2015, 06:47:14 am
content: Quote from: mikerj on May 01, 2015, 06:44:08 amso i'm not the last thenbut vb6 has gotten bad rep in younger community. once you uploaded the free software, you'll get backfire saying its not compatible to this and that, its not linux cross platform or such crap. edit: my previous comment maybe suited to newcomers like suzy, learning vb6 today maybe not a good idea

author: Wilksey
author_rank: Super Contributor
timestamp: May 01, 2015, 03:03:26 pm
content: Dream it?Lol,I used VB for years, even got VB for dos somewhere, I know Microsoft hadn't created a x64 linker / compiler but there are community members who have changed the linker to, for example, produce actual DLL's rather than just the wrappered ones.Anyway, no I wouldn't recommend learning it for new programmers, it's far too outdated to be viable to learn, unless it is purely for fun and nostalgic reasonings.

author: Mechatrommer
author_rank: Super Contributor
timestamp: May 02, 2015, 02:17:35 am
content: Quote from: Wilksey on May 01, 2015, 03:03:26 pm32bits apps run perfectly fine in 64bit windows, so why bother?

author: Wilksey
author_rank: Super Contributor
timestamp: May 02, 2015, 09:07:43 pm
content: I'm not saying you should, just thinking forward, and backing up the statement that VB6 should not really be learnt for new development.