Click here to Skip to main content
15,923,083 members
Home / Discussions / C#
   

C#

 
GeneralRe: Open and Read a file Pin
leppie8-Aug-02 1:27
leppie8-Aug-02 1:27 
GeneralRe: Open and Read a file Pin
8-Aug-02 1:45
suss8-Aug-02 1:45 
GeneralRe: Open and Read a file Pin
James T. Johnson8-Aug-02 2:39
James T. Johnson8-Aug-02 2:39 
GeneralDockable form Pin
Sam19798-Aug-02 0:15
Sam19798-Aug-02 0:15 
GeneralRe: Dockable form Pin
leppie8-Aug-02 1:24
leppie8-Aug-02 1:24 
GeneralRe: Dockable form Pin
Anonymous8-Aug-02 18:30
Anonymous8-Aug-02 18:30 
GeneralRe: Dockable form Pin
leppie8-Aug-02 22:43
leppie8-Aug-02 22:43 
GeneralTrouble w/ Multithreaded Windows Service Please Help Pin
Aisha7-Aug-02 13:43
Aisha7-Aug-02 13:43 
GeneralBinaryWriter Pin
Steven Behnke7-Aug-02 11:55
Steven Behnke7-Aug-02 11:55 
GeneralTextbox input with the passwordchar Pin
Bill Ferreira7-Aug-02 9:17
Bill Ferreira7-Aug-02 9:17 
GeneralRe: Textbox input with the passwordchar Pin
Nnamdi Onyeyiri7-Aug-02 21:49
Nnamdi Onyeyiri7-Aug-02 21:49 
GeneralSolutions with multiple projects Pin
Bill Ferreira7-Aug-02 9:11
Bill Ferreira7-Aug-02 9:11 
GeneralRe: Solutions with multiple projects Pin
Nnamdi Onyeyiri7-Aug-02 21:50
Nnamdi Onyeyiri7-Aug-02 21:50 
QuestionCentering Message Boxs - How? Pin
Joel Matthias6-Aug-02 7:33
Joel Matthias6-Aug-02 7:33 
QuestionIs there a vertical scrollbar? Pin
Nnamdi Onyeyiri6-Aug-02 7:11
Nnamdi Onyeyiri6-Aug-02 7:11 
AnswerRe: Is there a vertical scrollbar? Pin
Luis Alonso Ramos7-Aug-02 7:19
Luis Alonso Ramos7-Aug-02 7:19 
GeneralRe: Is there a vertical scrollbar? Pin
Nnamdi Onyeyiri7-Aug-02 7:37
Nnamdi Onyeyiri7-Aug-02 7:37 
GeneralReturning by Ref Pin
gekoscan6-Aug-02 6:35
gekoscan6-Aug-02 6:35 
GeneralRe: Returning by Ref Pin
Nnamdi Onyeyiri6-Aug-02 7:10
Nnamdi Onyeyiri6-Aug-02 7:10 
GeneralRe: Returning by Ref Pin
Andy Smith6-Aug-02 9:19
Andy Smith6-Aug-02 9:19 
QuestionProblem in Running in Other Platform! Why? Pin
DotNet6-Aug-02 1:24
DotNet6-Aug-02 1:24 
AnswerRe: Problem in Running in Other Platform! Why? Pin
James T. Johnson6-Aug-02 1:50
James T. Johnson6-Aug-02 1:50 
AnswerRe: Problem in Running in Other Platform! Why? Pin
Johnny Zee6-Aug-02 4:33
sussJohnny Zee6-Aug-02 4:33 
QuestionHow to use uxtheme APIs in custom control? Pin
Li-kai Liu (Angus)6-Aug-02 0:13
Li-kai Liu (Angus)6-Aug-02 0:13 
AnswerRe: How to use uxtheme APIs in custom control? Pin
James T. Johnson6-Aug-02 1:49
James T. Johnson6-Aug-02 1:49 
Li-kai Liu (Angus) wrote:
I'm wrting a custom control that will use theme library to
draw my control.


Unless you are doing something special the "easy" thing to do is to create a manifest file for your application and set the FlatStyle of your controls to FlatStyle.System.

If you want to go this route, Chris Sells' website[^] has a manifest file for VS.NET, you can use this same file for your application just rename it to myapp.exe.manifest.

That said, on to your other question.

Li-kai Liu (Angus) wrote:
What's P/Invoke?

P/Invoke is a method of executing functions from a C-style dll in a .NET program.

The first step is to declare the function you wish to use and the file that it is in. I'll use OpenThemeData as an example. There is a step embedded in this first step, in that you have to convert all the types used into .NET equivalent types. This is something you learn with practice and time.

[DllImport("uxtheme.dll")]
public extern static IntPtr OpenThemeData(IntPtr hwnd, string pszClassList);


Note that since the second parameter is a wide string (unicode) I could just pass the string in directly and not have to involve the MarshalAs attribute.

For more information look up the DllImport and MarshalAs attributes up in MSDN. If you have to pass structures around you'll probably also need to look at the StructLayout attribute.

HTH,

James

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.