|
have you tried looking into double buffering? or maybe vsynch? i havent done any work with directx, but those two things are prolly what you'll need..
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
I have a database connection in one assembly, and I have a Crystal report in another Windows forms Application.
I want my Crystal report to access Database through the connection in first assembly.
Is this possible? Idea is to keep a single database connection.
Please Help !!!!!
Gaurika Wijeratne. // www.gaurika.com
|
|
|
|
|
Still not up on assemblies and the other nicities of C# yet. If you can put up with C++ jargon though, it should work like this:
Instantiate the assembly. Pass the connection instance to the form app using the C# ref keyword, and store it with a member variable. It is my understanding, though I haven't tested it yet, that the member variable will persist as a reference (pointer?) to the original connection.
>>>-----> MikeO
|
|
|
|
|
hi,
i wuold like to draw charts in my application and after copy and paste charts under Excel or Word ...
is OLE a good way to search method to do my job ?
thx
|
|
|
|
|
Hi there,
I’m using a Win32 API dll, Winscard.dll, for which there is no current equivalent in the .NET Framework.
Several of the functions require the use of ByRef arrays, e.g. pointers, when calling the api function. From following the examples in MSDN, I am able to set up the pointers needed for the array, but am having difficulty setting the correct size of the pointer using AllocCoTaskMem.
The function I’m trying to call in Winscard.dll is SCardStatus. From the documentation, this is declared as:
LONG SCardStatus(
SCARDHANDLE hCard,
LPTSTR szReaderName,
LPDWORD pcchReaderLen,
LPDWORD pdwState,
LPDWORD pdwProtocol,
LPBYTE pbAtr,
LPDWORD pcbAtrLen
);
My function declaration in C# is thus:
[DllImport("winscard.dll")]
static unsafe extern int SCardStatus (IntPtr hContext, out StringBuilder szReaderName , ref IntPtr pcchReaderLen, out IntPtr pdwState, out IntPtr pdwProtocol, ref IntPtr pbAtr, ref int pcbAtrLen);
This uses an IntPtr “pbAtr” to receive the array.
I declare an array (emptyATRArray) to act as the original array:
private byte[] emptyATRArray = new byte[32];
And create another variable, “size”, based upon the size of this
int size = emptyATRArray.Length;
Using the template in MSDN as an example, I then create a pointer called “buffer” to pass to the function:
IntPtr buffer = Marshal.AllocCoTaskMem(Marshal.SizeOf(size) * emptyATRArray.Length);
I then call the function:
lngResult = cSmartCard.SCardStatus(lngCard, out strGetReader,ref intReaderNameLen,out intReaderState, out intReaderProtocol, ref buffer, ref retATRLen);
I am happy that the function has worked correctly, as the value of the pcbAtrLen variable, (retATRLen) has correctly changed from 0 (in this case to 13, the expected number of bytes for the particular smartcard), as well as the other ByRef integers.
To extract the values of the updated array, I create a new byte array called returnedATRArray of the size retuned to retATRLen (13), and copy all the values from the buffer to the this new array:
Marshal.Copy(buffer, returnedATRArray,0,retATRLen);
And free the memory:
Marshal.FreeCoTaskMem(buffer);
This then gives me a correctly sized array, which I can cycle through to extract the values:
strATR= new StringBuilder();
foreach (byte atrByte in returnedATRArray) {
strATR.Append (Convert.ToString(atrByte,16) + ' ');
}
Console.Write("ATR: " + strATR.ToString());
However, from cross-checking with another program, I know that the values returned to returnedATRArray are not correct. By fiddling with the parameters to AllocCoTaskMem, I can get different values out of the final array, so I assume that the amount of memory allocated here is crucial.
I’ve been unable to find a clear guide as to how to define the size of the block of memory for such operations. Could anyone help
Cheers
Toby
|
|
|
|
|
I need to do serial comms in C#; that is, I need to be able to open COMn and read/write it.
I would also like to be able to set the comm parameters (SetCommDCB and SetCommTimeouts) but this is not essential.
How can I do this?
(I'm fully familiar with doing the same kind of stuff in C++).
tia
Phil
The opinions expressed in this communication do not necessarily represent those of the author (especially if you find them impolite, discourteous or inflammatory).
|
|
|
|
|
|
Thanks!
That's enough to get me started ... I'm off and coding.
Phil
The opinions expressed in this communication do not necessarily represent those of the author (especially if you find them impolite, discourteous or inflammatory).
|
|
|
|
|
I have the following config file:
<configuration>
<system.diagnostics>
<trace autoflush="false" indentsize="4">
<listeners>
<add name="myListener" type="System.Diagnostics.TextWriterTraceListener,System" initializeData="c:\myListener.log" />
<remove type="System.Diagnostics.DefaultTraceListener,System"/>
</listeners>
</trace>
</system.diagnostics>
</configuration>
Running this and using the Trace class brings up the following exception:
An unhandled exception of type 'System.Configuration.ConfigurationException' occurred in system.dll
Additional information: Couldn't find type for class System.Diagnostics.TextWriterTraceListener,System.
I certainly have a reference to the System assembly.
|
|
|
|
|
Two things:
First, the sample in MSDN doesn't put ,System at the end of the TextWriterTraceListener definition. Oddly the text on obtaining the full name of assemblies does include that as well as the version, culture, and public key token so try both ways.
Second, you need to specify the fully qualified name for the item you are removing. You only specified the class name and assembly, you also need to specify version, culture, and public key token.
For example:
"System.Diagnostics.TextWriterTraceListener, System, version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
If you are targetting .NET v1.1 change the version part to 1.0.5000.0
James
"I despise the city and much prefer being where a traffic jam means a line-up at McDonald's"
Me when telling a friend why I wouldn't want to live with him
|
|
|
|
|
Tx James I'll try that. But...
James T. Johnson wrote:
First, the sample in MSDN doesn't put ,System
In the version I have it does. But the same example at the MSDN library online is different. I'll look into that.
|
|
|
|
|
hi!
i get problem when set 'DisplayMember' and 'ValueMember' for combo box (get data from oracle database, using OleDb).
comboBox.DataSource=DataSet.Tables[0];
comboBox.DisplayMember="DisplayMember";
comboBox.ValueMember="ValueMember";
the same code is OK when I connect to access or sql, but get bug when connect to oracle database.
help me
thanks.
|
|
|
|
|
|
.NET Framework must be 1.1, I could connect to oracle with OleDb for other action like execute sql command, get data reader,...
but got above problem with combo box.
|
|
|
|
|
Can you describe the problem you are seeing?
I don't see anything wrong with the code you wrote above so long as you have a variable named DataSet with at least one DataTable added.
James
"I despise the city and much prefer being where a traffic jam means a line-up at McDonald's"
Me when telling a friend why I wouldn't want to live with him
|
|
|
|
|
hi, thanks for your reply.
it's now ok, and I really don't know what the reason is.
thanks again.
|
|
|
|
|
Can anybody help me. I really do not understand one thing!
This is an example from MSDN:
//***********************
private void SetFont(string reportObjectName)
{
TextObject text;
FontDialog fieldFont = new FontDialog();
// Get the ReportObject by name and cast it as a TextObject.
text = Report.ReportDefinition.ReportObjects[reportObjectName]
as TextObject;
if (text!= null)
{
// Show the Font dialog.
if (fieldFont.ShowDialog ()==DialogResult.OK)
{
// Apply the settings from the Font dialog.
text.ApplyFont(fieldFont.Font);
// Set the text object's color to blue.
text.Color = Color.Blue;
}
}
}
//***********************
but in reality the function ApplyFont works not properly, it can change anythign but Font.Size.
The main thing of font is its Size and I cannot change it in my reports. What's going on? Is it an error or it works as designed?
Thank you!!!
|
|
|
|
|
How to know that ALT pressed if control doesn't have an imput focus?
Valeria
|
|
|
|
|
Hi Valeria,
In ASP.NET (Web Development)
you can use this codesnippet to detect ALT key bieng pressed:
document.onkeydown = function ()
{
alert (event.altKey + " " +event.keyCode);
}
Deepak Kumar Vasudevan
http://deepak.portland.co.uk/
|
|
|
|
|
|
|
Is it possible to take a .net binary compiled under Windows and take the binary, and run it under Mono(under any *nix platform) without recompilation. I understand that Mono has WineLib related bindings and patches for porting applications written in windows to *nix, but I'm not sure if it would need a recompilation.
thanks
Kannan
|
|
|
|
|
Kannan Kalyanaraman wrote:
Is it possible to take a .net binary compiled under Windows and take the binary, and run it under Mono(under any *nix platform) without recompilation. I understand that Mono has WineLib related bindings and patches for porting applications written in windows to *nix, but I'm not sure if it would need a recompilation.
In theory you could do it, I never tried it, though.
I intend to do it as soon as our project hit the next deadline, so I'll have some time to play with new technologies.
Kant wrote:
Actually she replied back to me "You shouldn't fix the bug. You should kill it"
|
|
|
|
|
Good question. I know that hey use NUnit as the Unit testing tool on Mono, and it seems to work fine with Mono assemplies and Windows assemblies.
"Je pense, donc je mange." - Rene Descartes 1689 - Just before his mother put his tea on the table.
Shameless Plug - Distributed Database Transactions in .NET using COM+
|
|
|
|
|
I would GUESS that it works for libs but not for .exe
i.e. libs are a defined .net format, whilst .exe are windows - they have win32 code to load up .net and complile the .net machine code.
but only a guess..
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|