Windows Mobile does, Windows Phone 7 does not.
Ghydo
Posts
-
Windows Phone 7 - Remote Desktop -
Windows Phone 7 - Remote Desktop -
Problem with Process.Start("WINWORD.EXE", selectedFile); [modified]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?
-
Using own .dll in 64 bit version system - exception: ""BadImageFormatException was unhandled""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?
-
Using own .dll in 64 bit version system - exception: ""BadImageFormatException was unhandled""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.
-
Using cards.dll in Windows 7It 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.
-
Generics problemUnfortunately 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[^].
-
Generics problemThe problem in your code is that you cannot convert an
int
to aValueType
.T
is aValueYype
, so you can use only the methods defined in that class when using objects of typeT
. What are you trying to achieve? -
file contentsInstead 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; -
Re: Calling an event to a class in a different namespaceTo fire event you can use the
MenuItem.PerformClick
method. To call it from the form you should expose a public method in thePanelMasterlist
class that fire the delete event, something like this:public void DeleteMasterList()
{
contextDeleteMasterList.PerformClick();
} -
What is this message telling me?Hi Bert,
reinterpret_cast
can cast to anything you want: to cast to aunsigned int
you can usereinterpret_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). IfdictParameters[POINT_PARAM]
is an array ofunsigned int ^
your cast was correct and you should dereferencepointParam
to obtain the value, but if it is an array ofstring
you have to convert it usingint::Parse
. How isdictParameters
defined? I hope it is clearer! :) -
Display current time in Label controlYour 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 toInitializeComponent()
. -
What is this message telling me?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 anunsigned 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 anint
. Hope it helps! -
calling a winapi function from managed codeTo use a string as an output parameter you should use the
StringBuilder
class instead ofString
.[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! :)
-
how to create 2 threads on on diferent procesorsWait, 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: -
how to create 2 threads on on diferent procesorsThis is surely a better solution than mine! :)
-
how to create 2 threads on on diferent procesorsC# 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.
-
Syntax error (missing operator) in query expression -
Read and Write a file at the same time?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. -
How to embed images in to xml file?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[^].