|
yeah sure, but now i feel a little stupid ...
Using Windows and user32.dll everything works but what do i have to use for Linux.
With C++ it's easy to use global Shortcuts but I don't get it to work in .NET
If anyone has a bit of code to put me to the right way ... the one would be my hero
thanks
Armin
|
|
|
|
|
Hey guys =),
I want to create a ".xls" and ".xlsx" file in C#2008. Creating && saving is no problem, but how can I close it?
I think I've a bug in my code...
Microsoft.Office.Interop.Excel.Application excelApp = new ApplicationClass();
Microsoft.Office.Interop.Excel.Workbook newWorkbook = excelApp.Workbooks.Add(Microsoft.Office.Interop.Excel.XlWBATemplate.xlWBATWorksheet);
Microsoft.Office.Interop.Excel.Sheets excelSheets = newWorkbook.Worksheets;
string currentSheet = "Tabelle1";
Microsoft.Office.Interop.Excel.Worksheet worksheet = (Microsoft.Office.Interop.Excel.Worksheet)excelSheets.get_Item(currentSheet);
worksheet.SaveAs(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\SaveAsTest.xlsx", t, t, t, t, t, t, t, t, t);
but now the question is... "how can I close this worksheet?" a ".close" property doesn't exist...
I read, that I can close the workbook but the workbook uses a already existing file.
Is it possible to assign the new created to a workbook?
greets Mschauder
|
|
|
|
|
It looks like you need the Application.Quit()[^] method; don't you just love Microsoft?
MVP 2010 - are they mad?
|
|
|
|
|
Hey, worked fine!
Now the next problem... my computer uses office 2007, I can open the ".xlsx" && ".xls" file smoothly...
But if I use the laptop with office 2003... sure I can't open the ".xlsx", but why can't I open the ".xls"???
Is there a possibility to save the file, with the natural format for office 2003 (.xls)
greets Mschauder
|
|
|
|
|
I answer now my own question (sorry!):
just use:
t means
object t = Type.Missing;
worksheet.SaveAs("Test.xls", XlFileFormat.xlExcel8, t, t, t, t, t, t, t, t);
and saving as office2007:
worksheet.SaveAs("Test.xls", t, t, t, t, t, t, t, t, t);
|
|
|
|
|
|
hi,
try to set the DisplayStyle to ImageAndText or Text. may this would help
greetz.
|
|
|
|
|
nope, it still doesn't work
|
|
|
|
|
how we can get and set item values in a multicolumn listview?
|
|
|
|
|
I find the documentation[^] is the best starting point.
MVP 2010 - are they mad?
|
|
|
|
|
I want to change the outer border of tablelayoutpanel. NOT THE INNER CELL BORDER bt the OUTER BORDER of the panel.
Tablelayoutpanel has the option for cell borders bt not for the outer border. How to change that.????
Can anybody help me with the code....????
Thanks in advance....
|
|
|
|
|
Because a TableLayoutPanel is derived from a Panel, it has a BorderStyle - it's just that you can't see it in the properties windows (or Intellisense). You can alter it at run time, but not at design time:
tableLayoutPanel1.BorderStyle = BorderStyle.Fixed3D;
Intellisense will not find it when you get to the dot, but keep typing and it will be accepted, and will compile and run cleanly.
All those who believe in psycho kinesis, raise my hand.
My 's gonna unleash hell on your ass. tastic!
|
|
|
|
|
I wrote some code and have problem in line *. I get my modem names correctly but when I want to instantiate a Modem object I face an exception in line * which is: "This modem is invalid".
static void Main(string[] args)
{
TAPI tapi = new TAPI();
bool b = tapi.Initialize();
ArrayList list = tapi.AvailableModems();
* tapi.modem = new Modem(list[1].ToString(), tapi, new IntPtr());
Modem modem = tapi.modem;
modem.Call("6632");
}
list[1] is correct because I checked it and also I should say that my modem is connected to an internal dormitory phone line which I can dial other rooms, so my number in Call() function is just 4 digit long. I wanted to know that is that possible that because my modem is connected to an internal phone line I faced that exception? Excuse me for any mistakes because of my poor English.
modified on Tuesday, February 2, 2010 2:02 AM
|
|
|
|
|
I have this simple code running on my windows server just fine, but when I run it in mono after a couple days I start getting only OutOfMemory exceptions.
public static byte [] TryReceive (Socket sock, out int nLength)
{
nLength = 0;
try {
int size = sizeof(int);
byte [] data;
int recv = 0;
int offset = 0;
data = new byte [size];
while (size > 0) {
recv = sock.Receive(data, offset, size, SocketFlags.None);
if (recv == 0)
return null;
offset += recv;
size -= recv;
}
size = BitConverter.ToInt32(data, 0);
offset = 0;
data = new byte [size];
while (size > 0) {
recv = sock.Receive(data, offset, size, SocketFlags.None);
offset += recv;
size -= recv;
}
nLength = data.Length;
byte [] dataGraph = new byte [data.Length - 1];
Array.Copy(data, 1, dataGraph, 0, dataGraph.Length);
if (BitConverter.ToBoolean(data, 0))
dataGraph = DecompressBytes(dataGraph);
return dataGraph;
}
catch (OutOfMemoryException) { ObeServer.log.Log(1, "OutOfMemory when receiving packet."); return null; }
}
Could someone please see something that might be causing this?
TIA
|
|
|
|
|
In fact this may be an issue with the TCP window size, let me explain that.
Certainly the size that you try to decode is wrong, due to a framing issue.
If it's a TCP, you need to have some sync stuff, you cannot consider with TCP even if it's a connected protocol that the byte you will receive is always here. That's why you need a sync byte (eg. 0x80 for RTP protocol or HTTP string for HTTP....) prior the size.
The windows socket size is different from OSes (eg. Linux and Windows) and the TCP NO WAIT depends on the stack configuration.
So, I advise you to check if the : size = BitConverter.ToInt32(data, 0); is correct and not a very high value which may cause the memory leak.
My two cents
|
|
|
|
|
A typo in my previous mail is that RTP is a UDP protocol not a TCP
|
|
|
|
|
So what you're saying is that even though I make sure to read 4 bytes off the socket they may not be the correct four bytes so when I cast them it converts into a monstrous integer? The server manages flash clients and everytime someone does a postback or otherwise the flash reloads and then reconnects. I wonder if it has todo with old data sitting on the socket from the previous connection. But I do create a new socket everytime they connect, but maybe it has todo with mono's socket pool code. The Sync Byte, how would I go about about implementing something like that and what is it fixing exactly? Is it implemented something like this?
Socket.Send(0x80+Size+Data);
while(true)
{
if(Socket.Receive(0,1)==0x80)
{
size = BitConverter.ToInt32(Socket.Receive(0, sizeof(int)));
break;
}
}
I'm sorry for all the thinking out loud and questions, this error has caused me tons of headache.
Am I thinking in the right direction with that?
|
|
|
|
|
You got it.
The problem with TCP is you may have a text protocol (HTTP, ...) or binary (RDP - remote desktop...)
If your protocol is too weak you can resync, so you may have or not a control.
Send -->
<-- Ack Or Error
If you want to be sure that the message has been delivery, for instance the ftp protocol does this.
case "REST":
...
break;
default: //We Don't understand the Command
SendMsg("500 Command not understood\r\n",ref outBuffer);
break;
My advise, is read you socket buffer normaly, check at the beginning that you have a signature 0x80 (for instance), if not consume the buffer, and wait for another packet, or another option, search for the sync byte.
On heavy traffic, the tcp stack may overloaded, in this case you may have in your buffer.
First Read
0x80 xx xx xx xx 0x80
Second Read
xx xx xx xx 0x80 xx
Third Read
xx xx xx 0x80 xx xx
....
You can mark the start and the stop of your packet, start with a 0x80 and then get the size (which gives the size), you can break and split you data, and consume. Place your uncomplete packet in a waiting queue, and wait for the following one. When received, add it to the end, check that the size matches the new packet, if not drop it and resync.
A bit complex at the beginning, but I can insure that it works fine in all cases. Trust me I work in the telcom area, I know what is TCP over load... thanks to the Apple phone
|
|
|
|
|
Hi
I've C# Windows which has some message box to prompt some info. I'm trying to invoke this from DOS (batch file) at that time i just want to skip all the prompt message boxes. Is there anyways to do it from DOS?
Thanks
|
|
|
|
|
Would you mind providing more clarification?
Are you trying to invoke an existing application (.exe) from a DOS batch file. Or are you invoking a method within the program.
|
|
|
|
|
Im trying to access existing application from DOS. Exactly saying am trying to create virtual directory using the following commands
cd C:\WINDOWS\system32
IISVDir.vbs
IIsVDir /create "Default Web Site" App C:\Inetpub\wwwroot\App
IIsVDir /create "Default Web Site" AppService C:\Inetpub\wwwroot\AppService
IIsVDir /create "Default Web Site" ServiceRequest C:\Inetpub\wwwroot\ServiceRequest
But for every line it asks confirmation so Im just trying to automate it with some predefined parameters.
Thanks ....
|
|
|
|
|
If I understand correctly you're trying to close 'popups' that appear from another application, right?
In that case you'll need to import some windows dll's (winapi) (I think you'll need the user32.dll, but I'm not sure) that expose the Windows functions like FindWindows, GetDlgText, etc... With those functions you'll need to:
1: Find the correct window (probably need a loop that will redo this every x seconds)
2: if window is open (= encountered in step 1), press the button (Yes, No, OK, Cancel) I don't know the exact function for this, but it exists. avoid closing or killing the msgbox, instead try to let the msgbox handle itself by using one of the closing buttons.
You'll have to find the correct functions and signatures on MSDN, but there is a lot of info out there about this topic.
|
|
|
|
|
Hi,
I am having custome Link List object.
Which manages nodes and searching using while loop (node.next()).
I am new to Linq
Is Linq can be used with my Link List object to avoid loops?
Thanks Regards
Khaniya Sunil
|
|
|
|
|
If I understand your question correct - yes, you can use Linq to search a List<t> (using Linq to Objects). For an example, have a look at this.
Good luck
|
|
|
|
|
hi Calla
Thanks for your response
Actually I am talking about custom Liked List(data structure).
where nodes are connected via reference to each other
We are having reference of only first node.
Thanks
|
|
|
|
|