|
You can use a combination of tablelayout, flowlayout, form and controls' dock property to make all the controls scale nicely (thought not perfectly).
|
|
|
|
|
Hello
I am using multicast delegate as follows, but the effect in the server is undesirable:
Thing.OnEvent1 += new IThingEvents_OnEvent1EventHandler(OnEvent1);
Thing.OnEvent2 += new IThingEvents_OnEvent2EventHandler(OnEvent2);
Thing.OnEvent3 += new IThingEvents_OnEvent3EventHandler(OnEvent3);
The problem is that the (C++ COM) server it thinks it has all the connections for each event.
So in the below example it trys to send the event 3 times. Apart from the unecessary processing, I am worried it is making the inter-process call each time (the incorrect calls are being thrown away on the client side somewhere).
HRESULT Fire_OnOrderCancel(lots of params)
{
HRESULT hr = S_OK;
T * pThis = static_cast(this);
int cConnections = m_vec.GetSize();
for (int iConnection = 0; iConnection < cConnections; iConnection++)
{
pThis->Lock();
CComPtr punkConnection = m_vec.GetAt(iConnection);
pThis->Unlock();
IDispatch * pConnection = static_cast(punkConnection.p);
if (pConnection)
{
CComVariant avarParams[20];
//set avarParams
CComVariant varResult;
DISPPARAMS params = { avarParams, NULL, 9, 0 };
hr = pConnection->Invoke(1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, ¶ms, &varResult, NULL, NULL);
}
}
return hr;
}
What c#/.net thing do I need to use to get the desired behaviour, namely events to be fired once and the c# client to do the correct delegation?
Many Thanks
deds
|
|
|
|
|
Hi
I need to take the user session ID number (maybe is called session token or SID) in my windows VB.Net application, it is a unique number per session, same user different sessions should have different numbers. I tried a lot of ways (almost everything from win32) without success....
|
|
|
|
|
This sounds like what you need:
Process.GetCurrentProcess.SessionId
Good luck!
|
|
|
|
|
String ID=Session["ID"].ToString();
|
|
|
|
|
hi there,
I'm trying to connect to oracle DB from .net web service (c#), but can't connect. Please help if someone has any insight.
Here's what I'm doing:
Web service.WebMethod code:
---start
[WebMethod]
public string RunInterface1(string ConnectionString, string strQuery)
{
try
{
string connectionString = ConnectionString.ToString();
using (OracleConnection connection = new OracleConnection())
{
connection.ConnectionString = connectionString;
connection.Open();
OracleCommand command = connection.CreateCommand();
string sql = strQuery.ToString();
command.CommandText = sql;
OracleDataReader reader = command.ExecuteReader();
return "Success";
}
}
catch (Exception ex)
{
return ex.ToString();
}
}
--- end
Note: connection string and strQuery is passed as input parameters
Problem:
When I run it, I get following error:
Cannot access NLS data files or invalid environment specified
Thread:
System.Data.OracleClient.OracleException: ORA-12705: Cannot access NLS data files or invalid environment specified at System.Data.OracleClient.OracleException.Check(OciErrorHandle errorHandle, Int32 rc) at System.Data.OracleClient.OracleInternalConnection.OpenOnLocalTransaction(String userName, String password, String serverName, Boolean integratedSecurity, Boolean unicode, Boolean omitOracleConnectionName) at System.Data.OracleClient.OracleInternalConnection..ctor(OracleConnectionString connectionOptions) at System.Data.OracleClient.OracleConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) at System.Data.OracleClient.OracleConnection.Open() at Service.RunInterface1(String ConnectionString, String strQuery) in c:\Apps\test\testws\App_Code\Service.cs:line
What I have tried so far:
- Remove/rename registry entry for NLS_LANG - No luck, no matter what I do with it. Tried different value setup also.
- Tried with 3 versions of Oracle client: 8, 92 and 10. (current ver is 10)
- Cleanup registry - No issues
- I'm able to connect to same oracle instance from PL/SQL adn SQL plus
- I have created a windows form application - same code as you see above, and it works flawlessly there. Only web service fails. God knows why!!!
And yes, I have TNSnames.ora copied all over in the system: bin folder, wwwroot folder, app folder, oracle\...\network\admin folder... didn't leave any place.
for God sake, please help !!!
|
|
|
|
|
thanks all for reading.... I got it working.
installed vs2005 SP1. and it worked.
|
|
|
|
|
I have two applications which communicates trough remoting. when I try to set a property of a remote object a get the following exception and donno what to do. please help
System.Runtime.Serialization.SerializationException: Because of security restrictions, the type System.Runtime.Remoting.ObjRef cannot be accessed. ---> System.Security.SecurityException: Request failed.
at System.Runtime.Serialization.FormatterServices.nativeGetSafeUninitializedObject(RuntimeType type)
at System.Runtime.Serialization.FormatterServices.GetSafeUninitializedObject(Type type)
The action that failed was:
Demand
The type of the first permission that failed was:
System.Security.Permissions.SecurityPermission
The first permission that failed was:
<IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Flags="Infrastructure"/>
The demand was for:
<PermissionSet class="System.Security.PermissionSet"
version="1">
<IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Flags="Infrastructure"/>
</PermissionSet>
The only permitted permissions were:
<PermissionSet class="System.Security.PermissionSet"
version="1">
<IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Flags="SerializationFormatter"/>
</PermissionSet>
the client code:
ChannelServices.RegisterChannel(new IpcClientChannel(), false);
Manager manager = (Manager)Activator.GetObject(typeof(Manager), "ipc://channelname/Services");
manager.AddService(new ServiceProcess(new Setting("service", Setting.Status.Started, Setting.StartupType.Automatic, 30, "db conn")));
the server code:
IpcServerChannel ipc = new IpcServerChannel("channelname");
ChannelServices.RegisterChannel(ipc, false);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(Manager), "Services", WellKnownObjectMode.Singleton);
RemotingServices.Marshal(RemoteManager, "Services", typeof(Manager));
|
|
|
|
|
Is this running via ASP.NET? Or some other user with limited permissions? Or perhaps not on the Local Computer Zone?
|
|
|
|
|
both applications running on the local machine under a administrator account
|
|
|
|
|
It seems you are running it as a service?
Try running it without it perhaps. Not sure I can help any more
Try Googling for something similar.
|
|
|
|
|
Now I'm working on VS.NET 2008(professional edition), but for some reason, i need to use VS.NET 2005. So, i'm going to install VS 2005.
I need to know
whether it can cause any serious problem by having vs2005 and vs2008 on the same machine?
thank
^^
modified on Wednesday, June 4, 2008 12:43 AM
|
|
|
|
|
Hi,
I use VS 2003, 2005 and 2008 on the same machine and I have never encountered any issues with it.
You may have VS 2005 and 2008 on the same machine, provided the machine is hardware compatible for the use.
Hope this helps.
Vinay
ComponentOne LLC.
www.componentone.com
|
|
|
|
|
I have both the versions on my machine. But just to let you know that in Visual Studio 2008, you can set the target framework to .Net 2.0 which is same as Visual Studio 2005 framework.
Tariq A Karim
http://moplah.blogspot.com/
|
|
|
|
|
Just when I thought all the coding is done, i've hit a brick wall .. It's CP to the rescue
I have an NT Service ("Windows Service") which does some processing based on a configuration file. I can install and uninstall this NT service using installutil without any problem.
However, I need to be able to run multiple instances of the same NT Service each with various param.
E.g.
service1.exe /config1.xml
service1.exe /config2.xml
service1.exe /config3.xml
I have tried modifying the install-script and pass param:
e.g. installutil /i "service1.exe /config1.xml"
This installs, but when I look at the actual registry value under HKLM\System\CurrentControlSet\Services\Service1, the "ImagePath" key does not contain the additional arg I passed at install-time.
Then I manually modified the registry-key to include the additional arg, but I still cannot run subsequent installutil. It fails with "The specified service already exists" error.
How can I install multiple process instances of this Windows NT Service ? (Windows does runs multiple instances of "svchost.exe" without any problem)
Due to some constraints I cannot a) consolidate the logic and run as single process multiple threads or b) consolidate the logic and run as single process multiple app-domains or c) create multiple copies of the binaries in N different locations.
I look forward to your responses.
- Malhar
modified on Tuesday, June 3, 2008 5:16 PM
|
|
|
|
|
You can have multiple instances but you need to create them as different named services. You have to give them different names.
When starting a service, the Service Control Manager looks at the ImagePath to determine if the process that runs this service is already running. If it is but the process specifies WIN32_OWN_PROCESS in the Type value (either for the process already running or the one to be started) it fails. When performing the check, the whole command line, not just the EXE name, is used.
SvcHost uses the -k parameter for this purpose. This parameter doesn't do anything. It's just there to make the SCM instruct the right instance of SvcHost to start this service. SvcHost itself is a generic host process - it doesn't do anything itself, it just loads the DLL specified under the service's Parameters key. Microsoft have not documented the interface that a DLL must implement to be loaded by SvcHost - it's intended for their own use only.
DoEvents: Generating unexpected recursion since 1991
|
|
|
|
|
|
Hi i am working on desktop application.
i need to call my application from web browser through a protocol
Example: outlook:Contacts
how do i code for it .
this is regedit sample
* HKEY_CLASSES_ROOT
o alert
(Default) = "URL:Alert Protocol"
URL Protocol = ""
+ DefaultIcon
(Default) = "alert.exe"
+ shell
# open
* command
(Default) = "C:\Program Files\Alert\alert.exe" "%1"
i have no idea what goes where? can any1 be kind to help
|
|
|
|
|
While executing my C# console program, I'm unable to see the output window (console), it just blinks and exits as if some batch file has been executed.........how can i make the console window stay open till i closes it.........Thanks
Thanks
|
|
|
|
|
Put a Console.ReadKey() in there. This will keep the window open until someone presses a key.
|
|
|
|
|
thanks buddy............tht did worked.........!!!
Thanks
|
|
|
|
|
apart from pressing F5 directly u can go for Ctrl+F5 ... it will work fine ...
vikas da
|
|
|
|
|
Place onece the following code
Console.Read();
|
|
|
|
|
Hi All,
How can i know from the keyboard scan code what is the real key ?
I using KBDLLHOOKSTRUCT Structure in my keyboard hook to get the pressed keyboard information - But i still don't understand how can i know what the meaning of the key that was pressed even if i know the scanCode of the pressed key.
I don't want to use "switch..case" to check for each option pair So ... i looking some .net Framework class ( or win32 function ) that can find the value of the scanCode of the pressed key.
Beside this - how can i know if the key that pressed is 'A' or 'a' or '5' pr '%' - ?
Thanks for the help
|
|
|
|
|
Hi Yanshof,
Is this win32 function of any help to you. It will enable you to translate the vkCode member of the KBDLLHOOKSTRUCT to a character code.
MapVirtualKey Function
The MapVirtualKey function translates (maps) a virtual-key code into a scan code or character value, or translates a scan code into a virtual-key code.
To specify a handle to the keyboard layout to use for translating the specified code, use the MapVirtualKeyEx function.
AlanN
|
|
|
|
|