|
Thanks Uwe. Yes i tried, they mainly suggest ShFormatDisk.
I'm trying to give my end users/customers a clean restore environment without dos boxes and nags, using imagex, but i need to format the disk before applying an image.
|
|
|
|
|
solved: i launch a command line Process with FORMAT using /Y, an undocumented flag for the unattended mode
|
|
|
|
|
Hi
Is there any possibility that I could cast an object through its handle.
For example, I have to do an estimation of objects and finally I get the handle of that object through GetWindow API call, now I know its type but how to retrieve that object and cast it for that specific type?
I am implementing it using a dll file.
Regards,
Mujtaba Panjwani
Tiger Softwares
Software Designer and Developer
VB.NET, C#, ASP.NET, VFP
|
|
|
|
|
What kind of handle - an HWND?
If so, there is no built in association between an HWND and an object.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi
Thanks for the reply.
Yes, it is an HWND. To make it more clearer, the handle is of a IE's statusbar32 object, for which I know only the handle, now I want to manipulate its objects and add/remove other Microsoft Common Controls so I was thinking of a way to cast that object to comctl's statusbarclass and then manipulate it instead of throwing Messages and creating pane window etc. using API calls as I am not very good in that.
Hope I was clearer to specify my scenario and you would have the solution to it.
Regards,
Mujtaba Panjwani
Tiger Softwares
Software Designer and Developer
VB.NET, C#, ASP.NET, VFP
|
|
|
|
|
MAP Tiger wrote: I know only the handle, now I want to manipulate its objects
You'll have to use APIs unless there's some other programming model
built into IE, which I wouldn't know
Mark
.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
AFAIK, you cannot do that. The best you can do is send messages to that handle. The object doesn't exist in the managed environment, so there's no way to cast it to be a managed object.
|
|
|
|
|
Hi
Thanks for the reply. Actually I already considered that but that seems very complicated as I am willing to create another control and append it to the control whose handle is known to me. i.e. add label control into statusbar control of IE.
I hope you have a solution to this.
Regards,
Mujtaba Panjwani
Tiger Softwares
Software Designer and Developer
VB.NET, C#, ASP.NET, VFP
|
|
|
|
|
There is no way to cast that handle to an object, .NET managed, COM, or otherwise. AFAIK, IE doesn't expose any method to do what you want.
|
|
|
|
|
Hello,
I'm trying to figure out how to display lines of text with more than one color. Seems like anytime I want to change text color for a word in a string, I can't, because all the text changes to that color.
If you need an example, consider something like AOL Instant Messenger. The person sending the message has their name in one color, and the receiver has a differently colored name.
Can the standard Textbox control pull this off? Short of that, is there some kind of custom control that can do this operation?
Thanks,
Michael Fritzius
|
|
|
|
|
|
I love one-liners. This was exactly what I was looking for.
Now to dissect it and toss the rest <evilsmiley>
Thanka you,
Michael Fritzius
|
|
|
|
|
Hi all:
I met a problem about communication between a Buisness layer and UI layer in a three-tier application.
In my project the UI layer invoke a method in Business layer named DoSomething(), DoSomething() method need to finish three tasks: (1)read data from database. (2)handle these data. (3)write them to excel file. However sometimes it need interact with the customer according to the data in step (2), so I should notify the UI layer to create related interation window. Here comes the question: how should I pass the message to UI layer?
One way to solve this problem is to use delegate, but if I use delegate I should know the method need to be invoked in UI layer first, that reqire Buisness layer import the UI layer dll, but you know that disobeys the import rule of a three-tier application.
What I need is the Business layer notify the UI layer: here we need the interaction with customer, just notify.
Can some one tell me the way to solve this question? Thanks.
|
|
|
|
|
Create an event in your Business Layer like AdditionalInformationRequested, which the BusinessLayer will invoke in step 2 if needed, and the UI can handle the event. You can have a custom EventArgs object that the UI will fill that will provide the information needed for the Business Layer to proceed with step 2.
Keep It Simple Stupid! (KISS)
|
|
|
|
|
|
Probably really simple, but I'm stuck and its been driving me nuts for the whole week.
The Problem.
Creating a dynamic number of Control.Image at runtime that holds various pictures load from a folder.
Each Image shares the same context menu
the problem is
when i click on one of the context Menus MenuItems say "enlarge" I have set it to all go the the same event handler
i.e = new system.eventhandler(enlarge_click)
how do i pass the argument of which image control I open the context menu from?
i.e
new system.eventhandler(enlarge_click uielement Image[x])
Thanks a lot
I looked into delegates but i must be be missing something, because i cant see how this would solve my problem.
thanks
|
|
|
|
|
If I am right, you have created some image objects. All of them have same clickevent handler and you want to identify which image was clicked. Right?
If I am right, then sender will have the information. Cast it to image type and get which image fired the event. You can use tag property to differentiate between the objects.
C isn't that hard: void (*(*f[])())() defines f as an array of unspecified size, of pointers to functions that return pointers to functions that return void
"Always program as if the person who will be maintaining your program is a violent psychopath that knows where you live." - Martin Golding
|
|
|
|
|
the enlarge_click method will need to have a parameter and then you can pass the image control to that parameter.
It would normally have two parameters, (object sender, EventArgs e) in which case you would pass Image(x), EventArgs.Empty
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
This works for me, but I am just an electrical engineer . By the way what is a Control.Image? What is the namespace?
WPF, Sorry . Same concept just use the ContextMenuOpening event instead of the clickevent.
…
private string SelectedControl = "";
…
public MainForm()
{
InitializeComponent();
…
foreach (ImageControl tmp in this.ImageControlList)
{
tmp.Click += new EventHandler(ClickEvent);
}
…
}
…
void ClickEvent(object sender, EventArgs e)
{
Control tmpCtrl = (Control)sender;
SelectedControl = tmpCtrl.Name;
}
…
private void mnuEnlarge_Click(object sender, EventArgs e)
{
}
ARon
modified on Friday, December 12, 2008 2:10 PM
|
|
|
|
|
Cool that answer gets me closers cheers
here my code so far. just testing with a messagebox and image.tag = I etc
I have it working like the above, but every time I right click the image control. choose the the menu item from the context menu , it just keeps returning the last issued image.tag and not the from the image i have called it from?
do i have to create a seperate contextmenu for each image control, i thougt that would be bloating it?
Thanks again, i owe you guys a pint of tennants
System.Windows.Controls.ContextMenu ImageCM = new System.Windows.Controls.ContextMenu();
System.Windows.Controls.MenuItem ImageMN1 = new System.Windows.Controls.MenuItem();
ImageCM.Items.Add(ImageMN1);
ImageMN1.Header = "Bring to Front";
Random rand = new Random();
BitmapImage[] bmp = new BitmapImage[100];
int I = 0;
//new System.Windows.RoutedEventHandler(front_Click);
//foreach (string d in Directory.GetDirectories(sDir))
//{
foreach (string f in Directory.GetFiles(@MyDir, "*.jpg"))
{
I = I + 1;
bmp[I] = new BitmapImage(new Uri(f));
ImageX[I] = new Image();
ImageX[I].Source = bmp[I];
ImageX[I].Height = 200;
ImageX[I].Width = 200;
ImageX[I].Tag = I;
ImageX[I].ContextMenu = ImageCM;
dragCanvas.Children.Add(ImageX[I]);
ImageX[I].SetValue(Canvas.LeftProperty, RandomPost(dragCanvas.ActualWidth - 10.0));
ImageX[I].SetValue(Canvas.TopProperty, RandomPost(dragCanvas.ActualHeight - 100.0));
//listBox1.Items.Add(f);
}
ImageMN1.Click += delegate { front_Click(ImageX[I].Tag); };
}
catch (System.Exception excpt)
{
Console.WriteLine(excpt.Message);
}
}
private void button2_Click(object sender, RoutedEventArgs e)
{
FolderBrowserDialog FD = new FolderBrowserDialog();
FD.RootFolder = Environment.SpecialFolder.Desktop;
FD.ShowDialog();
textBox1.Text = FD.SelectedPath;
DirSearch(textBox1.Text);
}
private double RandomPost(Double Boundry)
{
return Rand.NextDouble() * Boundry;
}
private void button1_Click_1(object sender, RoutedEventArgs e)
{
//Controls.ImpImage Test = new Controls.ImpImage();
//dragCanvas.Children.Add(Test);
}
public void front_Click(object sender)
{
System.Windows.MessageBox.Show(Convert.ToString(sender));
}
}
}
|
|
|
|
|
I hoped I helpled.
Comments.
This is out side the foeach loop so you only adding once.
ImageMN1.Click += delegate { front_Click(ImageX[I].Tag); };
You need a common method that each Image can call. Check out the ContextMenuOpeningEvent. Subscribe to each Images’ ContextMenuOpeningEvent and then if one of your Image Controls raises the event the function could assign sender to the ImageMN1.tag.
I do WinForm not WPF so I not sure how you subscribe to events. If it was WinForms I could do this.
foreach (string f in Directory.GetFiles(@MyDir, "*.jpg"))
{
...
ImageX[i].OnContextMenuOpening += new EventHandlee(MyOnContextMenuOpening);
...
}
...
void MyOnContextMenuOpening(ContextMenuEventArgs e)
{
this.ImageMN1.Tag = e.sender;
}
ARon
|
|
|
|
|
Hi All,
I think I know the answer to this question but I'll throw it out anyway.
I need a custom error handler for my application which can display exception information and also write exceptions to a log file. Currently, I'm using a static class which works fine but, since I can't declare an instance member in a static class, I'm not able to specify the log folder except to pass it to the static method each time it's called or read it from a config file each time it's needed.
I'm coming from Delphi where, if you needed a public object, you could create a non-static object in the project file (.dpr) and it would be visible throughout the application without having to pass it to each new object created.
Is there a way in C# to create an object, assign properties to it and use it throughout your application without having to pass it to each newly created object?
Thanks,
Steve
|
|
|
|
|
Not shure if this is what you want but you can declare an object pulbic shared.
The object can then be accessed from anywhere and is always the same one.
|
|
|
|
|
shared is a vb keyword - the same as static in c#
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|