Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
G

Ghydo

@Ghydo
About
Posts
33
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Windows Phone 7 - Remote Desktop
    G Ghydo

    Windows Mobile does, Windows Phone 7 does not.

    Mobile help question

  • Windows Phone 7 - Remote Desktop
    G Ghydo

    Windows Phone 7 does not have native RDP support. Your best bet is to start from the official protocol specification in the MSDN[^]. Unfortunately implementing the whole protocol is not a trivial task even if you want to implement only basic functionality (i.e. graphic and mouse).

    Mobile help question

  • Problem with Process.Start("WINWORD.EXE", selectedFile); [modified]
    G Ghydo

    Do the user under which is running your program have write privileges over the file? Can you open it by hand (eg. open Word and then open the html file) and save it?

    C# csharp help html visual-studio debugging

  • Using own .dll in 64 bit version system - exception: ""BadImageFormatException was unhandled""
    G Ghydo

    The error message sometimes can be misleading, in fact it can also be raised if the loaded dll cannot find another library that it depends on. How is the ASM library compiled?

    C# question announcement

  • Using own .dll in 64 bit version system - exception: ""BadImageFormatException was unhandled""
    G Ghydo

    The compiler is expecting a managed library: did you add the library.dll to your project references? You should not do that if the library is native (non managed), the DllImport line should suffice.

    C# question announcement

  • Using cards.dll in Windows 7
    G Ghydo

    It looks like you are trying to load a 32bit dll from a 64bit program. Are you using a 64bit os and compiling you program for any platform? If so you can try to compile your app for 32bit only (set the project’s properties from "any" platform target to "x86" - it will run also on 64bit systems) and see if it works. Hope it helps.

    C# com graphics tutorial question

  • Generics problem
    G Ghydo

    Unfortunately C# generics are not C++ generics, C# doesn't support numeric generics because there is no common base class of int/float/whatever that support calculation operations. You can do it the old manner, creating a class for every type you wish to support. There is another solution that uses generics in a different manner here[^].

    Managed C++/CLI help question learning

  • Generics problem
    G Ghydo

    The problem in your code is that you cannot convert an int to a ValueType. T is a ValueYype, so you can use only the methods defined in that class when using objects of type T. What are you trying to achieve?

    Managed C++/CLI help question learning

  • file contents
    G Ghydo

    Instead of using a foreach construct to loop over all the lines use only the first line (if I understood your question correctly):

    string[] lines = File.ReadAllLines(strFilename);
    string[] fragments = lines[0].Split(',');
    errors.Text += fragments[0];
    errors.Visible = true;

    C# help question database

  • Re: Calling an event to a class in a different namespace
    G Ghydo

    To fire event you can use the MenuItem.PerformClick method. To call it from the form you should expose a public method in the PanelMasterlist class that fire the delete event, something like this:

    public void DeleteMasterList()
    {
    contextDeleteMasterList.PerformClick();
    }

    C# database tutorial question

  • What is this message telling me?
    G Ghydo

    Hi Bert, reinterpret_cast can cast to anything you want: to cast to a unsigned int you can use reinterpret_cast<unsigned int^>. (MSDN[^]) int::Parse is a method that takes a string and converts it (not cast) into its integer value (string "135" --> int 135). If dictParameters[POINT_PARAM] is an array of unsigned int ^ your cast was correct and you should dereference pointParam to obtain the value, but if it is an array of string you have to convert it using int::Parse. How is dictParameters defined? I hope it is clearer! :)

    Managed C++/CLI c++ question data-structures help

  • Display current time in Label control
    G Ghydo

    Your code is correct, but you should not modify "by hand" the code inside the InitializeComponent method. You should put your custom initialization code inside the constructor, after the call to InitializeComponent().

    Managed C++/CLI help csharp c++ visual-studio

  • What is this message telling me?
    G Ghydo

    The compiler complains because you are trying to add a number with a reference (a reference is like a C++ pointer, but it "points" to a garbage collected object). unsigned int ^ is a reference to an unsigned int, so you should dereference it to get the actual value:

    sagXArray = gcnew array<double>(*pointParam + 2);

    But this will not work if you pass a number as a string (ex. "135"), you have to convert the string to a number using the method int::Parse:

    int pointParam = int::Parse(dictParameters[POINT_PARAM]);
    sagXArray = gcnew array<double>(pointParam + 2);

    Note that in this case I'm not dereferencing pointParam because it is declared as an int. Hope it helps!

    Managed C++/CLI c++ question data-structures help

  • calling a winapi function from managed code
    G Ghydo

    To use a string as an output parameter you should use the StringBuilder class instead of String.

    [DllImport("avicap32.dll"),CharSet=CharSet.Unicode]
    extern "C" bool capGetDriverDescription(UInt16, StringBuilder^, int, StringBuilder^, int);

    But in C++/CLI you can directly call the native C function without use P/Invoke: you can mix managed and unmanaged code. Hope it helps! :)

    Managed C++/CLI question com performance help

  • how to create 2 threads on on diferent procesors
    G Ghydo

    Wait, re-reading carefully the documentation it seems that it is only for XNA and XBox360. I tried a small test program and the Thread.SetProcessorAffinity does not exist in the standard 3.5 .NET framework. Am I missing something obvious? :confused:

    C# tutorial asp-net help lounge

  • how to create 2 threads on on diferent procesors
    G Ghydo

    This is surely a better solution than mine! :)

    C# tutorial asp-net help lounge

  • how to create 2 threads on on diferent procesors
    G Ghydo

    C# seems not to support the feature you are requiring, you should use some Interop to do it. This snippet should do the work (I found it here[^], I didn't tested it.

    class Program
    {
    [DllImport("kernel32")]
    static extern int GetCurrentThreadId();
    static void Main()
    {
    Thread t = new Thread(
    new ThreadStart(DoWork));
    t.Start();
    t.Join();
    }

    static void DoWork()
    {
    	foreach(ProcessThread pt in Process.GetCurrentProcess().Threads)
    	{
    		int utid = GetCurrentThreadId();
    		if (utid == pt.Id)
    		{
    			pt.ProcessorAffinity = (IntPtr)(1); // Set affinity for this thread to CPU #1
    			Console.WriteLine("Set");
    		}
    	}
    }
    

    }

    But why do you want to change the thread affinity? The scheduler should automatically take advantage of both CPU cores.

    C# tutorial asp-net help lounge

  • Syntax error (missing operator) in query expression
    G Ghydo

    Maybe using table names starting with a number can be a problem: identifiers starting with a number has a special meaning in SQL server (documentation here[^]). Try enclosing the identifiers inside square brakets (eg [2010Outcome].InProg). I'm not sure this is your problem through. :confused:

    C# database help csharp

  • Read and Write a file at the same time?
    G Ghydo

    You can create a FileStream that allows read access using this[^] constructor:

    Stream stream = new FileStream(path + filename, FileAccess.OpenOrCreate, FileAccess.Write, FileShare.Read);
    TextWriter writer = new StreamWriter(stream);

    Also it is a better pratice to dispose of the stream, enclosing them with the using keyword.

    C# csharp question

  • How to embed images in to xml file?
    G Ghydo

    Are you trying to insert images into an Excel (XML Spreadsheet) file? I don't know how to do it, try to look at the documentation[^].

    XML / XSL xml help tutorial question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups