|
One more time... P/Invoke the function call.
See this[^] MSDN document for a little primer on P/Invoke.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello Dave,
I found:
[DllImport("aygshell.dll")]
static extern uint SHFullScreen(???? hwndRequester, ??? dwState);
I do not know how to call this function with what parameters.
I found on msdn: SHFullScreen(HWND hwndRequester, DWORD dwState);
DWORD should match Int32, but HWND? InPtr is a good guess?
Finally, how can I find out what the dwstates are? I found on MSDN SHFS_SHOWTASKBAR, but what is the value of this state?
Please help.
Jelle
|
|
|
|
|
HWND and DWORD will both translate to an Int32 in this case. It really depends on the function your calling.
To get the hWnd of your form, just use Me.Handle. The dwState constants can be found in the Aygshell.h file. Just do a search on your hard drive to find it. The constants will be written in C++ so you'll have to translate them into C# code so you can use them in your project.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I found the constants on my harddrive. However, I cannot get the handle with me.handle. Also this.Handle does not work in .NET compact framework.
Please help.
///SHFS_SHOWTASKBAR 0x0001
///SHFS_HIDETASKBAR 0x0002
///SHFS_SHOWSIPBUTTON 0x0004
///SHFS_HIDESIPBUTTON 0x0008
///SHFS_SHOWSTARTICON 0x0010
///SHFS_HIDESTARTICON 0x0020
|
|
|
|
|
Hi,
I am getting an InvalidOperationException with the message:
"Cannot call Invoke or InvokeAsync on a control until
the windows handle has been created."
This message occurs only at design time (so far) when we build and run the
project no errors related to this occur. Has anyone found the cause of this?
Thanks in Advance
|
|
|
|
|
What is your control doing when it is created that requires the Invoke call?
You really shouldn't be calling Invoke in Design mode...
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Actually, an instance of the control exists even at design-time but you must still make sure the handle exists (IsHandleCreated ) before invoking anything that requires a valid window handle.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
You're trying to call invoke on the control before the control's window is created and the handle is assigned.
I get around this with an if/else
if (myControl.IsHandleCreated)
{
}
else
{
}
Grim (aka Toby) MCDBA, MCSD, MCP+SB
|
|
|
|
|
Another common way is if the handle isn't created (see IsHandleCreated ) to queue the operation and invoke it when the HandleCreated event if fired. Many classes in the .NET FCL (especially in Windows Forms) do this.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I've never actually had to do it, so I'm curious as to how it gets queued? I'd tear into the class code with the disassembler but I'm nowhere near a machine with VS.NET on it at work.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
All you need is the .NET Framework SDK (which requires the .NET Framework). VS.NET just installs the SDK if you opt for it, but it doesn't come with just the SDK as well.
If you were to set a property for example, the set accessor would contain something like this:
if (IsHandleCreated)
{
SendMessage(Handle, SOME_MESSAGE, 0, value);
fieldSet = true;
}
else
{
fieldSet = false;
}
fieldName = value; In the override to OnHandleCreated , you'd have something like this:
if (!fieldSet)
SendMessage(Handle, SOME_MESSAGE, 0, fieldName); To do this with delegates wouldn't be a whole lot different since you can store the delegate in a field or an IList and invoke it later.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I thought of that, but was quickly shot down. I can't install it on anything where I work...
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Nevermind. I found a couple of examples of the technique.
I've been up for four hours and still can't keep my mind or eyes open...
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi all,
I need some advice on the best method to impelemt some functionality.
I have a reader obj that reads all the files in a folder, running in a thread. After each file has been read I call a processor obj to manipulte the data and fill a database. I'd like to process one file while reading the next, but limit the processor to only one instance (to prevent duplication of data in the DB). If the reader finishes reading before the processor it should wait until the processor is done its current data load, but if the porcessor has finished then the reader should make a new processor and then continue to read the next file.
So whats the best method of controling the reader depending on the state of the processor?
I should point out that I'm fairly new to C# (six months)
Thanks
|
|
|
|
|
If your only going to be using a single instance processor, why read ahead of it? You're not gaining any real performance benefit because of the single threaded nature of your design. One thread is constantly waiting for another to complete it's work. The FileStream classes already do read/write caching on their own, so why duplicate its effort?
If you could use a multiple instance processor, instead of a single, THEN you'd see the performance gain. Also, your reader object shouldn't be reading the files itself. Your design should have an engine that hunts down files, then passes the filename to a threaded instance of the processor. That way, the processor thread is doing the reading and processing of the file while your engine goes on it's merry way to launch another processor on the next file. The thread pool could be used for such a task. That way, you wouldn't have to include very much code to do thread management.
I only say this because I did something similar to this a few years ago. But in my case, the database made sure I wasn't duplicating data, not my processor objects.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks for your comments.
The majority of the time the app will be run on a single instance processor machine, but there may be a case where the volume of data is so large a multi machine could be used.
I wish the database would control data duplication, but the data is so poor and badly supplied that I have to do all the checking that I can. For example the data is in XML format and one 33mb file had over 10,000 violations against the schema, but it was well formed!
In the interests of simplicity I leave it as single threaded.
|
|
|
|
|
I need to use msdn not through VS IDE. like standalone help files.
is it possible ? if it is then which file i want to execute ?
Sreejith S S Nair
|
|
|
|
|
You should have a shortcut in your start menu somewhere ...
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
Let me clarify the question once again.
i don't have any menu or link which will connect MSDN index page. I have only the installation folder.
if i want to open help index with using VS IDE, what i want to do ?
Sreejith S S Nair
|
|
|
|
|
Hi,
certainly possible...
Microsoft distributes MSDN seperately in the name of "MSDN Library Edition [month][year]" under the heading "Microsoft Development Network"... if I'm not wrong.
The full installation comes in 3 CDs. After installation you can find "Microsoft Development Network" in your "programs" menu. Thatz really the full and complete MSDN in real sense...
regards,
Aryadip.
Cheers !! and have a Funky day !!
|
|
|
|
|
Please first read the question and then answer.
I have MSDN installation in my machine. And i need to use that help file with out any other program( like if you press F1 in VS IDE you will get help).
otherwise tell me which file that VS IDE using to show the searched content when we press F1.
Sreejith S S Nair
|
|
|
|
|
I don't have VS.NET on any machine at work here, so I'm trying to do this from memory...
Goto the Help menu is VS.NET and pick Index, or Help Index, or something like that.
[EDIT]
If you have the MSDN installed with VS.NET, yes, you SHOULD have an incon for it under Start/Programs/Microsoft Developer Network.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
The following is copied from the shortcut I use to launch MSDN. It's not as simple as double-clicking on a file.
Note that this is specifically for the April, 2004 installation of MSDN.
"C:\Program Files\Common Files\Microsoft Shared\Help\dexplore.exe" /helpcol ms-help://MS.MSDNQTR.2004APR.1033
Grim (aka Toby) MCDBA, MCSD, MCP+SB
|
|
|
|
|
There is a shortcut in the VS.NET product folder. If you want to execute this without the shortcut, you need to use the path to dexplore.exe (typically in C:\Program Files\Common Files\Microsoft Shared\Help, though you should use Environment.SpecialFolder.CommonProgramFiles pased to Environment.GetFolderPath to get the C:\Program Files\Common Files since it can be redirected or on a different drive than C:). Then pass a command-line param like so:
string dexplorePath = Environment.GetFolderPath(
Environment.SpecialFolder.CommonProgramFiles);
dexplorePath = Path.Combine(dexplorePath, "Microsoft Shared\Help\dexplore.exe");
Process.Start(dexplorePath, "/helpcol ms-help://ms.vscc");
Process.Start(dexplorePath, "/helpcol ms-help://ms.vscc.2003");
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I have a very odd problem with J# and threads.
I have a client with a gui and a connection class that is in another thread. At first only parts of the GUI loads, most tabs are not added at this point. Then I connect and check for password, if that is correct I want to load the other tabs. Oddly it loads the first one and that one is empty.
The connection class in an observer that the GUI is listening at.
And when I debug I get this error message:
"An unhandlet exception of type 'System.ArgumentException' occured in system.windows.forms.dll
Additional information: Controls created on one thread cannot be parented to a control on a different thread"
Any idea what might be wrong?
|
|
|
|