|
We are able to connect and access emails from outlook, using out C# program.
However, we are getting this annoying popup from outlook asking for permissions.
Appreacite if someone could help supress this window.
Thanks in advance.
Srinivas
|
|
|
|
|
You have to use native code (or wrap the native code) for Extended MAPI, which is documented in the MSDN Library[^]. Any MAPI clients cause Outlook to prompt for permission because of malicious code abusing the API. There's no way to circumvent it, otherwise it wouldn't be very secure, would it?
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Thank you. Appreciate the response. It means we need to move to extended MAPI.
Srinivas
|
|
|
|
|
I have some problems in video broadcast. An error message popup from windows media player - "server not available".
Here are some of my code:
SERVER:
// Create a WMEncoder object.
WMEncoder Encoder = new WMEncoder();
// Retrieve an IWMEncBroadcast object.
IWMEncBroadcast BrdCst = Encoder.Broadcast;
// Set the port number.
BrdCst.set_PortNumber (WMENC_BROADCAST_PROTOCOL.WMENC_PROTOCOL_HTTP, 8080);
// Create an IWMEncSourceGroupCollection object.
SrcGrpColl = Encoder.SourceGroupCollection;
// Create an IWMEncSourceGroup object.
SrcGrp = SrcGrpColl.Add("SG_1");
// Create a video and an audio source object.
SrcAud = SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_AUDIO);
SrcVid = (IWMEncVideoSource)SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_VIDEO);
// Specify the path of the source file.
SrcAud.SetInput("C:\\temp/poor_mark.wmv", "", "");
SrcVid.SetInput("C:\\temp/poor_mark.wmv", "", "");
// Choose a profile from the collection.
IWMEncProfileCollection ProColl = Encoder.ProfileCollection;
IWMEncProfile Pro;
for (int i = 0; i < ProColl.Count; i++)
{
Pro = ProColl.Item(i);
//MessageBox.Show(Pro.Name);
if (Pro.Name == "Windows Media Video 8 for Local Area Network (256 Kbps)")
{
SrcGrp.set_Profile(Pro);
break;
}
}
// Start the encoding process
SrcGrp.PrepareToEncode(true);
Encoder.Start();
CLIENT:
Player.URL = "http://144.214.61.5:8080";
What're the problems. Please help.
|
|
|
|
|
I posted this before but it got buried. How would I go about manipulating files at the kernel level? I am trying to incorporate file hiding into a project and I can't seem to find any information on the subject. It would work much like Folder Lock which: "locks files on kernel level, Windows Explorer and even real DOS Mode, Works on Windows 2003/XP/2000/NT/Me/98 and all kinds of disk types like FAT16, FAT32, NTFS."
Here is a screen shot of the program folder and where the actual hidden files are located:
http://oxygine.com/Images/show.png
Can someone at least point me in the right direction?
|
|
|
|
|
Ask in C++ forum and post in MS newsgroups (maybe even the DDK section). File hiding and working with the kernel doesn't have much to do with C# anyway.
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
Anyone ever come across an algorithm for ensuring that text is always in a readable color distinct from it's background?
It seems simple on the surface but the more I get into it the more I hope I don't have to re-invent the wheel.
In the app I'm working on, people can select any ARGB colour for the background of an appointment element on a calendar as a type of quick STATUS type of thing. Unfortunately they can select black and since the text is black it vanishes. I was thinking of auto-adapting the text color to be readable depending upon the background ARGB but it's not as easy as it sounds.
Any thoughts appreciated.
|
|
|
|
|
|
Some time ago I made the same approach. This one is good except for some grey values.
r:128 g:128 b:128 -> convert -> r:127 g:127 b:127 --- not really much of a difference.
Another apporach is (sometimes also hard to read, but never impossible):
<br />
if (backColor.GetBrightness() > 0.5)<br />
foreColor = Color.Black;<br />
else<br />
foreColor = Color.White;<br />
|
|
|
|
|
What about simply adding up the RGB values and toggling between black and white foreground color depending on a certain threshold?
Something like this:
if (bgColor.R + bgColor.G + bgColor.B < 384)
fgColor = Color.White;
else
fgColor = Color.Black;
You can play with the threshold value or the weights of r,g and b (because the human eye is more sensitive to yellow-green than it is to blue, for example), but even with the very simple approach above I got good results.
mav
|
|
|
|
|
Thanks everyone, great ideas, it turned out to be simpler than my coding addled brain thought at the time.
We experimented with your ideas and this is the final algo.:
static public Color InvertColor(Color col)<br />
{ <br />
int nSourceColor=col.R + col.G + col.B;<br />
<br />
int r = 255 - col.R; <br />
int g = 255 - col.G; <br />
int b = 255 - col.B; <br />
<br />
int nInvertColor=r+g+b;<br />
<br />
Color invert;<br />
if(nSourceColor-nInvertColor< 28)<br />
invert=Color.White;<br />
else<br />
invert = Color.FromArgb(r,g,b); <br />
return invert;<br />
}
28 seemed to be a good threshold to ensure that grays didn't cancel each other out.
|
|
|
|
|
Could you just make PadButton.ImageProgperty reference Pic.Image?
|
|
|
|
|
I am a student developing a small application to make my job of maintening a few hundred staff computers a little easier. Part of the program opens an Internet Explorer window at a specific URL.
The problem I am running into is figuring out how to send a Javascript Command to this particular Internet Explorer Window (the equivalent of clicking a button for this page). I have searched this site and many others with no luck.
Any suggestions?
|
|
|
|
|
That's really vague.
What's sending javascript to a window? What kind of "program" are you talking about? How does your question at all relate to C# - which is what this forum is about.
Please be more verbose if you would like any help.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Sorry for the vagueness, I am writing the program in C#, which is why I'm asking for help in this forum. I have C# create a new instance of Internet Explorer and then want to interact with this instance, by sending it a javascript command.
<br />
public static void openBrowser(string url)<br />
{<br />
object o = null;<br />
<br />
SHDocVw.InternetExplorer ie = new SHDocVw.InternetExplorerClass();<br />
IWebBrowserApp wb = (IWebBrowserApp) ie;<br />
wb.Visible = true;<br />
<br />
wb.Navigate(url, ref o, ref o, ref o, ref o);<br />
}<br />
So, in this example, I could open up a page like the Office Updates Page and have it check for updates:
http://office.microsoft.com/search/redir.aspx?AssetID=ES790020331033&Origin=HH011710291033&CTT=5
Now, that page automatically scans, but then requires the user to press the "Agree and Start Installation" Button (equivalent of executing the javascript method StartInstallation()). Is there any way to execute this javascript command inside my program? Something like wb.JavaScript(string command)?
Hopefully that makes more sense
Chris
|
|
|
|
|
No you cannot send JScript (Microsoft's implementation, which is what IE uses) to the document, but you can walk the DOM (document object model) yourself. Reference the Microsoft.mshtml.dll assembly in your project (should've been installed with VS.NET) and cast the AxWebBrowser2 to IHTMLDocument2 , which is defined in the mshtml namespace.
From there it's a matter of casting objects to the interfaces that implement the methods, properties, or events you need. These members are named the same thing as in scripting because they are the objects that are scripted (script is merely an engine for using an object model, both in IE and Mozilla and many other applications).
For documentation on the HTML DOM, see the HTML and DHTML Reference[^] in the MSDN Library. There will be some differences since you'll be using an interop assembly (which proxies calls to the unmanaged COM server that is MSHTML, which the WebBrowser control (Internet Explorer) hosts for HTML rendering, etc.), but you shouldn't have any problems if you're familiar with the HTML DOM.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Thanks for the help Heath, however, I did find a method easier than what you suggested (for my purposes anyway). After loading the current site, I can "send" a javascript command to the IE instance by "navigating" to a javascript command. I've attached a modification of my earlier example.
<br />
public static void openBrowser(string url)<br />
{<br />
object o = null;<br />
<br />
SHDocVw.InternetExplorer ie = new SHDocVw.InternetExplorerClass();<br />
IWebBrowserApp wb = (IWebBrowserApp) ie;<br />
wb.Visible = true; <br />
wb.Navigate(url, ref o, ref o,ref o, ref o);<br />
<br />
while(wb.Busy) {}
Thread.Sleep(6000);
<br />
wb.Navigate("javascript:StartInstallation()", ref o, ref o, ref o, ref o);<br />
}<br />
Where, in this instance, my "url" is:
http://office.microsoft.com/search/redir.aspx?AssetID=ES790020331033&Origin=HH011710291033&CTT=5
Thanks again for the help, hope someone else finds this useful in the future.
Chris
|
|
|
|
|
I regularly have questions about what/which way is best, most efficient or ethical.
I want to develop applications that look, feel and work well from both a user and coding perspective.
If as an example I wanted to check if a value had changed, I would consider using something like:
<br />
<br />
int _CurrentValue;<br />
<br />
int CurrentValue<br />
{<br />
set{_CurrentValue = value;}<br />
get{return _CurrentValue;}<br />
}<br />
<br />
bool ValueChanged(int NewValue)<br />
{<br />
if (CurrentValue != NewValue)<br />
{<br />
return true;<br />
} else {<br />
return false;<br />
}<br />
}<br />
I was taught (many years ago) that a method should have one entry and one exit point wherever possible so to abide to that standard, the above could be written as:
<br />
bool ValueChanged(int NewValue)<br />
{<br />
bool result;<br />
if (CurrentValue != NewValue)<br />
{<br />
result = true;<br />
} else {<br />
result = false;<br />
}<br />
return result;<br />
}<br />
I was also taught however that you shouldn't use a variable where one was not needed and as the previous code demonstrated, only the programming style was different the result would be the same.
I was just hoping for comments as which method is best/more efficient.
Regards
Wayne Phipps
____________
Time is the greatest teacher... unfortunately, it kills all of its students
LearnVisualStudio.Net
|
|
|
|
|
his is the strangest thing I've ever seen. Why does 'ValueChanged' change the value ? How would someone looking at the API work this out ?
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
I was testing the values returned from a method and left that in by accident.
I agree, a method that checks if a property has changed should not change the property it was checking.
I have ammended the example as not to cause confusion.
Regards
Wayne Phipps
____________
Time is the greatest teacher... unfortunately, it kills all of its students
LearnVisualStudio.Net
|
|
|
|
|
In that case I have several comments:
1. If I were to write this, I'd just do something like return(CurrentValue == theValue);, there's no need for a bool variable
2. If I did have to use a variable, I'd make sure it had a default value. In cases like this, I'd start with something like bool retVal = false;, and just set it to true if the test passed later
3. You seem to be asking if the current value != a specific value. I'd do this in the calling code: if (myClass.CurrentVale != theValue) instead of adding a method needlessly.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Thanks for your comments, they all make sense.
However I wrote a simple method to demonstrate multiple and single exit points from the method not the simple evaluation of an integer.
Some methods become much more complicated when using nested if or switch statements and it appears very easy to end up with multiple exit points which make the method difficult to follow and debug.
I try to avoid this wherever possible but just wanted other opinions on best practices.
Regards
Wayne Phipps
____________
Time is the greatest teacher... unfortunately, it kills all of its students
LearnVisualStudio.Net
|
|
|
|
|
OK, in that case, I'd always create the return value first, default it to the worst case scenario ( and never create a variable that I don't assign to ), and then I'd prefer switch to if statements where-ever possible, and if my switch statements are getting too big, think about if I can use OO or at least extra levels of call stack depth to factor some of that out.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
HI.Can someone tell me where can I find the code of program which calculates angle between 2 vectors in 2D. Thanx in forward
|
|
|
|
|
Who can tell you where to find stuff? Yahoo can[^] and Google can[^].
How hard is it to type "calculate angle between 2 vectors" in Yahoo or Google?
Long live !
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|