|
|
KaptinKrunch wrote:
don't want to pass the table between forms as this would create copies of the original and end up using more memory.
Except for value types, everything in .NET is an object (and even value types can be boxed to be objects). All objects are already passed as references. That's why you don't need pointers, or * to dereference a pointer, and that's why you don't need new and delete--the GC keeps track of the references to an object.
Marc
MyXaml
Advanced Unit Testing
YAPO
|
|
|
|
|
Hi ,
How to get Registry key value from 'search target machine'? How you access it in launch condition?
I have to read registry key, get location of old installed software, Add my files to that location and update some configuration files.
Thanks.
|
|
|
|
|
Just in your setup project set the Search for installed versions to true .
|
|
|
|
|
Hi,
I would like to know if there is any way to perform a deserialization from a binary file that has not been serialized first.
Actually, I've got a binary file produced by a VC++ app using some structure dumping. I have all the code and the structure of the file and I now need to get it in a C# .NET app.
I naively wanted to recreate the structure dumped in the file as struct/classes in c# and read the data into them.
Thanks in advance for the help
|
|
|
|
|
You can always create your own C# class that has the same structure as the C++ class. You can then use a Stream to read data from the binary file byte by byte and fill in your class variables.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Thanks for your reply
Actually that's exactly what I wanted to avoid, the byte to byte reading of my file.
There should be an more elegant and maintenable way to read structured data from my file.
|
|
|
|
|
where can i find out the .Net file format?
as in where's the IL asm code, etc.
|
|
|
|
|
If you have Visual Studio .NET 2003, see under Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Tool Developers Guide.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
I need a "toolbar"-like control (for my "Windows.Form"-based Document Viewer application) with functionality similar to modern ("Microsoft Office", etc.) products:
I want to have an ability to represent it floating over, or docked to the top of the main window; to have entry fields on it (like "Page: # of #" for quick navigation), etc.
Apparently, straight use of "System.Windows.Forms.ToolBar" class (provided by framework) doesn't give such a rich functionality.
I'm quite a novice in .Net GUI development and I did not find anything about it in MSDN (maybe I just made wrong search
I'm sure it's a very common task nowdays, so there should be some well-known solutions (or approaches) for this problem!
Could somebody post an example, reference, or link to discussion about those matters.
Regards,
Andrey
|
|
|
|
|
|
|
This will be available with Whidbey, but there are also a couple examples here at CP for v1.1.
|
|
|
|
|
I'm currently writing an application that uses LogonUser function from advapi32.dll (Detailed here). The only problem is that I also have a pass a logon provider constant to the API. The technique I was using was to call the procedure four times - once for each of the 4 types of logon providers (NT3.51, NT4, NT5, and Default). While this works great if the username and password are correct, if they're not, it equals 4 failed logon attempts, which locks the user account. I would just use LOGON_DEFAULT, but I was unable to get a positive authentication from a W2K client on an NT4 domain.
Do here's my question: Is there some way that I can determine the logon provider from another API call or somewhere in the .NET framework? That way, I would only have to call the API once, using the correct provider constant, to be able to determine if the username/password/domain combination I've collected is valid. Again, DEFAULT appears not to work in certain situations (like an NT5 or higher client against an NT4 domain) - maybe there's something else about DEFAULT that I'm missing. Any ideas?
|
|
|
|
|
Greetings all.
I'm trying to meassure the contents of a string in a webapplication, and have problem with the GetTextExtentPoint32 function and how it works. (I'm using VB.NET cause that is what we have to program in at work, so eventhough this is more for my own benefit and interest, I'll still use VB)
I've never used this API before, so please have some compasion for my newbie questions
Most of this information has been put together using msdn and a few webpages (I lack some decent code exampels in VB which I can read from)
So far what I've done is declaring a number of functions, amongst others:
Declare Function GetDesktopWindow Lib "user32" () As Long
Declare Function GetWindowDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetTextExtentPoint32 Lib "gdi32" Alias "GetTextExtentPoint32A" _
(ByVal hDC As Long, ByVal lpsz As String, ByVal cbString As Long, ByRef lpSize As SIZE) As Long
I've created a stucture:
Private Structure SIZE
Dim cx As Long
Dim cy As Long
End Structure
Then in my function I do this:
Dim sz As Size
Dim strTestString As String = ""ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz""
Dim hDc as long = GetWindowDC(GetDesktopWindow)
Dim hFont = GetStockObject(ANSI_VAR_FONT)
dim hFontOld = SelectObject(hDc, hFont&)
As far as I understand hDc is the handler to the "screen-area" used for drawing.
I'm by far not sure what hFont of hFontOld does (ANSI_VAR_FONT = 12), but font-buisness is a good guess I hope
(Taken from websites, not my own)
I then call:
GetTextExtentPoint32(hDc, strTestString , 52, sz)
52 I guess is the number of characters in the string. (String and 52 is taken from websites, and not my own)
And then I get a NullReference exception when running the code (and here I'm stuck).....
Does anybody have any information which can guide me further, or have some good code exampels I can use/read?
I'd really like to this work, seeing as if it does I could perhaps implement it at work, but also because it is starting to nag at me, and I hate having to leave it unfinished.
Please help if possible
With regards and hopefullness
"Alsvha"
---------------------------
127.0.0.1 - Sweet 127.0.0.1
|
|
|
|
|
GetTextExtents tells you the physical dimensions a string will require when graphically rendered on the specified DC using the specified font. .NET offers a similar method in Graphics.MeasureString().
The most obvious question is "What are you trying to do? Under what environments?" I'm not sure what value this API offers in a web application.
|
|
|
|
|
What I'm trying to do is find information as to how "wide" a string would be if I were to write it to the screen. This would allow me to size menus, checkbox and all sorts of other onscreen containers et al, before actually having to write the string(s) to the screen and then meassure them up by hand.
So what GetTextExtents tells me - is excatly the information I'd like to get ..... but I can't just get it to work, because of the NullReference (maybe because of the wrong DC)
I tried dabbeling with Graphics.MeasureString, but fell short when I appaently needed to get the PaintEventArgs to run it from.
Graphics.MeasureString wouldn't compile, but PaintEventArgs.Graphics.MeasureString would - so I discontinued this path, because I'm not sure I could get such an event for what I want to do.
---------------------------
127.0.0.1 - Sweet 127.0.0.1
|
|
|
|
|
You'll never get it to work in a web application. Since the browser can display data in any text size, independent of what you tell it, you can't get the length of the string as displayed in the browser.
On top of that, that function will only work in a Windows Forms application. No Window means no window handle, and no hDC.
The only way your going to accomplish this is with JavaScript on the client side built into the web page. No, I don't know how to do it. I just know how it's not going to work.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
I have this 2 problems:
1)I have c# application and sometines (randomly, even when I don't chage anything in my code) this application crashed down even before it has finished loading all system dlls.
2)When I work with c in .net visual studio in debug mode and I enable win32 exceptions catching just in time it was thrown I have an exception when I close my application. But when I enable only one win32 exception catching (just in time it was thrown ) or all of them but seperatly I don't have any exception.In release mode I don't have any exceptionws.
Does anyone saw this problems??? Is there any fix for them???
Thank you in advacne,
Anna.
|
|
|
|
|
anurik wrote:
this application crashed down even before it has finished loading all system dlls.
This happens to me on occasion. Sometimes it can be really annoying, like happening at least 1/2 the time. I've never found a cure for it.
As to the second question, I can't help you there (not that my answer to the first question was of any help either! )
Marc
MyXaml
Advanced Unit Testing
YAPO
|
|
|
|
|
Hi,
I want to change desktop theme and start menu style programmatically without log off or restart.
Is there any API for this?
For start menu style:
I am able to set the registry value:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ShellState
After setting this value I can see the radio button changed in Start menu properties but the "OK" or apply effect does not take place.
I tried using "SendMessage" likewise APIs. But didn't work.
Can anybody help me??
|
|
|
|
|
I'm using a .Net UserControl derived control in a html page.
This is similar to an applet, but written in C#.
The page works Ok, but I can't get it reload a new version.
This is, I've found no way to update the control with a new version.
IE seems to cache the control and does not download the new version, even if I select "Delete Files...".
|
|
|
|
|
Anonymous wrote:
IE seems to cache the control and does not download the new version, even if I select "Delete Files...".
Have you tried a browser refresh?
Marc
MyXaml
Advanced Unit Testing
YAPO
|
|
|
|
|
Yes, I've already tried that.
The only way to get the control reloaded is to close the browser, but I can't rely on clients doing this.
|
|
|
|
|
Hi, here's my problem. I'm interfacing with a device that can send me data at any time. To read this data, I use the BeginInvoke method of my delegate, but after about 3 seconds, the method "expires" and the callback is done invariably, even though the USB device didn't send anything. Therefore, I have to re-enable the function (async read) as soon as I can so I don't miss any message from my USB device.
I thought there must be a way to disable this kind of timeout function... does anyone know?
Here's some C# code:
My delegate:
public delegate void ReadInputReportDelegate(int readHandle, int hidHandle, ref bool myDeviceDetected, ref byte[] readBuffer, ref bool success);
The lines with which I call the asynchronous read
Hid.InputReport myInputReport = new Hid.InputReport();<br />
<br />
ReadInputReportDelegate myReadInputReportDelegate = new ReadInputReportDelegate(myInputReport.Read);<br />
<br />
ar = myReadInputReportDelegate.BeginInvoke(readHandle, hidHandle, ref myDeviceDetected, ref inputReportBuffer, ref success, new AsyncCallback(GetInputReportData), myReadInputReportDelegate);
Thanks a lot for your help!
|
|
|
|