API in vb 2008
-
when i tried using a few api functions like FindWindow they didn't work for me no error was produced in the debug mode(ie i ran using F5) how is that?? is there a new way to use api in vb 2008 cause in older vb it is working??
TheMrProgrammer
-
when i tried using a few api functions like FindWindow they didn't work for me no error was produced in the debug mode(ie i ran using F5) how is that?? is there a new way to use api in vb 2008 cause in older vb it is working??
TheMrProgrammer
Ya, using api in .net is different from VB 6.0. In VB 6.0 we often uses api call but in .net. Here is an example, <DllImport("KERNEL32.DLL", EntryPoint:="GetSystemDirectoryW", _ SetLastError:=True, CharSet:=CharSet.Unicode, _ ExactSpelling:=True, _ CallingConvention:=CallingConvention.StdCall)> _ Public Function GetSystemDirectory(ByVal Buffer _ As StringBuilder, ByVal Size As Integer) As Long ' Leave function empty - DLLImport attribute ' forces calls to GetSystemDirectory to ' be forwarded to GetSystemDirectory in KERNEL32.DLL End Function Please use google for futher clarification. :)
-
when i tried using a few api functions like FindWindow they didn't work for me no error was produced in the debug mode(ie i ran using F5) how is that?? is there a new way to use api in vb 2008 cause in older vb it is working??
TheMrProgrammer
The process is known as PInvoke or P/Invoke. If you search MSDN, or Google on those terms you will get lots of examples.
Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”