|
Thanks a lot! I was starting to think about adding the mem allocation calls - there are murmurings about them in one or two places, but I wasn't able to find anything concrete until your posting.
Is it just me, or does CE's usage of the API seem a little like alchemy? There seems to be very very little in the way of example on line. Perhaps there are some useful books out there...
I don't come from a C(++) background, so I'm at a little bit of a disadvantage from the outset with structure conversion / API implementation, but in this case I think I had it right, and other "quirkiness" caused problems (my desktop example worked great).
One note: The import for the common dialog library should read "commdlg.dll" - two "m"s.
Thank you again.
Jared
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
I wanted to block certain Key Combinations pressed by the user from being executed by the System when my application is active.
For example in WIN 98 when any application is running, if the user presses Ctrl+Alt+Del, the Taskmanager will popup. I want to block such events from being happening when my application is active.
Such blocking is to be implemented for certain combinations of Key presses.
Exaplination with some code examples is highly appreciated since i need to implement this pretty urgently.
CHEERS
|
|
|
|
|
|
I am having some difficulty with COM Interop at the moment, and am hoping someone can help...
What happens if you have a COM Client (i.e. COM is calling an .NET assembly using a CCW) and the .NET component (with the CCW) has references to another .NET Component. Does the 'dependancy' assembly require the CCW or an RCW? or can these 2 assemblies communicate in their native tongue (i.e. .NET).
Here is a problem I am trying to solve at the moment: I have Assembly1 which has a CCW (it is a "Custom Command" that can be called by a COM application). The second Assembly (Assembly2) contains generic methods that can be called by all kinds of different "Custom Commands". This way I get decent code re-use (all the common methods are stored in Assembly2).
I will try to 'diagram' it here:
COM (Client) -> CCW -> .NET Assembly1 -> .NET Assembly2
So if .NET Assembly1 has a reference to .NET Assembly2 can they "talk to each other" using .NET, or do they need a proxy (i.e. RCW or CCW) to communicate also?
What I am asking is... is the following config required?
COM (Client) -> CCW -> .NET Assembly1 -> RCW -> .NET Assembly2
Also, what happens if Assembly2 has other dependancies (for example Oracle.DataAccess.Net) Do these also need a wrapper?
I currently have a situation where another developer is trying to use my common code (i.e. he's trying to make his own Assembly1 which references the common methods I've made in Assembly2) but he can't seem to instantiate a class in Assembly2 because he's getting a System.IO.FileLoadException when Assembly2 is referring to the Oracle.DataAccess.dll. I've checked the HRESULT in WinError.h and it is "NTE_PROVIDER_DLL_FAIL" (i.e. "DLL Failed to initialize correctly").
Not sure if this is a COM Interop problem, or related to the fact he has 2 Oracle homes (he has Oracle 7 - installed first) and Oracle 9. I'm thinking it could also be a CAS (Code Access Security) problem? (i.e. Assembly1 has CCW so it can't call/reference/instantiate a .NET assembly which refers to another .NET assembly - Oracle.DataAccess.dll)... If he runs the Assembly2 code on his machine which calls a stub.exe (written in .NET) he can use the Oracle.DataAccess.dll no problem - but when it's in .Dll form, he gets the System.IO.FileLoadException error (above).
Any suggestions or clarification would be greatly appreciated.
|
|
|
|
|
No, the dependent assembly does not need to expose a CCW. The CCW is a way of exposing a .NET component to COM clients, but the component is still a .NET component and thus uses other .NET assemblies like any other .NET application.
These assemblies must be resolvable, however. It seems that your assembly isn't being found. When you register your assembly exposing the CCW, do so with regasm /codebase MyAssembly.dll . This registers the full path to the assembly. Better yet, install all your assemblies in the Global Assembly Cache (GAC), then just register it with regasm MyAssembly.dll .
The deal with assembly resolution is that the application directory is checked first, and then if a probing section is configured in the application's .config file, those sub-directories referenced in that section are checked as well. Since your COM client may run from anywhere and use your CCW without knowledge of where the file is (the COM system deals with this information), you don't really know where to put the second, dependent assembly. This is why you put it into the GAC. After the CLR fails to find the assembly in the application directory or probing paths (and no explicit locations are mentioned in the assemblyBinding section of the .config file), it looks in the GAC. The PATH environment variable is never used, unlike native executables.
For more information about how assemblies are resolved, read How the Runtime Locates Assemblies[^] in the .NET Framework SDK.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Heath,
Thank you for your very prompt response. I believe that it is resolving the assembly. Assembly1 (the command) is definitely being resolved. This is installed using regasm. When we step through code on his machine we can see that it is going into Assembly2. (As soon as we remove the call to a method in Oracle.DataAccess.dll the code in Assembly2 works fine). In addition, the third assembly (a ref to Oracle.DataAccess.dll - which is made in Assembly2) is an ODP.NET .dll. This is definitely registered in the GAC, and the entry in the GAC is correct. Assembly2 is not registered in the GAC, and is not using regasm /codebase.
If I look at the 'overview' for the specific error that is being thrown(i.e. System.IO.FileLoadException) it states the following:
"The exception that is thrown when a managed assembly is found but cannot be loaded."
This is what is being thrown in Assembly2 when it's referring to Oracle.DataAccess.dll. This seems to make sense to me (i.e. it's finding it) because this (Oracle.DataAccess.dll) assembly is registered in the GAC. I've read many complaints about Oracle 9 (ODP.NET) installs which refer to a problem with OraOps9.dll. Oracle.DataAccess.dll is dependant upon OraOps9.dll. A lot of people suggest to try unchecking/re-checking the "Read and Execute" permission on the Oracle Home folder for Authenticated Users. We've tried this and it doesn't seem to work.
Do you think this is perhaps due to a problem with having 2 Oracle homes? (i.e. Oracle 7 and Oracle 9)??
|
|
|
|
|
Heath,
I am reposting so I get notification (my session expired while writing the last message, so it was posted as Anonymous).
Thank you for your very prompt response. I believe that it is resolving the assembly. Assembly1 (the command) is definitely being resolved. This is installed using regasm. When we step through code on his machine we can see that it is going into Assembly2. (As soon as we remove the call to a method in Oracle.DataAccess.dll the code in Assembly2 works fine). In addition, the third assembly (a ref to Oracle.DataAccess.dll - which is made in Assembly2) is an ODP.NET .dll. This is definitely registered in the GAC, and the entry in the GAC is correct. Assembly2 is not registered in the GAC, and is not using regasm /codebase.
If I look at the 'overview' for the specific error that is being thrown(i.e. System.IO.FileLoadException) it states the following:
"The exception that is thrown when a managed assembly is found but cannot be loaded."
This is what is being thrown in Assembly2 when it's referring to Oracle.DataAccess.dll. This seems to make sense to me (i.e. it's finding it) because this (Oracle.DataAccess.dll) assembly is registered in the GAC. I've read many complaints about Oracle 9 (ODP.NET) installs which refer to a problem with OraOps9.dll. Oracle.DataAccess.dll is dependant upon OraOps9.dll. A lot of people suggest to try unchecking/re-checking the "Read and Execute" permission on the Oracle Home folder for Authenticated Users. We've tried this and it doesn't seem to work.
Do you think this is perhaps due to a problem with having 2 Oracle homes? (i.e. Oracle 7 and Oracle 9)??
|
|
|
|
|
Yes, I remember seeing that problem referenced in this forum as well. Click on "Search comments" above and see if you can find it, otherwise I know the answer was based on a link found by googling.
Still, though, you don't need to register assemblies using regasm.exe if they don't expose any CCWs, like this "Assembly2" you mentioned, but it still needs to be resolved from whatever references it, like "Assembly1". Putting it in the same directory as the CCW wouldn't work, since that's (most likely) not the application directory. Using the GAC is about the only way to go.
To note, even native applications can have myapp.exe.config files, though they probably won't use them. I've done this in my Java/.NET interop at the presentation layer article using java.exe.config in the same directory as java.exe (runtime loader). This would allow you using a assemblyBinding section to specify the location of a certain assembly.
The biggest problem with that approach is that you must know your COM clients up-front, which is practically impossible. One of the fundamental solutions that COM presents in location-independence. With this in mind, the GAC for .NET assemblies is the solution.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Greetings All,
I am using a DataGrid bound to two tables with a master-detail relationship. As expected, I may click on the expander, click on the link, then view the detail for a particular master record. My problem: some master records may have detail and some may not ... for the master records without detail, I would like for the link *not* to show. The default behavior shows the link and after the click presents null detail data. Any ideas?
Thanks,
Bitwise
|
|
|
|
|
This functionality is pretty deeply encapsulated in the DataGrid control's private members, so you really can't change it.
You could, however, use two DataGrid s that use the same data source, but the second (detail) DataGrid uses the DataRelation between two DataTable s instead of the DataSet or DataTable itself. When you click on a row in the master DataGrid , the detail DataGrid shows the related records, if any.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi!.
I have problems when I use two DataReader associated with a Connection.
I can't have more than one DataReader for each connection without closing one of them?.
The code throws the follow error:
<br />
An unhandled exception of type 'System.InvalidOperationException' occurred in system.data.dll<br />
<br />
Additional information: There is already an open DataReader associated with this Connection which must be closed first.<br />
I need the thow DataReaders open because for each read of DataReader1 I do operation with DataReader2 in another table.
I need two or more DateReader working together. How can I fix that?.
Thank you.
Demian.
|
|
|
|
|
You must use a seperate connection for each reader.
Charlie
if(!curlies){ return; }
|
|
|
|
|
Alternately, you could forego the DataReader s entirely and use DataAdapter s to read all the data into DataTable s up-front and then you can operate on the (now disconnected) data without worrying about the database connections at all.
...just a thought...
Bill
|
|
|
|
|
In Crystal Report,How to set line's Properties such as : Width,Supress and Left ?
I had tried like this:
"ReportDoc.ReportDefinition.ReportObjects[ ObjectName ].Width
= 1100"
but i can't works while the object is a line.
thanks
Xpelive
|
|
|
|
|
I'm puzzled in the using of Request.cookies and Response.cookies. Could you help me an easy way to understand when i need use Request.cookies and when i need use Response.cookies.... thank you very much... Any answer would be appreciate...
|
|
|
|
|
Simple explanation: Request object is used to retrieve data from client, while Response object is used to send/write data to the client. In cookies example, use Request.cookies to read the cookie collection and use Response.cookies to create/add new cookie to the collection.
|
|
|
|
|
Hi. How can I freely position a StatusBarPanel in a StatusBar? As an example I'd like to draw the first StatusBarPanel in the collection directly on the left within the StatusBar and the second one 100 pixels away. Overriding the DrawItem event handler makes it possible to change colors, font etc. of a panel but not to change its location within the parent.
Thanks,
Mark.
|
|
|
|
|
Change the widths of the panel. The first panel will be on the left, the second will be placed after the first, so if you want the second panel to start 100 in, then set the width of the first to 100 pixels.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
|
|
|
|
|
hi , how can i rotate an image around the z-axis (i think its the z axis i want)
i have a picture of a playingcard , the backside of it.
and now i want to rotate it so the player can se the front side of it.
how can i do this?
//Homer
|
|
|
|
|
Would that be the hypothetical zee-axis?
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
|
|
|
|
|
I have an Image. I wanted a perticular part of that image of know dimensions that is the Rectangle is know.
Can some one tell me how to get this perticular part of the Image.
Cheers
|
|
|
|
|
|
You can also use Bitmap.Clone. It lay you specify a rectangle, which is the part of the image.
With Clone, the resulting image will keep the PixelFormat of the source. For instance, if your first image is 8 bits per pixel, indexed, the cloned image will be also.
If you use the other method, with DrawImage, the image must be at least 16bpp I think.
|
|
|
|
|
My project is now to parse the Select SQL String typed by the user to visualize the table, the relation ship, the type of JOIN, the Critical etc... in a form. Would you please give me some hints or some algorithms or tell me if there would an OCX solved this problem? I tried my best to solve this problem but it's too complicated. In MS SQL Server, the SQL string is parsed that is different from the SQL string parsed in MS Access. Thank you.
PS: Actually, there are too many keywords in one SQL string, especially after FROM in the SQL string. And I don't care 'bout what databse is.
|
|
|
|
|
I have a PatientInfo class with some properties (Name, Id, ...), I also have a PatientPrescriptionInfo class that is derived from PatientInfo and as an extra property (PrescriptionCount).
Now I want to cast a PatientInfo object to a PatientPrescriptionInfo object but at runtime I get an 'System.InvalidCastException' exception. How can I solve this? How can I convert a PatientInfo to PatientPrescriptionInfo?
|
|
|
|