|
Hi all,
I have some basic questions about threading.
1. Is my windows application a single threaded or multithreaded?
2. If i create some thread objects or windows/thread/system timer would my windows application is a multithreaded one??
3. Suppose if my windows application registerd an event with COM exe. then if the event occurs will it run in a separate thread or in the GUI thread?
4. What does it mean STA AND MTA? what is significance of thest Thread apartment model?
5. is it possible to a share a class library by two application running in separate appdomain? if so how?
i googled for the above questions, but understand a little.. if anybodys knows plz share..also give some tips/links on this.
Thanks and Regards,
Srini
|
|
|
|
|
Here are some of the answers:
2. The timer control uses the message pump to handle events, so it doesn't use threading. The other timers start separate threads to handle events.
5. You can use the same library from different applications, but they are separate instances of the library, so you can't share data between applications that way.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks for reply!
This is with respect to my 5th question.
So how to share the dlls accross different applications? is there anykind of shared dll? or if i put my dll in GAC will it be a shared one accross the applications?
Thanks
Srini
|
|
|
|
|
.NET Remoting allows to share object instances between tow app domains, whereever they are: on the same machine or somewhere on the Internet.
|
|
|
|
|
1.
engsrini wrote: 1. Is my windows application a single threaded or multithreaded?
find the Main in your app. if use [STAThread], that means single threaded.
if you use [MTAThread], that means multi-thread.
<br />
[STAThread]<br />
static void Main()<br />
{<br />
Application.Run(new demo());<br />
}<br />
4. different between STA and MTA
|
|
|
|
|
hi all i have an application that can call up records in a set of database. i can do the navigate, delete update and insert functions.. however i wish to include sort and filter functions for my application.. how do i go abt doing this? any links or articles will be greatly appreciated thanks
|
|
|
|
|
I think you use the DataView for that
|
|
|
|
|
Hi,
Consider a class that I need to serialize and send over the wire. On
the receiving end, the serialization bytes have to be re-constructed to
form the object. The mentioned class has got some member variables and
one or more constructors.
[WebMethod()]<br />
public void Test(MyClass c) {}
The question is that is there anyway to control the proxy-generation
for the MyClass class? i.e, how am I supposed to force the
proxy-generator to generate the constuctors? Or should I add the
required constructors on the client side using the partial keyword?
What's the best thing to do when you want to pass a one-way informative
parameter (ie., no functionality embedded except for the constructors)
to a web method?
I would like the client side to create the object normally as follows:
MyWebService.MyClass c = new MyWebService.MyClass(param1, param2);<br />
MyWebService.Test(c);
Is there anyway to achieve such functionality?
TIA,
Mehdi
|
|
|
|
|
After the code has been generated, you can add them. As long as you stick to serialization standards (mark your public properties/fields as XmlIgnore, and dont delete their fields!).
If using .NET 2.0, partial classes gets generated, and hence u can define them in another file without worrying that regeneration will erase your changes.
|
|
|
|
|
Is there any keyword and/or pragma (like the one used in IDL (C++)) to force the compiler to put some code in the generated class? something like:
#include_this_in_generated_code "public void WhateverMethod() {}"
This way, I could alter the proxy code on service-side.
Thanks,
Mehdi
|
|
|
|
|
Okay, I've tinkered with this code and have not been able to get an image to display:
http://www.codeguru.com/Csharp/Csharp/cs_controls/datagrid/article.php/c4783/#more[^]
Basically, I am designing a drag and drop where I create a thumbnail for each image dragged and put that image into a table. I want everything in one row so I create a column for each image dragged. Then I create a new GridTableStyle for each new column. Then I set the DataSource. I'd like to do this with the use of a dataset, but I not picky just so long as I can get it to work.
So far all I get is a big white box with a giant Red "X" through it. Anyone have any ideas? Thanks in advance!
Here is my code:
public void ImageLoader()
{
//Create Thumbnails
foreach(string fn in files)
{
try
{
ImageConverter(fn);
}
catch(Exception)
{
}
}
//ids is Image-DataSet
ids.Tables.Add(dt);
getGridTableStyle();
image_Datagrid.TableStyles.Add(DGStyle);
image_Datagrid.DataSource = ids;
image_Datagrid.DataMember = dt.TableName;
}
private void ImageConverter(string filename)
{
string imageFile = Path.GetFileNameWithoutExtension(lastFilename).ToLower();
//Create and Save the Thumbnail and return the image
Image img = CreateThumbnail(filename);
//Put the image in the DataTable and name the column the image name without
//extension or directory info i.e. 'c:\\test.bmp' uses 'test' as the column name
AddThumbnailToDataTable(img, imageFile);
}
private void AddThumbnailToDataTable(Image img2, string columnName)
{
dt.BeginLoadData();
this.dt.Columns.Add(columnName);
this.dt.Rows[0][columnName] = (Bitmap)img2;
dt.EndLoadData();
}
private void getGridTableStyle()
{
try
{
DataGridColumnStyle GridTextColumn, GridBmpColumn;
DGStyle = new DataGridTableStyle();
// select table
DGStyle.MappingName = "Images";
// Use a PropertyDescriptor to create a formatted column. First get the PropertyDescriptorCollection
// for the data source and data member.
PropertyDescriptorCollection pcol = form1.BindingContext[ids, dt.TableName].GetItemProperties();
// create the first column style for a text column
GridTextColumn = new DataGridTextBoxColumn(pcol["ImageInfo"]);
GridTextColumn.MappingName = "ImageInfo";
GridTextColumn.HeaderText = "Image-Name";
GridTextColumn.Width = 50;
DGStyle.GridColumnStyles.Add(GridTextColumn);
//Create an ImageColumn for each image in the table
for(int i = 1; i < dt.Columns.Count; i++)
{
// create column style for an image column
GridBmpColumn = new DataGridImageColumn(pcol[dt.Columns[i].ColumnName]);
GridBmpColumn.MappingName = dt.Columns[i].ColumnName;
GridBmpColumn.HeaderText = "Bitmap";
GridBmpColumn.Width = 80;
DGStyle.GridColumnStyles.Add(GridBmpColumn);
}
DGStyle.RowHeadersVisible = false;
}
catch(Exception e)
{
MessageBox.Show(e.Message, "Adding Images to Grid TableStyle");
}
}
Thanks!
RABB17
|
|
|
|
|
Figured it out. If anyone ever wants to do this:
Don't pass an image to the datatable, instead pass the location of the new file.
Then in the DataGridImageColumn class make the following adjustment:
string ImageFile = (string)GetColumnValueAtRow(Source, RowNum);
Image img = Image.FromFile(ImageFile);
Bitmap ImagePic = (Bitmap)img;
Problem is that when you put the image file in the table, it can only hold a limited number of bytes for it (8kb) and you lose much of the image's data.
Hope this helps someone one day,
RABB17
|
|
|
|
|
Hello,
I use InternetExplorer object to go to an url through IE. But, the page requires user name and password login. The boxes are in a popup dialog (javascript I think).
How can I fill in the user name and password?
Moreover, how can I click the button ('Yes') in the popup dialog?
Thanks for your help!
|
|
|
|
|
You call the url with the user pass embedded.
IOW http://user:pass@www.foo.com
Should work, well it did many years back
|
|
|
|
|
sorry, the page fails to be displayed if I type: https//user:pw@www.mypage.com
Any suggestion please?
|
|
|
|
|
Archyami wrote: https//user:pw@www.mypage.com
https://user:pw@www.mypage.com
|
|
|
|
|
"The page cannot be displayed"
|
|
|
|
|
Just to make sure:
Did you replace "user" and "pw" in the URL with the actual user name and password?
---
b { font-weight: normal; }
|
|
|
|
|
yes.
https://myname:mypw@mypage
-> "The page cannot be displayed"
https://mypage
-> popup a dialog for username and pw
|
|
|
|
|
There is a "security alert" popup dialog from windows before the popup login.
Is it the cause of failure using
https://myname:mypw@mypage
?
If so, how to avoid the "security alert" popup dialog?
Thanks!
|
|
|
|
|
hi all i have searched the codeproject for password related articles but to no avail..can anyone provide me with any links or articles that do an application that requires the user to input a password and to verify before allowing him to continue with the application??
|
|
|
|
|
Well, it's kind of trivial. The hard part is deciding how to store your password and how secure you want it to be. All you need is a form that takes a username and password and that needs to return success before the rest of the app runs.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
ok thanks do u have a sample application or link where i can get to analyse the source codes? appreciate for yr help
|
|
|
|
|
Not really. Create a form that takes a username and password, and have your code call it. Hook up the OK and Cancel buttons to DialogResult.OK and Cancel. Make the OK button not work unless the username/password is correct. Have your app close if the dialog returns DialogResult.Cancel.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Is there an open source or free Checked ComboBox in .Net, either C# or VB.Net?
I have been searching high & low but to no avail.
|
|
|
|