|
Hi
How can I retrieve the terminal session id?
My code is as follows:
[DllImport ("User32.lib", CharSet = CharSet.Auto)]
private static extern Boolean GetSystemMetrics(int nIndex);
[DllImport ("Kernel32.lib", CharSet = CharSet.Auto)]
private static extern uint WTSGetActiveConsoleSessionId();
public static Boolean IsRemoteSession()
{
return GetSystemMetrics( SM_REMOTESESSION );
// Where can I get this SM_REMOTESESSION from?
}
public static uint GetSessionId()
{
return WTSGetActiveConsoleSessionId();
}
|
|
|
|
|
Hi!
Usually the easiest way to get the real definition for constants like SM_REMOTESESSION is to search through the header files in the platform sdk.
You can use VS.NET's search in files dialog:
search [VS.NET Installation Path]\Vc7\PlatformSDK\Include (including subdirectories) for *.h files containing the symbol and you'll find the definition.
In your case, it's defined in WinUser.h and its value is 0x1000.
Regards,
mav
|
|
|
|
|
Hi
Thanks. Then where can I get a list of functions in the wtsapi32.dll?
|
|
|
|
|
You can use DependencyWalker (http://www.dependencywalker.com/[^]) to get the function names in dlls, but without a description of what the functions do and which parameters they expect you won't get very far.
So the better choice is to read the documentation on MSDN.
Regards,
mav
|
|
|
|
|
|
Do anyone have any website, notes or links on .NET WebApplication using C# ??
Topics about how to create forms using .NET Web Application, just like a user interface retrieving data from the database...Or anyone can post me the past examples or folders you have done using C# Webapplication??
Thankz alot... Your help is been appreciated..
Cheese_kid =p
|
|
|
|
|
What you really want is ASP.NET. There's a bazillion examples and tutorials out there. You may want to start at http://www.asp.net[^]
Picture a huge catholic cathedral. In it there's many people, including a gregorian monk choir. You know, those who sing beautifully. Then they start singing, in latin, as they always do: "Ad hominem..."
-Jörgen Sigvardsson
|
|
|
|
|
Are you sure you mean bazillion and not brazillion[^]?
SCNR
mav
|
|
|
|
|
HI,
I am working in crystal reports XI. In this I have to code in C# such that , it have to load a image at run time in crystal ReportXI .
I searched a lot in net but couldnt do the thing which i want to do.
I found that Dyanmic image location in crystal reprot XI , a advantage in
CR-XI.
But I dont know how to do this ... In the future I willbe working with many application based on this concept.
so please any one explain how to do .
or send the coding part ....
j s
-- modified at 1:07 Friday 7th October, 2005
|
|
|
|
|
I am a beginner to C#.Net and i am supposed to do these...
I have a textbox for URL, a button to load the webpage onto the web browser(web1) on my windows form.
After loading is complete, the user can click on image to have the image transferred to the second web browser (web2).
The user can also highlight a block of text, after the mouse down is released, the block of text from web1 is to be transferred in web2.
So far, I have only done the web1.navigate2(...) part. Can anybody lead me to the correct path?
Thank you.
|
|
|
|
|
Can you explain further the purpose of the second web browser? When the user clicks an image in browser 1, are you wanting the image to be downloaded locally and parsed into a web page for browser two, or are you simply wanting the browser2 to navigate to the internet url of the image that was clicked?
|
|
|
|
|
The second browser actually acts as a temporary location for my actual project.
I want to have the image downloaded locally, preferably saved to my relative location with the actual name of the file from the website.
Anyway to do this? Please help.
Thank you
|
|
|
|
|
I haven't worked with the IE control in such a long time, but I know this is possible. Are you familiar enough with the System.IO namespace that you can write the file to the relative location? I don't remember the exact methods, but there should be an event that fires whenan image is clicked with the arguments including the path of the image, once you get this then you simply download the file and use System.IO to save it out to the hard drive. If you'll trust me enough to send me the code for your current project, I'll look and see what I can remember.
|
|
|
|
|
I am trying to find a way to determine if a thread object has been instantiated. Not if it's been started/stopped/suspended, etc, but instantiated/declared:
ie:
t = new Thread(new ThreadStart(FSUIPC_Handler));
if(t exists)
{
t.Start();
}
How could I determine if "t" exists?
|
|
|
|
|
You can write some thing like the following
if(t != null)
{
t.Start();
}
MCAD
|
|
|
|
|
|
Would checking for null help?
t = new Thread(new ThreadStart(FSUIPC_Handler));
if (t != null)
{
...
}
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
hi, can anyone explain to me:
Public Overrides Function GetHashCode() As Integer
Dim hash As Int32
hash = pk1 And pk2
Return hash
End Function
is "And" basically an "bitwise AND" operator? On the contrary, what's "bitwise OR" operator? And why are we using bitwise AND in GetHashCode? Guess been out of school for awhile, don't see how "And" can give you a unique ID/Hashcode...
Did some testing, doesn't work.
1 AND 581 = 1
1 AND 57 = 1
1 OR 580 = 581
1 OR 581 = 581
So... AND/OR operator won't work. Should I use XOR... It seems to work... What's the logic behind this... I don't see why XOR would produce unique hashcode as some suggested.
REF 1: GetHashCode and XOR
http://mathworld.wolfram.com/XOR.html
REF 2: XOR - Mathematics
Why XOR would work in producing unique hashcode? What's the math behind this...
|
|
|
|
|
(I'm not sure if this belongs better in the ASP.NET forum, but since it's a Windows forms app calling it, and the problem is in the caller, I thought it goes here.)
Hello,
I have a Windows Forms application that uses web services on a remote server (hosted somewhere else, no access to it). It works perfectly when run with a local server or in that remote/production server.
But when the main window appears, a secondary thread is started to call another method in a web service in the same server to get the newest version, and if newer than the current version, a form is displayed to the user telling him to go to the website to download.
This works perfectly on both my development machines with a local server. And this works perfectly with the client running on both my development machines against the remote server.
But that's it. When I run the app in any other machine, the call to the web service to get the latest version throws a System.Net.WebException with a message The underlying connection was closed: Unable to connect to the remote server. I found this with a development copy full of Console.WriteLine s on another machine on my same network. The only difference I can think of between that machine and mine is that mine have IIS installed while that one does not. But still, it puzzles me that everything from the main thread works fine, and not from the secondary thread.
So, any ideas?
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
Is there a collection object in the C# .NET framework. I need an object that contains a list of objects indexed by another object?
E.g. A list of type Employee indexed on string name where name = Employee.name
|
|
|
|
|
|
Hi dudes. how are you everybody ????
When you Open Start ---> run -----> and type any command like (cmd , regedit) it will execute the command.
So how can i make a command line string of my own to do some operations when the user type it in run dialog of the windows operating system. ? if anybody can help me with this
Miss With The Best And Die Like The Rest
|
|
|
|
|
You need to handel Command Line Arguments in Your program So use public static void Main(string Args[]) Or static int Main(string[] Args) instead of parametersless Main method
look at Command-Line Arguments[^]
you need to parse this arguments to handle more complex parameters an example for this can be found at C#/.NET Command Line Arguments Parser
[^]
MCAD
-- modified at 20:59 Thursday 6th October, 2005
|
|
|
|
|
Take a look at the registry key SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths
|
|
|
|
|
Okay, I give - been all over the net and nothing comes close. You'd think this was the first time somebody cam across this in C#:
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi)]
public struct AGENT_DATA
{
//[MarshalAs(UnmanagedType.LPArray, SizeConst=3000, ArraySubType=UnmanagedType.LPStr)]
//[MarshalAs(UnmanagedType.SafeArray, SafeArraySubType=System.Runtime.InteropServices.VarEnum.VT_LPSTR)]
//[MarshalAs(UnmanagedType.ByValTStr, SizeConst=15)]
//[MarshalAs(UnmanagedType.ByValArray, SizeConst=3000, ArraySubType=UnmanagedType.ByValTStr)]
public string[] m_AgentNames;
}
As you can see, I've tried several attributes - all runtime error. "Cannot obtain size of struct" when I attempt to:
int nSize = Marshal.SizeOf(agentData);
There will be no more than 3000 names, about 15 characters long.
Eventually, I'm going to: IntPtr lParam = Marshal.AllocHGlobal(nSize);
and then: Marshal.StructureToPtr(agentData, lParam, false);
finally:
Win32APIWrapper.PostMessage(
m_hMessageHandlerWindowHandle,
WM_MESSAGE,
(uint)(wParam.ToInt32()),
lParam.ToInt32());
This structure will then be consumed in a C++ module.
So... How do I Marshal a string array of "n" elements that are "l" characters?
Thanks. If you know - Go tell MSFT, so they can post it somewhere.
Note: the names are 15 ascii alphabetical characters. I'd rather avoid using BSTRs but am open to suggestions.
Jay McCormick
|
|
|
|