Click here to Skip to main content
15,895,709 members
Home / Discussions / C#
   

C#

 
Generaltext encoding Pin
amatyasik25-Jun-04 2:01
amatyasik25-Jun-04 2:01 
GeneralRe: text encoding Pin
zainu25-Jun-04 2:53
zainu25-Jun-04 2:53 
GeneralRe: text encoding Pin
amatyasik25-Jun-04 2:56
amatyasik25-Jun-04 2:56 
Generalc# query biulder Pin
Member 114126625-Jun-04 1:46
Member 114126625-Jun-04 1:46 
GeneralRe: c# query biulder Pin
Heath Stewart25-Jun-04 5:11
protectorHeath Stewart25-Jun-04 5:11 
GeneralRe: c# query biulder Pin
partyganger25-Jun-04 14:16
partyganger25-Jun-04 14:16 
GeneralDllImport Pin
deeps2625-Jun-04 1:33
deeps2625-Jun-04 1:33 
GeneralRe: DllImport Pin
Jeremy Kimball25-Jun-04 2:57
Jeremy Kimball25-Jun-04 2:57 
The DllImport attribute is mainly used for P/Invoke calls (that is, calls to legacy functions, like Win32 API, old DLLs you've got lying about, etc.) There's loads of sites out there that will give you some useful examples (as well as how to deal with some of the gnarlier C-style structures you're sure to encounter), but here's a quick-and-dirty example:

namespace bob {

    public class GarbageClass {

    [DllImport("Kernel32.dll")]
    public static extern bool WriteProcessMemory( 
        IntPtr hProcess, IntPtr lpBaseAddress, 
        IntPtr lpBuffer, int nSize, 
        out int lpNumberOfBytesWritten );

....class omitted....
}
}


This is the declaration for the Windows API call
BOOL WriteProcessMemory( HANDLE hProcess, LPVOID lpBaseAddress,
    LPCVOID lpBuffer, SIZE_T nSize, SIZE_T* lpNumberOfBytesWritten)


Welcome to the world of P/Invoke Smile | :)



Jeremy Kimball

I have traveled the gutters, lo these many days, with no signs of life. Well met.
-brianwelsch
GeneralRe: DllImport Pin
Heath Stewart25-Jun-04 5:09
protectorHeath Stewart25-Jun-04 5:09 
GeneralXML document as Resource File Pin
ganeshvijay25-Jun-04 1:21
ganeshvijay25-Jun-04 1:21 
GeneralRe: XML document as Resource File Pin
Heath Stewart25-Jun-04 5:05
protectorHeath Stewart25-Jun-04 5:05 
GeneralSome Problems on DataGrid :- Pin
jk chan25-Jun-04 1:10
jk chan25-Jun-04 1:10 
GeneralRe: Some Problems on DataGrid :- Pin
Heath Stewart25-Jun-04 5:03
protectorHeath Stewart25-Jun-04 5:03 
GeneralRe: Some Problems on DataGrid :- Pin
jk chan25-Jun-04 20:22
jk chan25-Jun-04 20:22 
GeneralScrollbar Pin
_Searcher_25-Jun-04 0:21
_Searcher_25-Jun-04 0:21 
GeneralRe: Scrollbar Pin
Heath Stewart25-Jun-04 5:01
protectorHeath Stewart25-Jun-04 5:01 
GeneralRe: Scrollbar Pin
Wender Oliveira25-Jun-04 10:22
Wender Oliveira25-Jun-04 10:22 
GeneralRe: Scrollbar Pin
partyganger25-Jun-04 14:22
partyganger25-Jun-04 14:22 
GeneralInstantiating a class of type x at runtime Pin
Anonymous24-Jun-04 23:08
Anonymous24-Jun-04 23:08 
GeneralRe: Instantiating a class of type x at runtime Pin
Stefan Troschuetz24-Jun-04 23:44
Stefan Troschuetz24-Jun-04 23:44 
GeneralRe: Instantiating a class of type x at runtime Pin
shaunAustin28-Jun-04 0:29
shaunAustin28-Jun-04 0:29 
GeneralDynamically giving color to the datagrid Pin
HowRU24-Jun-04 23:02
HowRU24-Jun-04 23:02 
GeneralRe: Dynamically giving color to the datagrid Pin
Heath Stewart25-Jun-04 4:58
protectorHeath Stewart25-Jun-04 4:58 
GeneralMSN6 messenger development Pin
softp_vc24-Jun-04 22:54
softp_vc24-Jun-04 22:54 
GeneralRe: MSN6 messenger development Pin
amatyasik25-Jun-04 2:05
amatyasik25-Jun-04 2:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.