|
is the MC++ code in a DLL? im not sure if you can then just reference it as u would a c# dll - ull have to try.
Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk "All programmers are playwrights and all computers are lousy actors."
|
|
|
|
|
How do I center a message box to my application form. I have tried passing the application form as the parent of the message box but it still appers centered to the desktop.
MessageBox.Show(myForm, ...);
Joel
|
|
|
|
|
I need to know if there is a vertical scrollbar in a listbox. there is a bool HorizontalScrollBar property, but not a bool VerticalScrollBar
Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk "All programmers are playwrights and all computers are lousy actors."
|
|
|
|
|
You have ItemHeight (in pixels) and Height of the control... so you can try something like:
<br />
bool bVertScrollBar = lb.ItemHeight * lb.Items.Count > lb.Height;<br />
Just take into account that you can change the units of your form (with AutoScaleBaseSize).
-- LuisR
p.s. And take into account that the horizontal scroll bar could be displayed also, thus reducing the height of the display area.
──────────────
Luis Alonso Ramos
Chihuahua, Mexico
www.luisalonsoramos.com
"Do not worry about your difficulties in mathematics, I assure you that mine are greater." -- Albert Einstein
|
|
|
|
|
thats sort of what i did - except there is a property called PreferedHeight thats does your multiplication for you, and its better to use it, because not all the items in the listbox are the same height.
Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk "All programmers are playwrights and all computers are lousy actors."
|
|
|
|
|
I am interested in returning a value by reference so that if it is an ArrayList when I make changes to it, the changes are permanent.
Now this is totally possible in C++ and I used to do it all the time.
ie. public &int Class1::Foo()
This must be possible in C#, is there something I am missing?????
Thanks very much...
|
|
|
|
|
you can do the same thing is C# - except, you have to declare the code as unsafe
e.g.
unsafe public &int Method()
and you need to compile with the 'comile unsafe code' compiler switch. I believe it is like this because when you do this, you are overrideing the .NET memory management, so you are handling the memory yourself or sumpthin.
p.s. to use it in normal code, just do this:
...
unsafe
{
....
}
Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk "All programmers are playwrights and all computers are lousy actors."
|
|
|
|
|
if you simply want to pass an ArrayList to a function which modifies the properties and such of that ArrayList, just pass the variable, no need for anything fancy.
if you want to pass an ArrayList to a function which has the ability to actually change the reference, add a "ref" modifier to the parameter of the method calls, both in the signature and in the call.
or are you trying to do something else?
|
|
|
|
|
Hie...to all,
I don't know why I can't run my application which I wrote it using C#.NET.
When I bring it into the Windows 98, I can't execute the program. Please advice me?
Thank you!
Aaron
|
|
|
|
|
DotNet wrote:
I can't execute the program
What do you mean by "can't execute the program"?
Do you get an error message? Blue screen? What happens?
James
|
|
|
|
|
I don't know the exact problem but did you installed the .NET Framwork?
|
|
|
|
|
Hi,
I'm wrting a custom control that will use theme library to
draw my control. But whenever I call OpenThemeData, all that
I get is a NULL theme handle. Is there any trick to do before
calling this function?
I saw one guy posting the same question a couple months ago
and sought no answer.
I also read James T. Johnson & akr0's discussion on this issue.
However, not quite understand what James mean by using P/Invoke.
What's P/Invoke? (I know it may be a dump question, but I'm a
beginner...)
Any help will be appreciated. It would be better if you can
provide a code snippet to illustrate. Thanks
|
|
|
|
|
Li-kai Liu (Angus) wrote:
I'm wrting a custom control that will use theme library to
draw my control.
Unless you are doing something special the "easy" thing to do is to create a manifest file for your application and set the FlatStyle of your controls to FlatStyle.System .
If you want to go this route, Chris Sells' website[^] has a manifest file for VS.NET, you can use this same file for your application just rename it to myapp.exe.manifest.
That said, on to your other question.
Li-kai Liu (Angus) wrote:
What's P/Invoke?
P/Invoke is a method of executing functions from a C-style dll in a .NET program.
The first step is to declare the function you wish to use and the file that it is in. I'll use OpenThemeData as an example. There is a step embedded in this first step, in that you have to convert all the types used into .NET equivalent types. This is something you learn with practice and time.
[DllImport("uxtheme.dll")]
public extern static IntPtr OpenThemeData(IntPtr hwnd, string pszClassList);
Note that since the second parameter is a wide string (unicode) I could just pass the string in directly and not have to involve the MarshalAs attribute.
For more information look up the DllImport and MarshalAs attributes up in MSDN. If you have to pass structures around you'll probably also need to look at the StructLayout attribute.
HTH,
James
|
|
|
|
|
Hi, James
The thing you addressed in the second part using P/Inovoke
is what I've done in my program. But it's still not working.
I've already had my unmanaged function declared as you did
in the post. And it looks to me that OpenThemeData doesn't
work as it should do. I had another uxtheme API
static public extern bool IsThemeActive();
It works very well. But just don't know why OpenThemeData
always return Null whenever I call it.
Part of the code in my control is as follow:
protected override void OnPaint(PaintEventArgs pe) {
IntPtr hTheme = OpenThemeData(this.Handle , "button");
if (hTheme != IntPtr.Zero)
{
// draw themed control
}
else
{
// draw normal control
}
}
However, OpenThemeData always return Null...
Am I doing right with this?
Thanks!
|
|
|
|
|
I think it is a result of using OpenThemeData incorrectly; but the docs aren't that clear on how it should be used.
I only have one suggestion and it isn't a very good one. Put the class name in all caps ("BUTTON") or try "Button"
I tried to download the MSDN sample app but I just got a 404 instead
James
|
|
|
|
|
have tired "BUTTON" & "Button". still the same
sample app? Do you mean ThemeExplore??
Li-kai
|
|
|
|
|
Li-kai Liu (Angus) wrote:
Do you mean ThemeExplore
yep; I wanted to see how it used the various functions.
James
|
|
|
|
|
I put a copy at http://www.ykliu.com/ThemeExplorer.zip
if you wish to have a look.
Maybe a bit slow when downloading
Li-kai
|
|
|
|
|
Thanks,
Looking at the source it passes in NULL for the handle and a valid class name, so this might be the problem you are experiencing.
James
|
|
|
|
|
Thanks a lot!!
You've been always helpful
|
|
|
|
|
I want to read from a "Select" SqlCommand into a SqlDataReader, but The RowsAffected
Property of the SqlDataReader doesn't show the Proper Number (Actually always -1) (how can I know how many rows have returned.)
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
A datareader is connected and forward only, so it won't contain info like rowcount, etc ...
Try use a dataset instead or loop through the datareader to see how many "reads" you can do.
Depending on the scenario, you might be able to use ExceuteScalar instead.
Cheers,
Simon
"Sign up for a chance to be among the first to experience the wrath of the gods.", Microsoft's home page (24/06/2002)
|
|
|
|
|
Thank you for reply.
SimonS wrote:
t won't contain info like rowcount
But it HAS this property!!!!
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
It has that property, but that data isn't available until you've gone through all of the results returned.
If you run the SELECT command through query analyzer you will see the rowcount is returned as the last item.
This is done for performance reasons, so it can begin passing the data on to the next process that needs it; whether that be a parent query or a client such as the DataReader.
Otherwise it would have to load all of the results into memory, then count the number of rows before starting to send data; or perform the query twice: once to count the rows and again to send them.
This doesn't seem like much until you have a table with a million-plus rows and your query results in half of them being returned.
James
|
|
|
|
|
Hi all,
Is there someone who know how make these 2 things
1: make a tooltip over over the cursor when someone enter a function name like in VStudio ?
2: how make a listbox appear when someone enter a "." at the end of a variable name like in VStudio ?
Thanks a lot
BLaZeX
|
|
|
|