Re: DllImport Programming Software Development by Philippe.Lahaie … my strong suit but I would try dumbing down the dllimport see if it works with the bare minimum. So, removing… attributes perhaps try that on your "ref" parameter? [DllImport(WINSCARD_DLL, CharSet = CharSet.Auto)] private static extern int SCardTransmit( [In… DllImport Programming Software Development by Suzie999 … System.Diagnostics; using System.Runtime.InteropServices; namespace Win32DllImports { class Program { [DllImport("Urlmon", EntryPoint = "ObtainUserAgentString", CallingConvention = CallingConvention.StdCall… Re: DllImport Programming Software Development by Suzie999 … System.Diagnostics; using System.Runtime.InteropServices; namespace Win32DllImports { class Program { [DllImport("urlmon", CharSet = CharSet.Ansi)] private static extern uint… Re: dllimport argument return Programming Software Development by Momerath … byte[] lpBuffer, int dwSize, out int lpNumberOfBytesRead ); [DllImport("kernel32.dll", SetLastError = true)] static extern …object lpBuffer, int dwSize, out int lpNumberOfBytesRead ); [DllImport("kernel32.dll", SetLastError = true)] static extern… Re: DllImport works in console mode? Programming Software Development by ProgWr …\\OpenIntApp\\bin\\Release\\OpenIntApp.exe", RegistryValueKind.String); [DllImport("coredll.dll", EntryPoint = "RequestPowerNotifications"…// pre compile Error! - VS doesn't recognize DllImport Console.WriteLine("registry set"); } } } [/CODE] Re: DllImport works in console mode? Programming Software Development by Momerath … example: [code]using System; using System.Runtime.InteropServices; class PlatformInvokeTest { [DllImport("msvcrt.dll")] public static extern int puts(string… c); [DllImport("msvcrt.dll")] internal static extern int _flushall(); public… Re: dllimport argument return Programming Software Development by wlalth … need to return byte array from the function, in your dllimport statement, method_4 have one argument which has ref int type… type? Also on readprocessmemory byte array argument defined without ref: [DllImport("kernel32.dll")] public static extern bool ReadProcessMemory(IntPtr… DllImport works in console mode? Programming Software Development by ProgWr Hi, quick question... i am making a program without a form for windows ce and so i am trying to work in console but it seems some of the code cannot be implemented. does DllImport suppose to work in console? Thx & BR Ran. Re: DllImport works in console mode? Programming Software Development by ProgWr Thanks. Any idea why VS doesn't recognize the DllImport word? i am using the next "using": using System; using System.Collections.Generic; using System.Text; using Microsoft.Win32; using System.Runtime.InteropServices; using System.Linq; using System.Collections; using System.Threading; dllimport argument return Programming Software Development by wlalth …(readHandle, (IntPtr)BellekAdresi, bytes, (UIntPtr)50, ref rw); return bytes; } [DllImport("test.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl… Re: dllimport argument return Programming Software Development by Momerath According to the P/Invoke tool, your DLLImport statement should be [System.Runtime.InteropServices.DllImportAttribute("<Unknown>", EntryPoint="method_4")] public static extern void method_4(ref int buffer) ; Of course you replace the <Unkown> with your dll name. Re: Class Library to DllImport Programming Software Development by Momerath DLLImport is for DLLs that weren't written in managed code. All you need to do is add the DLL to your project references, include a 'using' statement for the namespace and you can use what is in the DLL. Re: c# dllimport issues Programming Software Development by Nidal_1 …extern hidDeviceInfo hidEnumerate(UInt16 vendorId, UInt16 productId); // done [DllImport("libhidapi-0.dll", EntryPoint="hid_free_enumeration")] public…hidFreeEnumeration([In, MarshalAs(UnmanagedType.LPStruct)] hidDeviceInfo devs); // done [DllImport("libhidapi-0.dll", EntryPoint="hid_open", … c# dllimport issues Programming Software Development by khorght …*data, size_t length); ... and this is the part in c#: [DllImport("hidapi.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl… extern unsafe int hid_write(IntPtr device, StringBuilder data, uint length); [DllImport("hidapi.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.… libgd error when building - dllimport? Programming Software Development by daino …. Thanks. gdfontg.c:4380: error: variable 'gdFontGiant' definition is marked dllimport gdfontg.c:4380: warning: 'gdFontGiant' redeclared without… Re: c# dllimport issues Programming Software Development by khorght … object. the only way to add dll is through the dllimport. i've tryed this library in java app using jni… Dll creation problem(definition of dllimport function not allowed) Programming Software Development by Martje … the .dll i got an error saying : [QUOTE]definition of dllimport function not allowed[/QUOTE] my header and source is simple… defined DLL_EXPORT #define DECLDIR __declspec(dllexport) #else #define DECLDIR __declspec(dllimport) #endif extern "C" { DECLDIR int Add( int a… Class Library to DllImport Programming Software Development by ProgWr … in C# and i am trying to use it using DllImport but i keep getting: Error RegConfig.exe MissingMethodException Can't….Security; using System.Reflection; using ClassLibraryWinCe; namespace RegConfig { class Program { [DllImport("ClassLibraryWinCe.dll")] public static extern void InitProg(string… setup project with DLLImport Programming Software Development by carey_amanda I am doing a DLLimport in my C# program. And now i need to do a setup project to make it into a windows installer application. But after i install it. there's an error saying, [ATTACH]13246[/ATTACH] i have already put my dll in my application folder. still the same result. please help. Re: DllImport works in console mode? Programming Software Development by Momerath Yes it works in console mode. Re: DllImport works in console mode? Programming Software Development by Momerath Post the code where you use it. Re: DllImport works in console mode? Programming Software Development by ProgWr I am trying to figure out how to flush the registry in windows ce but with no luck after the code you see above i tried reg.Flush();, program compiled and run but registry is not presistant after boot i now tried using RegFlushKey(reg); but 'reg' is not an IntPtr. the internet have solution like reg.data but i can't use it (pre-compile) error. … Re: DllImport works in console mode? Programming Software Development by ProgWr finaly i found the problem, i was using reg.flush(); but it didn't seem to work, the reason was that the windows ce emulator was set to clear all registry on soft reset also Re: c# dllimport issues Programming Software Development by tinstaafl have you tried adding the .dll as an a reference add a using statment add the namespace to your app? That way intellisense can tell you where your synatax is wrong. Re: c# dllimport issues Programming Software Development by Milton Neal hid_write(hid_device *device, const unsigned char *data, size_t length); the 2nd parameter is an unsigned char pointer, ie pointer to a byte array. Have you tried using a byte array to send you data rather than a string? Re: c# dllimport issues Programming Software Development by khorght i thought if i nedd pointer i must pass pointer, or string, that will be automaticly transformed to pointer by framework, as i understand... i've try pass byte array directly with no luck, hid_write returned error and app hangs. Re: libgd error when building - dllimport? Programming Software Development by daino Well, it depends on which version I use. An earlier version gives me the below errors. I tried adjusting the CmakeLists File to include all the requiremens for libgd and now it's telling me that it can't see jpeglib.h which is obviously the Libjpeg header. Has anyone built libgd on windows? The instructions say the below. *The following … Re: libgd error when building - dllimport? Programming Software Development by daino I tried using CMAKE to create a makefile and then tried building using 'make install' and got the below error. make[1]: Entering directory `/c/libgd' if gcc -DHAVE_CONFIG_H -DHAVE_BOOLEAN -I. -I. -I. -I/usr/local/include/freetype2 -I/usr/local/include -g -O2 -MT gdcmpgif.o -MD -MP -MF ".deps/gdcmpgif.Tpo" -c -o … Re: Class Library to DllImport Programming Software Development by ProgWr thanks Momerath for your reply i have done this and it works, problem is that i would like to have a DLL in a certain library and have many programs reference that DLL. with the method of referencing the DLL (like you said) it seems the executable must be at the same library as the DLL, is there a way to change that? PS the programs are for … Re: Class Library to DllImport Programming Software Development by Momerath Adding a reference does not make the DLL a part of your executable. If you copy the exe to another machine it will not run unless you copy the DLL also (just like any other DLL). If you want to just have one copy of your DLL per machine (instead of one per executable) you might want to look into the [URL="http://support.microsoft.com/kb/…