|
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!
|
|
|
|
|
Erm, it strikes me that you're doing this bass-ackwards. You should have a thread that is continually reading from the USB port and a shared buffer between the thread and the application main thread. That way, the thread is always active and puts data into the buffer when it's present, and the main thread can query the buffer, wait for data, timeout (under your control), etc.
I could be missing something though.
Marc
MyXaml
Advanced Unit Testing
YAPO
|
|
|
|
|
Hi,
Does anybody know of any good resources for learning the intricacies if IDesignerHost?
I about halfway to where I want to be, but I can't implement my main feature: pre-specified individual controls.
E.g. Our configurable dialog has two possible button controls, OK and Cancel. I want to show the user a list of possible controls that will contain an entry for each of these buttons. The ToolboxItem class only handles control types, so I can only specify 'add a button', and not 'add the OK button'. I have tried deriving my own ToolboxItem based classes, but then the built-in drag drop between the toolbox service and the designer host stops working.
It's starting to drive me nuts. Configuration is a major feature of our product, so I have to find a way to do this.
Any resources or guidance would be very much appreciated.
Dr Herbie
Remember, half the people out there have below average IQs.
|
|
|
|
|
Solution - in case anyone was interested ...
Classes derived from ToolboxItem must be serializable and the IToolboxService DeserializeToolboxItem method must deserialise the correct (derived) type.
So now I can manipulate my controls as they are created.
Dr Herbie
Remember, half the people out there have below average IQs.
|
|
|
|
|
Dr Herbie wrote:
Solution - in case anyone was interested ...
Cool! And thanks for posting the solution! I've been wondering about what the answer might be, but certainly didn't have enough knowledge to contribute anything.
Marc
MyXaml
Advanced Unit Testing
YAPO
|
|
|
|
|
Does System.AppDomain.AppendPrivatePath work with non-relative paths? I don't think it does, but want to make sure I'm not missing something.
I ask because I am writing an MMC snapin in C#.
System.AppDomain.CurrentDomain.BaseDirectory is C:\Windows\system32, the location of mmc.exe, the host program.
My snapin assembly and supporting assemblies are located on a different local hard drive therefore I can't construct a relative path to them.
The assembly that implements the snapin dynamically loads other assemblies that in turn contain references to other assemblies, all in the same directory. The problem is that whilst I can load an assembly using a full path when I call Assembly.GetTypes on it the .NET Framework uses the AppDomain path to find the referenced assemblies, not the assembly directory.
Ideally I would like to do System.AppDomain.CurrentDomain.AppendPrivatePath("P:\Directory\bin") , but that doesn't appear to work.
Installing them in the GAC is not an option I can take.
To get around this I am currently handling the AssemblyResolve event fired by the AppDomain and then loading and returning each assembly manually. AppDomains are a new thing for me though (as of yesterday) so am I doing this the right way? Thanks guys.
Die Freiheit spielt auf allen Geigen
|
|
|
|
|
|
Well if you're doing it I think I'm pretty safe doing it too.
I'm getting there... slowly. This is still so much easier than doing it all with ATL like I did last time.
Die Freiheit spielt auf allen Geigen
|
|
|
|
|