|
Thanks man, you're brilliant!
|
|
|
|
|
I have an application that calls win32 Dlls in c# with P/Invoke. The application works fine in the 32-bit window XP. When I migrate it to the 64-bit window XP( virtual machine ), the application fail to load win32 DLLs and with an error message of {"An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)"}. Anyone know whats the problem and how to solve this problem. Any help is appreciated. Thanks.
|
|
|
|
|
You cannot load 32-bit DLLs in a 64-bit process.
If you want to run your .NET program on a 64-bit machine but cannot provide 64-bit versions of native DLLs it uses, you should force it to run in a 32-bit process. (You will obviously lose the address-space benefits of running in a 64-bit process.) To do this, change the Platform Target property on the Build tab of Project Properties from 'Any CPU' (the default) to 'x86'.
You may want to consider generating a separate configuration for your project. Go to Build, Configuration Manager and in the Active Solution Platform drop-list, select <New...>. Then select 'x86' from the 'select new platform' drop-list and click OK.
DoEvents: Generating unexpected recursion since 1991
|
|
|
|
|
in vb we have keyword as call that call a method , Is there any in c# that do work like this.
Yogesh Pekhale
pekhaleyogesh@gmail.com
|
|
|
|
|
To call a method, just specify it's name. I don't understand what you're talking about.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
let i have method test in code behind file
public void test()
{
// some code
}
i have one string varibale strMethodname ;
now i want to excute test method from this vaiable name;
i.e
public void mentodname(methodname)
{
//methodname = "test()"
strMethodname = methodname;
// i ahve to write some code so that i can execute test() function from strMethodname
// in vb we can write like this call(strMethodname)
// but waht in c#
}
Yogesh Pekhale
pekhaleyogesh@gmail.com
|
|
|
|
|
That would be reflection.
object res = MyObj.GetType().GetMethod("MethodName").Invoke(MyObj,new object[] {arg1,arg2 etc});
|
|
|
|
|
Thanks that work fine
Yogesh Pekhale
pekhaleyogesh@gmail.com
|
|
|
|
|
In C# no need to use that. What are you trying to do ?
|
|
|
|
|
I have a generic class "A" another generic interface "IInterface". I also have a derived class from "A". See the following code
class A<T>
{
public void Save()
{
IInterface interface = (IInterface)new InterfaceImpl();
interface.Save((T)this);
}
}
class Derived : A<Derived>
{
}
class InterfaceImpl : IInterface<Derived>
{
public void Save(Derived instance)
{
}
} As shown in the example, I need to call Save() method written inside the InterfaceImpl class. Is there any other way to do this without casting base class object to child class ? Is there any performance problem when base class object is casted into child class object ?
|
|
|
|
|
how to draw progress bar in "orbit" download in file bottom
thanks
|
|
|
|
|
Where do you want to draw it ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
can i start and stop the sql server programaticaly ?
Reason is , i have to take the backup of the database , at regular intervals. Which can't be done without stopping the service manager.
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|
|
|
My database is sql server and front end is asp.net 2.0 c#
May i use the window or web service in this case ?
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|
|
SQL server has a windows service running. You need to Stop/Start that. The Service controller class gives access to the services installed on machine. What is the problem you are facing now ?
|
|
|
|
|
I want to start/stop the Sql server service manager programatically
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|
|
Hello,
By using "System.ServiceProcess" you can start and stop a service:
Like:
public static void StopService(string servicename)
{
ServiceController actService = FindServiceByName(servicename);
if(actService!=null)
{
actService.Stop();
actService.Dispose();
}
}
All the best,
Martin
|
|
|
|
|
what parameter should i write , if i have to stop the sql server service manager
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|
|
You use the stop method as given by martin above and to start you use the start method.
(These won't work under Vista by the way, unless you elevate your app to Administrator using an Application Manifest File.)
Dave
|
|
|
|
|
i created the window app there i was trying to write the system.serviceprocess
i was unable to to write there , the library was tot emerging.
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|
|
You need to add a reference in your project references to System.ServiceProcess and then add using System.ServiceProcess; at the top of the class.
Dave
|
|
|
|
|
ServiceController actService = FindServiceByName(servicename);
and there is a problem in FindServiceByName funciton
what should i add for this function ?
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|
|
Sorry, forgot that one!
Something like that:
public static ServiceController FindServiceByName(string servicename)
{
ServiceController actService = null;
ServiceController[] services;
services = ServiceController.GetServices();
for(int i = 0; i < services.Length; i++)
{
if(services[i].ServiceName.Equals(servicename))
{
actService = services[i];
}
else
{
services[i].Dispose();
}
}
return actService;
}
All the best,
Martin
|
|
|
|
|
Thank You....
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|