|
I'm an idiot! I recall stepping through the debugger on a recent project and I could have sworn a 1 o'clock appointment record was coming up with an hour value of 1 rather than 13, but sure enough, I just built a simple desktop app to test it again and it came up with 13 on a 1:00 pm. I had just ASSumed that there was someething I was missing to determine meridian. Oh well. Here's to assuming!! Thanks. I appreciate you answering a stupid question.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
Hi, I'm looking through a lot of COM interfaces with a mind to reproduce them in C#, but i'd idealy like a handful that are simple enough to implement without going into complex background structures.
If anyone knows 6 or so objects, i'll have a play with them.
Thanks
Cata
|
|
|
|
|
Look in the Shell Programming section of the Platform SDK. There's TONS of easy and useful interfaces in there that you can use.
Other important often easy ones are like IPersistFile , IPersistStream , and other IPersist* interfaces.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thanks m8
I've downloaded the Windows SDK, but i can't find the shell section.
There appears to be no documentation, although I've found what appears to be the shell section in the following path:
X:\Microsoft SDK\Samples\winui\Shell
I've found a few examples, but there isn't much documentation. Am I in the right place?
Additionaly, how do i access the windows help files associated with the SDK? Are they automaticaly linked to VS.net? Or do i have to tie them in manualy?
Additionaly, .NET can't build C. I'm looking for a microsoft certified C compiler, but they don't have any listed on their site. They are either C++, or .NET.
Do i even need to compile them? Or are they all already present in the windows directory?
Cheers
Cata
|
|
|
|
|
Why are you looking in directories? You're supposed to be looking in the help files which - at least for the core that should include this stuff - is a required download. Click on Start->Programs->Microsoft Platform SDK Month Year and you'll see the help files. You don't need to build anything.
And "certified C compiler"? You do realize that VS.NET includes the C/C++ compiler - it's the same compiler that builds mixed mode and pure .NET assemblies when the /clr switch is used. The PSDK also includes the compiler and linker in the bin directory, as is the common place for binaries in SDKs and in *nix systems. Again, though, you don't need to build anything. Just look in help for information.
If you don't have all the right help files, click on the Update link in that directory and install all the relevent documentation.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
ROFL! OMG! I didn't even know it was in the start menu!
Heh... I'm not stupid... really... just 99% of what I do is mistakes :P
So, how does .NET compile C? I mean, you don't get C Projects? Does it just compile C with C++ then?
And no, I never knew
Cata
|
|
|
|
|
Ok mate, I've got it. Thanks for the pointers.
I'll see how it goes from here.
I really love learning programming.
I'm such a geek.
Peace
Cata
|
|
|
|
|
I'm down a little program that shows image sequences and I'm having a hard time with error handling, i have an xml settings file that i first want to load and when that has loaded and only if it has been successfull do I want the program to continue so heres the code at it's current state.
but it doesn't seem to be picking up if the file really exists or not, and I usually get a nullrefrence exeption, so how's the best way to check if the file exists?
private bool readXML()
{
bool returnValue;
doc = new XmlDocument();
if(File.Exists(xmlSettings))
{
doc.Load(xmlSettings);
nodeReader = new XmlNodeReader(doc);
nodeReader.MoveToContent();
title = nodeReader.GetAttribute("title");
name = nodeReader.GetAttribute("name");
totalframes = Convert.ToInt32(nodeReader.GetAttribute("totalframes"))-1;
rotate = Convert.ToInt32(nodeReader.GetAttribute("rotate"));
reverse = Convert.ToBoolean(nodeReader.GetAttribute("reverse"));
autoplay = Convert.ToBoolean(nodeReader.GetAttribute("autoplay"));
play_ms = Convert.ToInt32(nodeReader.GetAttribute("playms"));
autoresume = Convert.ToBoolean(nodeReader.GetAttribute("autoresume"));
autoresume_ms = Convert.ToInt32(nodeReader.GetAttribute("autoresumems"));
if (nodeReader != null)
{
nodeReader.Close();
}
returnValue = true;
}
else
{
// If any errors are found Exit Application
DialogResult result;
result = MessageBox.Show(this, "\nError: settings.xml Missing!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
if(result == DialogResult.OK)
{
Application.Exit();
}
returnValue = false;
}
return returnValue;
}
|
|
|
|
|
What does the path look like for xmlSettings ? The code to check if the file exists is correct, however you need to check the path, is it absolute or relative?
- Nick Parker My Blog
|
|
|
|
|
It's as simple as xmlSettings = "settings.xml";
how would the path look if a wanted to place the file in a folder in the program folder?
and a want to keep it relative.
|
|
|
|
|
Well, typically this will work (i.e.; xmlSettings = "settings.xml"; ), however say you want to place the file two directories above the executing file path you could simply do: @"..\..\settings.xml" . I have seen an instance where when using an open file dialog can cause the selected path (even though not related to your particular file) being appended as the path infront of "settings.xml" when you call the Load(..) method. You might check into something such as Application.ExecutablePath so that you know you are always getting the absolute path to your file.
- Nick Parker My Blog
|
|
|
|
|
maybe you better get the application path first, as the working directory is not always equal to it ...
something like string path = new FileInfo(Process.GetCurrentProcess().MainModule.FileName).Path
greetz
*Niels Penneman*
Software/Dev Site Personal Site
|
|
|
|
|
Does anyone know if I can change my MSN nickname with .NET code in an existing MSN Messenger 6 session?
I could do it by communicating with the server but I want to keep my Messenger session running...
I have seen somebody doing it with VB5 or 6 but the guy doesn't seem to have any website or e-mail address and VBDE could not decompile the executable.
I know the application does something with API functions, to open the Options dialog, change the name, close it. It's rather annoying and I want to know if any other methods exist?
Note: I already tried the API, but the property MyFriendlyName is not writable...
greetz
niels penneman
|
|
|
|
|
|
Hi guys.
Is there any way to draw someting on a panel, then draw something above it
and treat those layers separately?
I mean, I don't wanna redraw the first layer, when the second changes,
neither the second when the first does, because it may takes quiet much time...
I've searched about layers in msdn, but found nothing.
Tried to set the second panel's backcolor transparent, but
even in this case, it does cover the dynamic drawing on the first panel
MS Visual Studio.NET 2003
C#
|
|
|
|
|
"Is there any way to draw someting on a panel, then draw something above it
and treat those layers separately?"
Well, the panel isn't an important thing...
MS Visual Studio.NET 2003
C#
|
|
|
|
|
You don't need different controls (not layers, that's a different matter) to paint different portions. All you need to do is paint the invalidated regions which are passed to you in the PaintEventArgs of the Paint event (for code handling other controls) or the OnPaint method (for controls extending a control to override). For some things, this isn't always possible or necessary (like for a button, very little needs to be repainted so the whole thing is typically repainted). Just use the PaintEventArgs.ClipRectangle to figure out which regions you need to repaint.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
hi
can u guys tell me how i can start another application, for example word?
after clicking a button it should start
thx
|
|
|
|
|
Take a look at System.Diagnostics Namespace
System.Diagnostics.Process vprocess = new System.Diagnostics.Process()
vprocess.Start("WINWORD.EXE")
Free your mind...
|
|
|
|
|
Or simply Process.Start (a static method - an instance of Process isn't necessary).
Also, this question has been asked MANY times in the past and even once today just shortly before you asked. Please search the comments before posting.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
How many times have you answered this question ???
Free your mind...
|
|
|
|
|
Currently, I'm fetching page IDs from an XML file.
I want to write code that does the following:
1- Add these IDs to an array? arraylist? some kind of list?
2- Start 5 threads that will access this list simultaneously and download a page from the internet (for example http://www.page.com?pageid=ID) provided that each page should be downloaded only once.
3- These pages are saved on disk.
What happens in case of a powercut? How can I know which page did I stop at?
Thank you very much.
Sammy
"A good friend, is like a good book: the inside is better than the cover..."
|
|
|
|
|
1- Create a global variable to give the pages to download and create 5 other variables to specify which page a tread is currently downloading.
2- Each time a tread finishes to download a page, it increases the global variable by one and sets its own variable to the page it curently downloads.
5- Save on a file, all the 5 variables and the gloabal one. In the case of power goes down, you will simply resume the 5 pages and will continue with the gloabl variable.
Ex:
a,b,c,d,e are the current location of download of all the treads.
g is the gloable variable,
1,2,3 ... 20 are pages to download.
Stuff in bold is already downloaded.
Thus you get:
1 2 3a 4 5 6b 5 7c 8 9 10 11d 12e 13g 14 15
In the case If power goes down, will will simply have to download pages 3,6,7,11,12 and then to continue with pages 13+.
|
|
|
|
|
profoundwhispers wrote:
What happens in case of a powercut?
What do you mean a "powercut"? If you mean loss of power, the only way you can know which threads didn't finish is to use a file to persist each thread's URL that they're working on and whether or not they've finished. This is common in many caching situations.
As far as using threads, using an array list isn't really necessary because you'll have to pass an index to each thread for them to determine which one to work on. Instead, read each ID from the XML file like you're doing and use asynchronous calls to download the file, like HttpWebRequest.BeginGetResponse . You'll pass an AsyncCallback that can write to that cache file I mentioned. If you track how many IDs you read and then keep a counter for how many times the callback was executed (be sure to use locking to increment the counter to make sure, for instance using the lock keyword) you can know which ID was last (by checking the IAsyncResult.AsyncState , which you would pass into HttpWebRequest.BeginGetResponse - this is used to pass custom data from the async call to the callback for cases such as this).
You could also devise a similar situation using the ThreadPool.QueueUserWorkItem , which also uses a delegate to start in a new thread and accepts a state object (which can be a single object of any type, including an array, list, or collection of other objects). The simple Thread class doesn't now allow such state variables and there is additional benefits to using a ThreadPool over simple threads. (See the SDK documentation for details.)
I would recommend asynchronous calls, though. The functionality is provided so you might as well use it. Also keep in mind that if you devise your own system using delegates, that the C# compilers (and probably others) automatically add asynchronous versions of the Delegate.Invoke function so you can use delegates asynchronously, too.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi.
I need to have custom save/open file dialogs but
since the .NET ones are sealed it can't be inherited, neither can the FileDialog class from which they inherit. Does anyone know of a good approach to creating a custom dialog for this purpose? What I need is something as simple as an
additional textfield rightmost in the dialog.
I would really really(!!) want to use the functionality in the available controls. I have come up with two approaches, of which the second I really don't know how to do.. =)
either (1) create a new control which aggregates a SaveFileDialog control for some functionality (like opening the stream to file, etc.)
or (2) make it 2 separate windows that stay next to each other, and remove the window decoration.
any more suggestions? Has anyone done this? Please let me know if you think you can help.
|
|
|
|