|
Hi ,
I`ve implemented AppBars with help from the C# Does Shell-Part 3[^] article , but am having issues with the "Show Desktop" command .
What happens is that the AppBar itself gets minimized but upon restoration , its width becomes half of the earlier value. While debugging , i saw that the AppBar WndProc receives a FullScreenApp OS notification.
I`m handling this as :
if(lParam ==1 & appbar is topmost)
{ send it to bottom of z-order}
else if (lParam ==0 & appbar is bottom)
{ bring appbar to top of the z-order}
I need this logic so that my appbar is hidden when Word or IE enters full-screen mode & also to allow the user to see the start menu window.
Is there any other unique message that the OS sends to all active windows upon "Show Desktop" (other than WM_MINIMIZE) that i can handle ?
Any help or pointers are most appreciated.
Thanks in Advance
|
|
|
|
|
Hi,
I'm quite new to using VC++ and Windows forms. Although forms work well so far, I have an issue passing a handle from my main function to my form.
In main() I open a handle to a device. This handle must be available to my form so that when I click a button, it can use this handle to access my device and perform the intended action.
What is a good way to deal with this ?
regards
Marcel
recursive:
See "recursive"
|
|
|
|
|
I don't code C++, but as far as I know, the handle (or any other object) can only be accessed from inside the method they were defined in.
If you define the handle outside a method, it should be possible to access it everywhere.
Virtual1ty
"Any fool can learn from his own mistakes, but a wise man learns from mistakes of others"
|
|
|
|
|
OK, I defined it as a global now and it works well.
It basically gets written to only one at startup of the application and only read in the rest of the application so this global may be the easiest way to deal with it.
Thanks,
Marcel
recursive:
See "recursive"
|
|
|
|
|
You can also pass the handle as an argument to the form's constructor, or create a (at least) writable property which you can pass the handle to. Either one would be neater than having the handle defined as static (global) variable.
|
|
|
|
|
hi,
I m writting an windows forms based application in C# and am facing an unusual problem..I have thrown an exception from a my business logic code but the execution control gets lost after I raise a business exception!
(The business logic code is in a seperate library project)
has this happened with someone? please help..
|
|
|
|
|
I think you're going to need to be a little clearer in the explanation of what's happening before any one will be able to help you.
alesh_nitre wrote: ..I have thrown an exception from a my business logic code
Is this a custom exception or one of the standard .NET exceptions? How are you throwing it?
alesh_nitre wrote: the execution control gets lost after I raise a business exception
This doesn't make sense to me. What do you mean "the execution control gets lost"?
|
|
|
|
|
Thanks for such an urgent reply and sorry for a lousy explanation! But two days back i myself was unable to locate or reason about the cause of the problem. I'll explain better now. (Please ignore previous post)
About "the execution control gets lost" ->
I was debugging the code using VS2005 debugger pressing F10 and F11 along my way. But the moment the exception was thrown following things used to occur
1. The yellow arrow that shows current executing statement used to get lost
2. The call stack window used to go blank suddenly.
3. The application hung.
The app used to hang even in the release mode and so on.
-------------------------------------------------------------------
Neways. Now that i have better idea why this is happening I have summerised the code as follows. Please have a look at this -
private void button1_Click(object sender, EventArgs e)
{
// this code snippets reproduces the problem i stated
MySqlConnection con = new MySqlConnection("server=192.168.1.45;user id=root;Password=pqrs;database=dev");
//(I am using MySql .NET Connector 5.1.2)
con.Open();
try
{
// Select from any table that ***HAS BLOB DATA FIELD***
string selCmd = "SELECT * FROM document";
using (MySqlCommand allDocsCmd = new MySqlCommand(selCmd, con))
{
//Execute Reader
using (MySqlDataReader reader = allDocsCmd.ExecuteReader())
{
// ... some logic may be while(reader.read()) loop etc.
// Say this code throws an excpeption at some point..
throw new ApplicationException("Any exception ..");
// we expect the the execution control to go in the catch block below but
// it gets lost in the manner i told
}
}
}
catch (Exception ee)
{
MessageBox.Show(ee.Message);
}
}
|
|
|
|
|
The code looks ok to me. Given the explanation, it sounds like you are actually hitting an exception in the MySqlDataReader code. When you get into that state, try pressing the "pause" button on the debug toolbar, which will break the execution and place you on the currently executing line of code. If it can't find the code, it should tell you and give you the option of looking at the assembly code. You could also try narrowing the try/catch by putting it inside the innermost using block directly around the code you think is throwing the exception.
Also, are you using .NET 2.0 or later? If not, you can try adding a blank catch block. It's possible (although unlikely) that the code is throwing an exception that isn't properly wrapped as a .NET exception. The empty catch block will catch that, but you won't have any exception data.
|
|
|
|
|
You are rite! the problem is indeed with MySqlDataReader..
btw I tried what you suggestd.. but pressing pause returned the control to the "throw new App.." statement with the arrow in green color.
To dig further suspected the 'using' blocks in my code made it hang. so I removed them to find that my doubt was right. I closed the reader manually rather than the 'using' doing it for me.. following is the code..
<br />
string selCmd = "SELECT * FROM document";<br />
MySqlCommand allDocsCmd = new MySqlCommand(selCmd, con);<br />
MySqlDataReader reader = allDocsCmd.ExecuteReader();<br />
reader.Close();
The execution hangs at reader.Close();
This for sure is now a MySqlDAtaReader related problem..I selected everything else but the blob field from the table and it worked fine i.e.
"select id,data from document" hangs but
"select id from document" works ok.
('data' is a LONGBLOB field in document table)
I am searching a cause and fix but lemme know if you have ne idea why this is happening..
Thanx.
|
|
|
|
|
Good to hear that you have tracked down the problem. I'm not familiar with the MySqlDataReader code so I probably won't be able to help you there. The pause button trick works most of the time, but as you found it doesn't work all of the time. It was worth having you try it, just in case.
If you have access to the source code for the MySqlDataReader, you should probably start there and look at what the Close method is actually doing. If not, you can try using Reflector[^] to look at the code.
My guess, since this works correctly as long as you exclude the blob field, is that the blob field is allocating another datatype internally which isn't being properly handled in the Close call.
|
|
|
|
|
I will work on the reader.Close() and put a small update here so that others get help if they bump in to this kinda problem..neway. the "press pause button" trick is helping when everything seems 'frozen'. The green arrow appears and pressing F10 shows this messsage
The CLR has been unable to transition from COM context 0x191288 to COM context 0x1913d8 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations.
|
|
|
|
|
alesh_nitre wrote: I will work on the reader.Close() and put a small update here so that others get help if they bump in to this kinda problem
That would be good.
The message you are getting is really nothing more than Visual Studio telling you that the application has frozen and isn't responding to messages. It's a 50/50 chance that the message is actually meaningful and the application is really frozen.
|
|
|
|
|
Hi
Iam using C#.Net 2.0 backend is MS Access....
When I want to update a record folowing exception has been appeared:
Concurrency violation: the UpdateCommand affected 0 of the expected 1 records
Can anyone help me about the cause of the exception?
regards
Somasundaram
|
|
|
|
|
To test concurrency the database access test whether any changes have happened since you loaded the data.
Have a look at the original data (assuming you are using DataSets) and the data in the database.
They differ and therefore the db access can not find the record it should update.
-^-^-^-^-^-
no risk no funk ................... please vote ------>
|
|
|
|
|
hello,
Does anyone have the crack of the installshield 2008.
best regards.
dghdfghdfghdfghdgh
|
|
|
|
|
Most of us are developers, not thieves. But, if you give me your home address, I'll mail it to you ( seriously, I won't turn you in to the police for trying to take away the livelihood of programmers like me, I promise )
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I'm with you on this one, it seems like the world and their dog (or Amsterdam Council and ellllllllie at least) want to take away the jobs we love :/
|
|
|
|
|
No. Purchase a legitimate copy instead of stealing one.
|
|
|
|
|
You were looking for a crack?? It's behind you, just below your belt.
The same can be found on the front of your head, between your hair and neck.
|
|
|
|
|
I assume this is the same one he's talking out of. One word for him. A**hole.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Dave Kreskowiak wrote: You were looking for a crack?? It's behind you, just below your belt.
That is a good one
"Find it your bloody self - immediately!" - Dave Kreskowiak
|
|
|
|
|
There's a really great idea - advertise that you are after dodgy software, and then expect people here to be:
a - interested in illegal software
and
b - stupid enough to reply to this with anything other than a no.
Seriously, are you:
a) moronic
b) moronic
or
c) moronic
Please tick all that apply. Multiple answers will be accepted.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
no
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
I wonder how long it will take before every active CPian has replied to this
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|