|
Currently I am pulling all the classes I need relating to drag and drop from the IDL's in the SDK, and packing them into my own custom one.
Is this the right thing to do?
Also, when adding an interface to my IDL, do i need to include the square bracketed section above it that looks like:
[
object,
uuid(0000010e-0000-0000-C000-000000000046),
pointer_default(unique)
]
I think I do, but i'm not sure.
Also, can I add enumerations and structures to this? Or is it only interfaces?
Cheers
Cata
|
|
|
|
|
First, add the paths to your INCLUDE enviroment variable and you won't have to worry about paths.
Second, no, you shouldn't include the interface information - they're already defined you're just forward-defining them.
There's plenty of information about IDL in the PSDK. You should read some of that. Also, just do what the author did in the article that I linked. He does everything you need to do, just with different IDL files, interfaces, and structs.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
What's the INCLUDE enviroment variable? I have never encountered this before. Where does it go? Is this in VS?
I don't need to add the square bracketed stuff? In the article the guy uses only the UUID number in the interfaces he uses in his IDL file.
Unfortunately, while i have the platform SDK source code, I don't have the documentation to go with it. I'll have a gander on the MSDN though.
Sorry to keep asking sometimes dumb questions, but by almost all standards, I am a programming novice, and acronyms and half the names of things don't mean anything to me.
Cheers
Cata
|
|
|
|
|
You've never done any C/C++? The INCLUDE environment variable is a user- or system-environment variable that includes a semi-colon delimited list (colon-delimited in *nix) of directories where header files (or, in this case, IDL files) are located. You can set this in VS, too, but then it only applies to the VS environment instead of all applications (if an application is open, you'll have to restart it after setting the env. var.).
This is true for any modern OS shell.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I can read C++ and C, but the only C++ I've coded is for a Mod using the HL engine. So no actualy executables there. Just seting variables and methods in the game DLL.
Wrote my first hello world program 18 months ago in java and got VS 12 months ago. Been learning on the fly since then.
So where / how can I set this enviroment variable?
Cata
[edit]LOL! You mean #include don't you? Followed by a list of directory paths?
If so, I know that. I'm just a half asleep dozy f wit.
Where do I set it up?
[edit 2]
No you don't.
I'll shut up now and go and look it up.
|
|
|
|
|
This is the extent? COM is by no means an easy subject and Windows shell programming gets even harder (since it uses COM and adds certain complexities). You really should spend some time learning the basics. Learning things as you go is always good and you should never stop, but you have to have experience upon which to build.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Right, I have found the INCLUDE setup in my Enviroment variables of System Properties.
I have added the following entries to my INCLUDE section in the System Variables:
"F:\MSDN\SDK\v1.1\include\; F:\MSDN\Vc7\include; F:\MSDN\Vc7\PlatformSDK\Include"
Now, it appears that MSDN is NOT my VS directory, and i'm not sure if this is correct, but it contains all the include information of the PlatformSDK.
Now, i am not sure if this is actualy working, as i still gain no joy with the objidl.idl, which is in the directory "F:\MSDN\Vc7\PlatformSDK\Include".
Not sure what's wrong there.
I know Heath. I am going through the COM tutorials at the moment. I'm more than happy to take a step away from where I am in order to learn background knowledge, and since i've hit this whole DragDrop thing, i've learned a reasonable amout about C and COM from reading articles and experimenting with sample code.
It's actualy quite fun
I will continue on with these tutorials, but I think my next step would be to get my tools working. Midl and TblImp.
Cheers
Cata
[EDIT]
Never mind, i had a problem with not running vcv*something*.bat. It appears to be all working now.
Although, midl does not appear to be generating the objidl.tlb file I asked it to, despite running without errors.
|
|
|
|
|
Don't include spaces between delimited directories in your INCLUDE env. var. (or PATH, LIB, or any other delimited path env. vars. like that). Also keep in mind that you can use env. vars. even in those env. vars. by defining things like PSDK=F:\MSDN\Vc7\PlatformSDK as another env. var., then using INCLUDE=%PSDK%\Include.
Also, you should download the newest PSDK from MSDN. If you're using the one in your VS.NET directory, you're using an OLD one. Also, don't include directories in your env. var. in quotes. That is one thing that the OS will handle correctly when using the UI. When doing this in a command line, you would have to type it like so:
set INCLUDE=C:\SomeDir;C:\SomeDir\Some Other Dir Make sure there's no space around the equals (=) sign and don't use quoes there, either. Also note that typing this in the command prompt only makes the INCLUDE env. var. durable for THAT particular command prompt instance. You can also append directories like so:
set INCLUDE=%INCLUDE%;C:\SomeDir;C:\SomeDir\Some Other Dir Again, if you change the env. vars. through the Advanced tab in the system properties, you must restart any program - including the command prompt - in which you need these changes reflected (for instance, an open Internet Explorer browser window won't benefit from this change, so you don't have to restart it).
Note also that VS.NET maintains it's own list, though there is ways to make it use the system and user environment variables instead. See the Options for details and just try it out.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Ok, downloading SDK now.
the INCLUDE variables are working, and I have the MIDL working as far as I can see. It runs at least without errors.
Does not seem to generate the file i was hoping for.
used the "/tlb objidl.tlb" extention, and got nowt from it. Did a full system search.
Cata
|
|
|
|
|
You're not supposed to compile the whole thing to a typelib, only forward-define the interfaces in your own IDL file and then compile that to a typelib. See the midl.exe documentation for more command-line options. Each IDL file doesn't have a typelib because many are typically meant to be included in other IDL files while being defined in a library elsewhere - this isn't your concern. Do what the linked article I gave you mentions and generate a typelib including the interfaces, structs, and enums you need ONLY. Anymore - unless you're planning on interop'ing the whole COM for a huge-ars library - is just overkill and bloat.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Ok Heath, I think I am almost there.
One last question.
I've looked through the idl files, and a lot of the structures and enumerations I need are embedded in interfaces.
Some of them are in ones that I do not need.
Can I pull them out and put them in the file on their own? Or do they need to be included in the interfaces?
I ask this because STGMEDIUM is represented in objidl.idl by uSTGMEDIUM. Are these the same? As their layout is identical.
Cheers
Cata
|
|
|
|
|
This thread is starting to have an interesting curve to it....
Just felt like mumbling a little, I have been flipping though one of those Java books Ryan gave me. So far I am unimpressed with the language.
- Nick Parker My Blog
|
|
|
|
|
I hated it... it doesn't compile to an executable and runs slow as a 36 stone 1 legged man with a ball and chain round his ankle.
It's also ugly, a real mission to program, and the documentation is nigh on impossible to navigate quickly.
I moved from java in text pad to C# in VS.NET. It was like replacing a wooden go kart with a ferri.
So yeah, burn your java book in the name of all that is holy!
(Well, ok, java might have SOME uses... but... there you go. My experience was bad )
Can we make an arc? WHEEE!
:p
Cata
|
|
|
|
|
It appears that the library itself is lacking, but I haven't gotten into that much yet.
- Nick Parker My Blog
|
|
|
|
|
My dad would say
"In my days, the only class libraries we had were those built by ourselves."
But my dads about 2000 years old and made computers with sticks and stones.
Cata
|
|
|
|
|
Nick Parker wrote:
...but I haven't gotten into that much yet.
I'd say! The Java class library has all the basic stuff, while Swing (added with Java 1.1 I believe) offers a stunning GUI class library over the prevoius AWT packages. And just like .NET, there are a ton of libraries out there (both by Sun and by third parties) to extend the basic functionality below your application, things for encryption, web services, RMI (like .NET Remoting), remoting bridges, and much more.
This doesn't mean I like it, but it serves a purpose and deserves a little respect, especially since it was the first real framework before .NET.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Heath Stewart wrote:
I'd say!
I'd spent about 10 minutes looking at the book when I made that comment, obviously my statement does exactly hold a lot of weight. I'm actually glad to hear what you just said; it will keep my hopes up that I will find another language I might enjoy to work with.
- Nick Parker My Blog
|
|
|
|
|
What did I say to make you think you'd enjoy it?
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Well, you didn't confirm that it sucks which is a good thing. Who knows, I may just despise it.
- Nick Parker My Blog
|
|
|
|
|
.NET code doesn't technically, either. It uses a bit in the executable's PE/COFF header that the app loader checks (or any other various hosts, like mscoree.dll or Internet Explorer) that sets up the host runtime and loads the application. With Java, it is the java executable that does this. The only difference is that in Windows, the executable is still loaded by the app loader than makes this check. On *nix with Mono, for example, you have to run .NET applications just like java: mono MyApp.exe
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
MSWord can load ActiveX and host ActiveX's toolbars, status bar and so on. Could any one tell me how can I host that ActiveX and create ActiveX in .NET ? And then load my controls as "Objects" in Word ?
Wizard_01
|
|
|
|
|
Read Nick Parker's article, Creating a CCW...[^]. You should also read the System.Runtime.InteropServices documentation so you understand what's going on. Knowledge of COM is also helpful, such as understand the difference between IUnknown and IDispatch (for automation), knowing which IPersist * interfaces that Word supports (it is a typical ActiveX container), knowing what ActiveX containers are, and the like. You should also NEVER use auto-generated class interfaces (as I asked Nick to add to his article) and NEVER change your class interface after releasing your component (instead, create a new interface by appending 2, 3, etc. for each version) that derives from the first and adds methods with new DispIdAttribute s for automation objects).
As far as OLE is concerned (for hosting toolbars, merging menus, hosting status bars, etc.), you'd really be best writing your component(s) in C++ as opposed to some .NET language like C# because you'll have to define LOTS of COM interfaces with the appropriate GuidAttribute s, DispIdAttribute s, InterfaceTypeAttribute s, and so on. System.Runtime.InteropServices provides a few managed definitions (the interfaces that start with UCOM * like UCOMIBindCtx ).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi,
i want to filter the properties on my component based on the value on another property.
if i set the property ".type=abc" i want to display some propps
and if i set ".type=def" i want to show some other propps
and so on.
i tried to add a designer and use the pre/postfilterproperties but those methods only fired once , when you first show the component in the propertybrowser
i need something that can tell the propertybrowser that it should show a new set of propps..
ive found some info about ifilterprovider something , but i havent found any actual code that shows how to do this..
any ideas?
(im not trying to change _all_ propps , i just want to hide propps like ".image" and ".checked" when certain criterias are met)
//Roger
|
|
|
|
|
To hide properties you can use attribute [Browsable(false)]. I am not sure if is possible to change this value in runtime. I think you cannot.
Or you can implement TypeConverter for your class using attribute TypeConverterAttribute and than override GetProperties and GetPropertiesSupported method. By this way you can manage properties which will be "visible" in PropertyBrowser.
Wizard_01
|
|
|
|
|
the typeconverter thing did it..
works like a charm..
incase anyone ever need this , here is the code for it..
public override System.ComponentModel.PropertyDescriptorCollection GetProperties(System.ComponentModel.ITypeDescriptorContext context, object value, System.Attribute[] attributes)<br />
{<br />
System.ComponentModel.PropertyDescriptorCollection propps=propps=System.ComponentModel.TypeDescriptor.GetProperties (value,attributes,false);<br />
<br />
ArrayList arr=new ArrayList (propps);<br />
<br />
TextBoxButton tb=value as TextBoxButton;<br />
<br />
if (tb.Type != TextBoxButtonType.Custom)<br />
arr.Remove (propps.Find("image",true));<br />
<br />
if (tb.Type != TextBoxButtonType.CheckBox)<br />
arr.Remove (propps.Find("checked",true));<br />
<br />
if (tb.Type != TextBoxButtonType.Spin)<br />
arr.Remove (propps.Find("autorepeat",true));<br />
<br />
PropertyDescriptor[] arr2=new PropertyDescriptor[arr.Count];<br />
arr.CopyTo (arr2);<br />
<br />
return new PropertyDescriptorCollection(arr2);<br />
}
|
|
|
|
|