|
And by the way,
Richard MacCutchan wrote: but we also spend a lot of time answering questions like this from people who have not taken the time to learn some of the basics.
If we do, we do so only by choice. (Reading them is at least partly another matter.)
|
|
|
|
|
First, you have to tell us where you got the code so we have a context in which to help yopu.
Second, you need to properly format the code you posted into a properly tagged PRE block.
Third, you need to use punctuation in your description so we can read it.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
|
Thank you for putting the proper tags around your code. The first thing that jumps out is that you're using int types for your interop methods. You should be using IntPtr so that the code will run reliably on both 32-bit and 64-bit operating systems.
Beyond that, I think you're going to have to find some additional code (or technique) that allows you to select a connected video capture device. I believe this will involve familiarity with the DirectX SDK, and more specifically buding what they call "graphs" to connect the various devices.
You may be able to use WMI to detect devices connected to the system (especially if they're USB or Firewire devices, but I've never done this before, so yo're gonna have to do the research.
Ain't programming fun?
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
thank u for your post
where should i exactly change int to intptr and what is the difference
thanks
|
|
|
|
|
I believe it's the external methods that return int and that they should return IntPtr. These are windows api functions and though I didn't look at them individually they probably return windows handles. Such handles will be 32-bit on 32-bit systems but 64 bits on 64-bits systems. In other words they have nothing to do with your problem, but since int is just shorthand for Int32 you should use IntPtr instead, and your code would (or at least could) then work on 32-bit and 64-bit platforms. Also, if any of the parameters to these methods are handles they too should be IntPtr, but you'll likely find out simply by changing the return type of the extern methods and building, since any handles passed to one of these will come from one of these...
|
|
|
|
|
I have to develop an application that will capture the packets and display it information using winpcap..and for that i need help.how can i use winpcap in c#?? plz help me as I m already out of time
|
|
|
|
|
I have a data grid viewer populated from a SQL Server stored procedure which returns any number of columns from a minimum of 4 to a maximum of unknown columns.
I need to have the ability to print the entire grid.
This I can do.
However, to print the grid to specifications
-- I need to be able to print it on pages the size of 42x36 and 72x72.
-- I need to be able to visually scale the entire grid to one page?
Please help. what needs done for this ability?
|
|
|
|
|
Hello. I'm trying to get something like when a user inputs B, he gets back ß. I'm using
string b = "ß";
string what1 = Console.ReadLine();
if (what1 == "b")
{
Console.Write(b);
}
and it doesnt seem to work. Any Help?
modified on Friday, November 20, 2009 8:43 PM
|
|
|
|
|
What do you mean by "it does not work"? You need to be more specific in order for us to try to help you.
The fact that you're writing to the console leads me to believe you're seeing a block character instead of β. That's probably because the console font being used is incapable of rendering anything other than a limited character set.
/ravi
|
|
|
|
|
Nope, it can print the "ß" (Double S sound in German)
But what I want is, when someone Enters the character "b" it prints "ß"
But its just not printing anything when I type b.
|
|
|
|
|
Console.ReadLine() returns only after a newline character is entered.
/ravi
|
|
|
|
|
Hi,
From the MSDN documentation: "Console.ReadLine() reads the next line of characters from the standard input stream." That means it waits until you enter whatever you like, and terminate it by hitting enter.
It you want your program to react on a single key being hit, you might consider using Console.ReadKey().
Luc Pattyn [Forum Guidelines] [My Articles]
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Then how would I implement it so if b was pressed the ß comes out?
would i represent the string what with Console.ReadKey();? Or would I completely rework the code?
|
|
|
|
|
aaffbbww wrote: Then how would I implement it... ?
Start by reading the documentation on the classes/methods you are considering. Get used to help yourself, locate MSDN and/or use Google and learn how to search things. By now you have typed ten times more characters in this thread than it takes to code what you want.
aaffbbww wrote: would I completely rework the code?
Yes you may have to rework several of all 6 lines of code you have shown.
FWIW: it probably would be a good investment to spend some money and time in buying and studying an introductory book on C#.
Luc Pattyn [Forum Guidelines] [My Articles]
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
If you're confused I suggest you run in debug, with a breakpoint at the 'if'.
When it reaches that point (see below comments for some reasons why it may not) you can check and see what the value of 'what1' is. If it is not "b" then that explains why it is not working and you can figure out what to do from there.
If you're asking a more general question (like is this the best way to achieve what I'm trying to achieve) then you need to let us know what you're trying to achieve. It's unlikely (in my experience) that your entire logic is simply to replace every lower case b with a Beta character.
If, for example, you want to also replace any 'T' with a 7, E with a 3 (or whatever) then having a whole bunch of Ifs is probably not the best way to go about it.
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
This will give you a starting point. But handling key-by-key input isn't totally straightforward to do properly. Users will expect normal console functionality to work, including arrow keys, backspace, selecting some text using the mouse and then typing or hitting backspace, cutting and pasting and so on.
This uses ReadKey and intercepts the console, meaning the character is not written. However, other side effects such as changing the cursor position still apply, so if the user presses backspace for example the cursor moves but the character is not removed.
I can't be bothered to try and work out all the specifics for you, but maybe you'd be better off not intercepting and instead writing a backspace and then the double-S char after a 'b' has been input.
class Program
{
static void Main(string[] args)
{
Console.WriteLine(
"This strange program won't let you type the letter 'b', systematically replacing it with 'ß' instead, "
+ "even though German has the letter 'b' also. Type away, and type 'exit' to quit. Do it now; this "
+ "really is pretty useless.\r\n\r\n");
string s;
while ((s = prompt("Input>")).ToLower() != "exit")
{
Console.WriteLine("Fantastic, you wrote: {0}\r\n", s);
Console.WriteLine();
}
}
static string prompt(string lead, params object[] args)
{
if (args.Length > 0)
lead = string.Format(lead, args);
Console.Write(lead);
var input = new StringBuilder();
while (true)
{
var key = Console.ReadKey();
char c = key.KeyChar.ToString().ToLower()[0];
if (c == '\r')
break;
switch (c)
{
case 'b':
c = 'ß';
break;
default:
c = key.KeyChar;
break;
}
input.Append(c);
Console.Write(c);
}
Console.WriteLine();
return input.ToString();
}
}
|
|
|
|
|
Hello.
Is it possible to create a "Peer to peer" program, where you can login with username and password, and then see users who are online and transfer files to them?
Also the offers, get a box up, they need to validate, and then he get the file..
Any tutorials, or examples/start help.
Ty
-regards
Ahlmo
|
|
|
|
|
hi you should search about socket programing
at first you need to create a server program using sockets that can qeue clients for connection and after that create client programs that connect to server with ip and tcp protocol
and for start use msdn socket programing
|
|
|
|
|
Yea. Can you show me some links plz ?
|
|
|
|
|
Message Closed
modified 23-Nov-14 7:00am.
|
|
|
|
|
not it isn't, but i would like to know some good places
|
|
|
|
|
type this in google:
c# file transfer using socket
there are so many samplee and tutorials
|
|
|
|
|
Many of which are bad.
However, Google's ranking is probably no worse than the equally random replies one obtains here or on other forums. After all, how can the OP know if a link someone posts here is to a particularly good article, especially if the user just did a quick search and posted some result(s) from there without further ado?
|
|
|
|
|
i have a registry keys for mobile operators in Bahrain..
-- CURRENT_USER
------- Software
----------- MySoftware
------------------ Mobile Operator
and below that:
---------------------------- Batelco
---------------------------- Zain
---------------------------- STC
for every operator I have list of strings represents the mobile number range
for example f, for Batelco:
String : 39
Value : 39
String : 38
Value : 38
for Zain:
String : 36
Value : 36
String : 37
Value : 37
For STC:
String : 33
Value : 33
I want to read all in my C# program and validate a txtMobile textbox so that it has to start with one of the numbers there (it might be 2 left digits or 3 left digits or may be more or less)
|
|
|
|