|
To me it does not sound like a pInvoke problem but a generic dll problem.
How did you declare you local variable in c++? is it a static int?
Did you check if your c++ dll is unloaded after the pInvoke? (try to add trace code to the _main)
/cadi
24 hours is not enough
|
|
|
|
|
i would save and object as a treeview inside a ASCII textfie so can i read it again and assign to a new treeview:
tfile = myOldTreeVew.toTextFile();
.... close the applicaion
.... open again the application
myNewTreeView.ReadFromTextFile(tfile);
Obvialy these functions don't exist, but i need something like them.
|
|
|
|
|
Have a look at this article. I think it provides everything you need.
|
|
|
|
|
I would like to save the screen of windows form as an image, would you please advice on how can I do so?
Print Screen may not work as I may need the screen of form that is not currently using. Besides, I do not have button on the form that I want to print, i.e. I invoke the print screen function from another form.
Thanks very much.
|
|
|
|
|
You could get the DC of the form and do a bit block transfer:
<br />
IntPtr hwndDesktop = GetDesktopWindow();
<br />
Size s = form.DesktopBounds.Size;<br />
<br />
Graphics graphicsForm = Graphics.FromHwnd(hwndDesktop);<br />
<br />
Bitmap bitmap = new Bitmap(s.Width, s.Height, graphicsForm);<br />
<br />
Graphics graphicsBitmap = Graphics.FromImage(bitmap);<br />
<br />
IntPtr dcForm = graphicsForm.GetHdc();<br />
IntPtr dcBitmap = graphicsBitmap.GetHdc();<br />
<br />
bool result = BitBlt(
dcBitmap,<br />
0, 0,<br />
form.DesktopBounds.Width, form.DesktopBounds.Height,<br />
dcForm,<br />
form.DesktopBounds.Left, form.DesktopBounds.Top,<br />
SRCCOPY);<br />
<br />
_________________________________
Please inform me about my English mistakes, I still try to learn your language!
|
|
|
|
|
hi all,
I need to replicate Two Databases using C#?
One Database is in "pubudu\MSDE" SQL Server ..Other Database is in "kushan\MSDE" Server.
Can any body please tell me How to replicate above two databases?
any anwers would be greately appreciated.
regards,
pubudu.
|
|
|
|
|
Are you talking about SQL Server Replication or some sort of manual process?
|
|
|
|
|
hi,
I know that SQL Server 2000 has some functions for Data Replication.But I need to know there are other free softwares for Data Replication?
Or can we do it as manual way?
regards,
pubudu.
|
|
|
|
|
I am not familiar with any free software that does this but you might be able to find something. Are you looking to have the data replicated immediately as it is changed?
|
|
|
|
|
Hello,
Usually when I drop some controls at the MDI Parent and later open Mdi Child forms, I can see MDI Parent controls on the top of child forms. Is there any way that we can display Child forms without displaying MDI Parent controls. I know that SetWindowPos can make a child form topmost. but It'll be on the top of all other forms too which is not a good solution to the problem.
Any suggestions in this regard will be appreciated.
TIA
Maqsood Ahmed [MCP,C#]
Kolachi Advanced Technologies
http://www.kolachi.net
|
|
|
|
|
Try setting Visible property to False on the controls on the MDI parent form at the time of displaying a particular child form (when you do not want to display them alongwith the child form).
|
|
|
|
|
Hello,
Not feasible. Suppose a Groupbox is placed at the MDI Parent with some child controls. MDI child form covers a part of the groupbox and its contained controls. How can this solution help in this regard
thanks for the response anyways.
Maqsood Ahmed [MCP,C#]
Kolachi Advanced Technologies
http://www.kolachi.net
|
|
|
|
|
The probelm mentioned by you arises because you are perhaps trying to put some controls on the client area of parent form, instead of putting the same on the non-client area. The child form which would occupy the client area will naturally cover the client area, which inter alia means that the controls on the parent form (which are in the client area) are also covered at least partially. One thing is sure that if you put some controls on the non-client are of parent form, then the child form will not cover them.
But, the big question is why do you need to put some controls in client area of the parent form, when in the same area you have to show the child form? Why can't you put these controls on the non-client area of the parent form?
If there is some compelling reason for you to put the said controls in client area of the parent form itself, then these are the available options:
1. Make the application Single Form instead of MDI. Here, you'll have the option of showing other forms as independent forms called from the main form (though now they will not be the child forms, i.e., they will not be covered only in the client area of the main form; and plus some other pros and cons). So your child form functionality can be achieved through such other independent forms.
2. Second option is to have MDI format itself and put the controls in the client are of the parent form itself, if you don't have any other options. But, now try to limit the size of the child form in such a manner that the child form opens in the other part of the client are of parent form which does not have the parent controls. And, keep the size and location of the child form under your strict control in the code (e.g., non-flexible such as non-maximizable or fixed-single borderstyle property or subject to some co-ordinate limits by checking in code etc.) This will ensure that the parent controls are not hidden by the child form.
3. The third option is to make the Visible property of parent controls false if it is feasible, as I suggested earlier.
4. The best solution would of course be NOT to put the controls in the client area of the parent form.
Regards
|
|
|
|
|
try this
make a new form and place the controls on it. and in MDI
change the inherit statment of MDI Class to this newly added form containing controls and see if this you need to do
cheers........
|
|
|
|
|
I have got my main form working OK now, but it's still the case that my form spawns another form, using ShowDialog, all buttons have a DialogResult of none, the AcceptButon and CancelButton are none in both dialogs, but when you click a button in the second, and my code calls this.Close(), the parent dialog closes also unless I put hacky bool variables in to stop it.
Why, why, why ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Please check whether you have put the this.Close() method call in the first form (i.e., parent form itself)instead of putting it in the click handler of the second form. If this is so, please put that code in the click handler of the button in the second form.
In fact, I tried to test it using a chain of three forms, Form1 calling Form2, and Form2 calling Form3. I have also put this.Close() in both Form2 and Form3 click handlers for the respective buttons. But I get the correct and expected behaviour and the parent form is not closed. Apparently, your problem is because of this.Close() being called from within a method in the parent form itself.
|
|
|
|
|
Ashok Dhamija wrote:
this.Close() being called from within a method in the parent form itself.
No, it's not. I've stepped through many times and verifed that it's not.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
May I suggest the following scheme, as I tested it in my test application:
In Form1, I put the following code for button1 to display Form2 as a modal dialog:
private void button1_Click(object sender, System.EventArgs e)
{
Form2 form2 = new Form2();
form2.ShowDialog();
}
Then, in Form2, I put 2 buttons, button1 (to display Form3 as a modal dialog) and button2 (to close Form2), with the following code:
private void button1_Click(object sender, System.EventArgs e)
{
Form3 form3 = new Form3();
form3.ShowDialog();
}
private void button2_Click(object sender, System.EventArgs e)
{
this.Close();
}
I have put button1 in Form3, with the code to close it as under:
private void button1_Click(object sender, System.EventArgs e)
{
this.Close();
}
Now, when I show Form2 and then Form3 as modal dialog boxes from buttons in Form1 and Form2 respectively, they are properly shown. Similarly, when I close Form3 by clicking button1 on it (which uses this.Close() method and of course it can contain other code before that), it closes properly, and the important thing is that Form2 (which is the parent form for Form3) is NOT closed in this manner. Likewise, when I close Form2 by clicking button2 on it by using this.Close() method, Form2 closes properly and again it is pertinent to note that the parent form Form1 is not closed.
So, in this manner, the whole behaviour is as expected and correct. The only important aspect to note is that:
1. I am using the simple form2.ShowDialog() method, without using the DialogResult. Secondly, the actual functionality is added on the dialog form itself in its various buttons (instead of putting the same directly in parent form in the format of if(dialogResult == DialogResult.OK), etc.).
I wonder whether your application can be suitably modified to this pattern.
I really do not know whether all this is of any use to you.
Regards,
|
|
|
|
|
Hi - this is pretty close to what I am doing. I suspect that my form has some code that the designer has failed to remove, which is causing this behaviour.
Thanks for helping.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
A little code will help to know the exact situation.
Maqsood Ahmed [MCP,C#]
Kolachi Advanced Technologies
http://www.kolachi.net
|
|
|
|
|
There is no code. No code that's relevant anyhow. The core issue is the values of the buttons, which are set in the designer.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Just a wild guess, but do your OK and Cancel buttons have their DialogResult property set to DialogResult.OK and DialogResult.Cancel?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
S. Senthil Kumar wrote:
Just a wild guess, but do your OK and Cancel buttons have their DialogResult property set to DialogResult.OK and DialogResult.Cancel?
No, sorry, I thought I said that. They are all set to (none).
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
hi could u please tell me how i can check my sql database to look for a stored procedure if exist or not, and if not exist how i can create it, please help me by code, i have to finish my project as soon as possible
Thanks alot
Hamody
|
|
|
|
|
Surely this should have gone in the SQL / ADO.NET forum.
The SQL code is:
IF NOT EXISTS (SELECT * FROM dbo.sysobjects
WHERE id = OBJECT_ID(N'[dbo].[StoredProcedureName]')
AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
CREATE PROCEDURE ....
If you need to run this through a C# application just ExecuteNonQuery() on the SqlCommand like this:
SqlCommand cmd = new SqlCommand(sqlStatement, myConnection);
cmd.ExecuteNonQuery(); The above assumes that you already have a connection and it is open. The sqlStatement is a string that contains the completed contents of the SQL code above.
Does this help?
My: Blog | Photos
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
|
|
|
|