Click here to Skip to main content
15,888,816 members
Home / Discussions / C#
   

C#

 
GeneralCalling a C# DLL in C++ Pin
Anonymous1-Sep-02 3:39
Anonymous1-Sep-02 3:39 
GeneralRe: Calling a C# DLL in C++ Pin
Stephane Rodriguez.1-Sep-02 4:04
Stephane Rodriguez.1-Sep-02 4:04 
QuestionHow to change namespace for resource file? Pin
tomiga1-Sep-02 1:29
tomiga1-Sep-02 1:29 
QuestionAm I doing it right? Pin
Li-kai Liu (Angus)31-Aug-02 17:50
Li-kai Liu (Angus)31-Aug-02 17:50 
GeneralIs it legal to use the Shell32.dll icons Pin
gekoscan31-Aug-02 14:49
gekoscan31-Aug-02 14:49 
GeneralRe: Is it legal to use the Shell32.dll icons Pin
ColinDavies31-Aug-02 15:38
ColinDavies31-Aug-02 15:38 
QuestionHow to use "win32_find_data" in C# or VB.net? Pin
Segal30-Aug-02 19:45
Segal30-Aug-02 19:45 
AnswerRe: How to use "win32_find_data" in C# or VB.net? Pin
leppie31-Aug-02 2:14
leppie31-Aug-02 2:14 
Hi
You will need to define 2 structures in C# first namely, FILETIME and WIN32_FIND_DATA. As:

C#
struct FILETIME { 
    int dwLowDateTime; 
    int dwHighDateTime; 
}

struct WIN32_FIND_DATA {
  int dwFileAttributes; 
  FILETIME ftCreationTime; 
  FILETIME ftLastAccessTime; 
  FILETIME ftLastWriteTime; 
  int nFileSizeHigh; 
  int nFileSizeLow; 
  int dwReserved0; 
  int dwReserved1; 
  string cFileName; //mite need marshalling, TCHAR size = MAX_PATH???
  string cAlternateFileName; //mite need marshalling, TCHAR size = 14
}

[DllImport("kernel32.dll")]
static extern IntPtr FindFirstFile( IntPtr lpfilename, ref WIN32_FIND_DATA findfiledata);

[DllImport("kernel32.dll")]
static extern IntPtr FindClose( IntPtr pff);

public static WIN32_FIND_DATA FindFile(string filename)
{
  WIN32_FIND_DATA fd;
  IntPtr pff = FindFirstFile(Marshal.StringToHGlobalAuto(filename), ref fd);
  if (ppf == IntPtr.Zero) throw new FileNotFoundException();
  FindClose(ppf);
  return fd;
}


Thats should do it, didnt check. Perhaps the TCHAR in the structs, but this should set u well on your way. Obviously, you can Add the other FindFile functions as well.

Maybe there is something in .Net doing the same already???

Smile | :)

MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc
for more info. Big Grin | :-D
AnswerRe: How to use "win32_find_data" in C# or VB.net? Pin
leppie31-Aug-02 2:22
leppie31-Aug-02 2:22 
AnswerRe: How to use "win32_find_data" in C# or VB.net? Pin
leppie31-Aug-02 4:24
leppie31-Aug-02 4:24 
QuestionThreads vs. Async calls (delegate)? Pin
TigerNinja_30-Aug-02 7:38
TigerNinja_30-Aug-02 7:38 
AnswerRe: Threads vs. Async calls (delegate)? Pin
leppie30-Aug-02 7:45
leppie30-Aug-02 7:45 
GeneralRe: Threads vs. Async calls (delegate)? Pin
TigerNinja_30-Aug-02 8:57
TigerNinja_30-Aug-02 8:57 
GeneralRe: Threads vs. Async calls (delegate)? Pin
James T. Johnson30-Aug-02 9:03
James T. Johnson30-Aug-02 9:03 
GeneralCultureInfo could not be serialized by WebService Parameter, Pin
Chris Richner30-Aug-02 2:14
Chris Richner30-Aug-02 2:14 
GeneralAudio Output Pin
Nnamdi Onyeyiri30-Aug-02 1:42
Nnamdi Onyeyiri30-Aug-02 1:42 
GeneralRe: Audio Output Pin
Michael Mac30-Aug-02 2:10
Michael Mac30-Aug-02 2:10 
GeneralRe: Audio Output Pin
leppie30-Aug-02 2:48
leppie30-Aug-02 2:48 
GeneralRe: Audio Output Pin
Nnamdi Onyeyiri30-Aug-02 3:03
Nnamdi Onyeyiri30-Aug-02 3:03 
GeneralRe: Audio Output Pin
leppie30-Aug-02 3:50
leppie30-Aug-02 3:50 
GeneralBlinking in GDI+ Pin
Majid Shahabfar30-Aug-02 1:37
Majid Shahabfar30-Aug-02 1:37 
GeneralRe: Blinking in GDI+ Pin
Nnamdi Onyeyiri30-Aug-02 1:42
Nnamdi Onyeyiri30-Aug-02 1:42 
GeneralRe: Blinking in GDI+ Pin
Majid Shahabfar30-Aug-02 7:29
Majid Shahabfar30-Aug-02 7:29 
GeneralRe: Blinking in GDI+ Pin
Maciej Pirog30-Aug-02 7:48
Maciej Pirog30-Aug-02 7:48 
GeneralRe: Blinking in GDI+ Pin
Nnamdi Onyeyiri30-Aug-02 10:15
Nnamdi Onyeyiri30-Aug-02 10:15 

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.