Click here to Skip to main content
15,903,856 members
Home / Discussions / C#
   

C#

 
GeneralRe: Child Control Painting problem(For the last time) Pin
Heath Stewart14-Jul-04 6:01
protectorHeath Stewart14-Jul-04 6:01 
GeneralBigger ImageList Pin
blankg13-Jul-04 11:50
blankg13-Jul-04 11:50 
GeneralRe: Bigger ImageList Pin
Heath Stewart14-Jul-04 4:01
protectorHeath Stewart14-Jul-04 4:01 
Generaldisable network card throw c# Pin
vipervip13-Jul-04 11:06
vipervip13-Jul-04 11:06 
Generalconfig file in console app to store connection string help Pin
mtbjr13-Jul-04 10:25
mtbjr13-Jul-04 10:25 
GeneralRe: config file in console app to store connection string help Pin
Heath Stewart14-Jul-04 3:56
protectorHeath Stewart14-Jul-04 3:56 
GeneralPointers and dereferencing Pin
frank29713-Jul-04 8:01
frank29713-Jul-04 8:01 
GeneralRe: Pointers and dereferencing Pin
Heath Stewart13-Jul-04 8:34
protectorHeath Stewart13-Jul-04 8:34 
Don't use ref or out with reference types (like a string) unless the address of a pointer is required (a pointer to a pointer to an object). So, const char * lpcszActivityName should be declared as string lpcszActivityName, for example.

FYI, you don't need to use the same parameter names. Function call execution uses a stack of parameters and pops parameters based on size. The parameter name is of no consequence when marshaling from managed to unmanaged code. Using ".NET-friendly" parameter names makes the code easier to follow.

Also, hContext should be declared as an IntPtr, not ref IntPtr. As I mentioned the last time, and IntPtr can also represent a memory address (which is a HANDLE, for which MSGHANDLE is a typedef) since it's a system-dependent size.

You really need to understand the difference between reference types (alloc'd on the heap) and value types (alloc'd on the stack; immutable), and understand the data type mapping. See Platform Invoke Data Types[^] for a mapping of basic data types.

 

Microsoft MVP, Visual C#
My Articles
Generalcapturing events when application closes Pin
vista2713-Jul-04 7:59
vista2713-Jul-04 7:59 
GeneralRe: capturing events when application closes Pin
Heath Stewart13-Jul-04 9:07
protectorHeath Stewart13-Jul-04 9:07 
GeneralArray of Struct within Struct Pin
Uday Shastri13-Jul-04 7:58
Uday Shastri13-Jul-04 7:58 
GeneralRe: Array of Struct within Struct Pin
Heath Stewart13-Jul-04 9:21
protectorHeath Stewart13-Jul-04 9:21 
GeneralRe: Array of Struct within Struct Pin
Uday Shastri13-Jul-04 9:47
Uday Shastri13-Jul-04 9:47 
GeneralRe: Array of Struct within Struct Pin
Heath Stewart13-Jul-04 10:19
protectorHeath Stewart13-Jul-04 10:19 
Generalupload files Pin
Steven M Hunt13-Jul-04 7:03
Steven M Hunt13-Jul-04 7:03 
GeneralRe: upload files Pin
Heath Stewart13-Jul-04 9:17
protectorHeath Stewart13-Jul-04 9:17 
GeneralRe: upload files Pin
Steven M Hunt14-Jul-04 14:31
Steven M Hunt14-Jul-04 14:31 
GeneralRe: upload files Pin
Heath Stewart19-Jul-04 2:02
protectorHeath Stewart19-Jul-04 2:02 
Generalstruct question Pin
ConfusedAsHeck13-Jul-04 5:30
sussConfusedAsHeck13-Jul-04 5:30 
GeneralRe: struct question Pin
Tom Larsen13-Jul-04 5:34
Tom Larsen13-Jul-04 5:34 
GeneralRe: struct question Pin
Heath Stewart13-Jul-04 6:11
protectorHeath Stewart13-Jul-04 6:11 
GeneralAccessing Forms Pin
Mehbub13-Jul-04 5:02
Mehbub13-Jul-04 5:02 
GeneralRe: Accessing Forms Pin
Tom Larsen13-Jul-04 5:27
Tom Larsen13-Jul-04 5:27 
GeneralRe: Accessing Forms Pin
Colin Angus Mackay13-Jul-04 6:03
Colin Angus Mackay13-Jul-04 6:03 
GeneralRe: Accessing Forms Pin
Dave Kreskowiak13-Jul-04 12:46
mveDave Kreskowiak13-Jul-04 12:46 

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.