|
Thanks. The project I am working inherits few properties from Windows control.
The User can create a report design of his own. so the controls will have the funcition similar to windows control.
When you drag drop a control from Windows forms. A rubberband like highlight will be given to the control.This will be done easily in MFC using crectracker.
In .NET I have dynamically calculated the corners for each control and with graphics has drawn rectangles to the edges. this provides a highlighted control.
Happy Coding
MankayarKarasi
|
|
|
|
|
I'm a budding programmer looking for vital threads. Learning language and using it are 2 different things although one MUST receive it before they can express it. Grasping the basic concepts of OOD and the languages (VB,C#,C++(concepts)), learning the system classes, .net and language functional constructs (gdi,reflection,diagnostics), etc. etc. , What is(are), the single best tools to use to convert ideas into code?
1. UML??
2. Keep reading??
3. Keep doing??
4. Usage of interfaces, events(delegates)??
5. A pad and a pencil??
Any thoughts to help steer me into coding effective design, architecture, OUTPUT!!! .....TIPS .. pLeAsE
Trane Lives (that's Coltrane)
THANX
ds
|
|
|
|
|
Hi
Your question is very trivial . only i can say is that keep doing practice that you read
Naveen
|
|
|
|
|
<per> Your question is very trivial . only i can say is that keep doing practice that you read
I do......
Let me drill down...
One of my problems is class contruction.
a. How many classes
b. How to lay out an effective model of structure and functionality per the project concept
I become a victim of endless trial and error
If I was to look at your development environment, what would I see. What tools and in what order do you apply them.
eg. Let's say I want to program a 'Code Project' Presentation Manager.
a. Gathers All articles (local)
b. Allows for thumbnail creation(any size)
c. Allows article rating system and sorting
d. Profiles words in all article, datamanaging for searching features
e. Tracking of article and user preferences
f. User Interface Controls for thumbnail generator
Basically I'm gather thoughts and ideas and laying them down in text
Must I lay it down architecturally before beginning to code.
Does Everyone in the 'KNOW' do it that way
What are the individual styles of coding that are acceptable
At the minimum, what is necessary
How much is too much
Just looking for advice
Thanx
ds
|
|
|
|
|
It depends on if it is a simple weekend project or something on a larger scale.
After over two decades of development, I usually start of drafting out a spec on what the project will require. A simple list (I usually use MS Word in Outline mode). Then I go to each of these requirements and break them down (using nesting in Word's outlines)and determine how they will be structured and how there structure will relate to the other requirements.
If it is a database based application, I will probably use Viso and layout the database.
After that, I start to construct usually with a white dry erase board first. Get all the flow laid out and implement it. Typically, in a database n-tier application, I will start with the lower tiers and work my way up. Usually, I will build tests and most functionality in each tier progrmatically to save time later chasing bugs throught he tiers.
I personaly never got my head wrapped around UML (never taken the time), so I do not bother. I have heard though, that there are some nice tools out there to help.
For web based applications it is much similar, but I draft out all the web page screens in the specs part so that I have an idea of what everything will look like before I start.
Rocky <><
www.HintsAndTips.com
www.GotTheAnswerToSpam.com
|
|
|
|
|
Hi,
I've created a Form that I use to print a receipt (prints Form controls).
I've placed the code
this.printDocument1.Print();
in the FormLoad Event because I want the Form to print right away. I also what the Form to close right away. It seems the only place that caused the Form to close right away was putting "this.Close()" in the FormPaint event. Is there a better way to do this? I would like to set the Form Opacity to "0", but then it stops my Close on the FormPaint.
Thanks,
Ron
|
|
|
|
|
Yes, there is. Your putting the print code in the wrong form. If this form is for nothing but printing, leave the printing code in the form that creates it. FormLoad should only be used for initializing the forms code and its look. You can't close the form in the FormLoad event, because, technically, it hasn't been created yet. Do something like this:
Form2 frmPrint = new Form2;
frmPrint.printDocument1.Print();
frmPrint = null;
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks Dave!
Works great!
I'm new to programming so it took me a few minutes to realize that I needed to move my "assigning values to controls" to printDocument1_PrintPage event from the OnLoadForm event. The values are passed from Form1.
Ron
|
|
|
|
|
I have a need to write a service that deals with custom incoming/outgoing emails. I'm using the MS SMTP service on my server, without POP3 support.
The plan is to pick up incoming emails from the SMTP server's drop folder, process the contents, and if necessary create a new outbound message and drop it in the SMTP server's pickup folder.
The problem I'm having is that System.Web.Mail.MailMessage doesn't appear to have any methods that I can use to either create a MailMessage object from an existing file, nor does it have a method that will allow me to dynamically create an outgoing message and drop it into the pickup folder to be delivered.
So far I've had no luck searching the web for 3rd party open-source libraries that perform these functions, either. (Actually, I haven't found any at all, not even commercial.)
For my specific application, I don't need MIME support, or even HTML support. It's all plain text. What I do need is the ability to load a file into a mail object and have the headers automatically parsed out into a collection, with property access to From, To, Subject, etc.
Any suggestions?
Grim (aka Toby) MCDBA, MCSD, MCP+SB
SELECT * FROM user WHERE clue IS NOT NULL
GO
(0 row(s) affected)
|
|
|
|
|
Write one yourself; it's quite simple. You can read about SMTP in RFC 228[^], but it's really quite simple. SMTP headers use a Key: Value pair on separate lines. Headers that span multiple lines place whitespace before the Value (thus you should deduce that headers begin at the beginning of a line).
So, you could easily create a Hashtable and a TextReader derivative on the SMTP mail message. Call ReadLine and parse the text. If the line begins with white space, concatenate the line with the previous value. Put the key/value pairs into the Hashtable . Call ReadLine until you encounter a \r\n pair on a line by itself.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Umm, are you sure you don't mean RFC 821[^]? 228 seems to be a one-line update to RFC 70.
Anywho. I had considered writing it myself, but I was hoping to save a little time by find an existing one. I also need to generate outgoing e-mails as a text stream that I can save to file. I'd like to have a MailMessage class that automatically creates the other necessary headers that I don't want to have to manually provide.
See, that's the problem. I'm too much of a perfectionist when I do my own stuff. I suffer from "Speculative Generality" syndrome.
Grim (aka Toby) MCDBA, MCSD, MCP+SB
SELECT * FROM user WHERE clue IS NOT NULL
GO
(0 row(s) affected)
|
|
|
|
|
Yes, RFC 821. Sorry. I was trying to recall it from memory where I've packed several dozen RFCs. Numbers are just too hard to remember.
I'm also a perfectionist when it comes to extensibility and modularity, but honestly SMTP headers are easy to parse. It's much easier than parsing MIME headers (which really isn't that hard). That simple algorithm I gave you would work nicely.
You could check out IP!Works[^], though. They've been doing library development for IP-related technology for quite some time and are pretty good products. They do have SMTP and MIME components, as well as many, many other components for all your IP-related needs (SMTP, HTTP, POP, IMAP, SSH, etc.).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks, Heath. I'll check out IP!Works. I also stumbled across Chilkat Software[^], which has a .Net mail library. (Now I'm wondering why I didn't run across these with all the searching I was doing yesterday. O.o)
And finally, I'll consider writing my own if none of these commercial packages seem worth the money. (Or, god forbid, simply don't allow me to create new mails and save to file.)
If you're wondering why save to file is such a big deal, I'm having trouble with my setup getting the MSSMTP service to send mail out, although it receives fine. The only way I've been able to get it to send so far is to drop files in the pickup folder. :-/ Some kind of problem with running a 3rd party mail server on the same machine (different IP address.)
Grim (aka Toby) MCDBA, MCSD, MCP+SB
SELECT * FROM user WHERE clue IS NOT NULL
GO
(0 row(s) affected)
|
|
|
|
|
Most often than not, the problem is relaying. If your SMTP service is trying to send mail out address from a specific domain and the SMTP server to which you're communicating is not set up to rely for that domain, then you won't be able to send mail. The best way is to make sure that DNS resolves correctly on the machine with Microsoft SMTP Service installed and do not forward to another SMTP server, but send mail directly to the recipient's SMTP server. If, for corporate reasons, you have to relay mail, make sure the corporate SMTP server(s) has/have relaying set up for your IP address and/or domain from which you're sending.
You should check out http://support.microsoft.com[^] or send mail through another SMTP service if you can't get yours fixed. Your current hack is just that - a hack. I wouldn't recommend using it in production. Fixing the SMTP service is your best option.
Also keep in mind that if you're using the System.Web.Mail.SmtpMail class, this actually uses CDO. Any CDO server - Microsoft Virtual SMTP Services, Microsoft Exchange, even Microsoft Outlook when configured correctly - will be used and only one can be the primary CDO service (it's a registered COM server). This is similar in concept to MAPI, except that MAPI is a client API for client programs, where CDO is more of a service (they're still both APIs for COM servers).
Not sure exactly what you're problem is, but I hope this helps.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I had the SMTP service set up to relay for the loopback address. I wasn't using any objects or scripting languages to test with, I was just telnetting into the service (telnet localhost 25) and typing in the commands manually.
There error I kept getting was "Unable to deliver the message because the destination address was misconfigured as a mail loop." So far I've had no luck deciphering what this error message actually means. :-/
I've since changed the configuration so that the server monitors only 1 IP address, and does not respond on the loopback.
I'm technically running 3 SMTP services on this system. I have an SMTP proxy running on my main e-mail IP address, on port 25. I have my main mail server running on the same IP address, on a different port. All mail to this server comes through the proxy (AV checks, DNSBL, Bayesian filtering, etc.)
The MSSMTP service watches a different IP address, and is not used in conjunction with any POP3 or other service. I have a custom program that picks up the incoming messages from the Drop folder and processes them. I'm using this SMTP service sort of as a message queuing system for distributed communications.
The problem is, I have to be able to send messages back to the other application via SMTP. I can't set the proxy to relay, because it's not a real SMTP service, it just relays to the other mail server. The other mail server won't allow me to "watch" port 25 on the loopback and the other port on it's primary IP address. It watches the same port on all watched addresses.
I'm just trying to avoid having to install a 4th SMTP-related service on the machine. I have access to a relay server, but I'm trying to avoid using it, as I want to have control over the retry intervals if initial delivery fails.
Grim (aka Toby) MCDBA, MCSD, MCP+SB
SELECT * FROM user WHERE clue IS NOT NULL
GO
(0 row(s) affected)
|
|
|
|
|
Hi,
I am wondering is it possible for a c# app to capture and intercept print jobs sent to the printer from other applications such as internet explorer or word. I then need to be able to decide on whether to allow the print job to reach the printer or to cancel it. Basically I suppose I need to be able to "spy" on the "channel" to the printer and then to stop or allow print jobs to process. Any ideas or pointers would be great,
Cheers,
John
|
|
|
|
|
I think you can try to use Hook.
|
|
|
|
|
Hi,
thanks for the lead. I've just had a look around and cant find anything about hooks and printer ports. I havent any experience with hooks. Has anyone does this before in c#?
John
|
|
|
|
|
No. It's handled by security on a per user basis. There is no large-scale, consumer reason to have application level control over the printers. There may be one or two customers of Windows who might need that kind of control, but not enough to make it into the Win32 API.
Also, like I just said, there is no API functionality to do what you want. There are no hooks for printing and job control. Just monitoring the queue won't give you the information you need either. There is no way to know from what application the job came from. Some apps, like Word, will put their application title in the name of the job, but Excel doesn't.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi Dave. I dont really need to know where to print jobs are coming from, I just need to be able to intercept them before they are printed and allow or cancel them. Its basically to control what gets printed and what doesnt.
John
|
|
|
|
|
Someone else posted an idea to attach a system wide message hook. There problem with it is that it will allow you to see the WM_PRINT message, but you can't stop it from happening.
Now, you could put the printers on hold and just monitor the print queues, determine wheather or not to allow the job, then just cancel it or release the printer to print, then put it back on hold.
The problem is your app will have to run as a service with Admin or Power User priveledges in order to put the printers on hold.
There is also another problem, how are you going to determine wheather or not the job should be allowed? What are the requirements for an allowable job vs. not allowable? What mechanism are you going to use to make this determination? You could peak into the job, but all it will show you is the printer language, which will vary from printer to printer, even model to model.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
basically, the print is allowed if the user has enough credit on their account (just a database entry). If there isnt sufficient credit then the print job will be cancelled. It should be all done automatically when the user goes to print. Their balance should be checked against the amount of sheets they are printing, and if there is sufficient balance then the print job can happen, otherwise its stopped.
Regards,
John
|
|
|
|
|
John,
I have no experience about it, but I think you can use "messaging hook provider/processor" to deal with the wm_print Window's message.
There are some articles about that in the help file with the vs.net.
good luck.
|
|
|
|
|
I'm using httpwebresponse and a StringBuilder to return a stream that originates as a file with the .txt suffix (My download code converts the html tags in this text file to well formed XHTML tags). The contents of the file contain html tags and the data in those tags.
eg.,
<TABLE cellSpacing=0 cellPadding=0 width="100%" align=center border=0>
<TBODY>
<TR>
<TD width="48%"></TD>
<TD vAlign=bottom width="5%"><FONT
face="Times New Roman" size=1><B> Howdy!! </B></FONT></TD>
<TD width="47%"></TD></TR>
</TBODY></TABLE>
When I copy, paste and save the returned file from the textbox (txtOutput)with a .html extension, the file opens as a normal looking html file, but when I try to save the stream with an html suffix with the following code, something changes in the file and instead of opening as a normal html file, I instead get what looks like a text file with strikethrough font in numerous places...eg., <strike>Howdy !!</strike>
// Save File-----------------------------------
StreamWriter writer = new StreamWriter(sec_save);
writer.WriteLine(txtOutput.Text.ToString());
writer.Close();
The StreamWriter gets its input from a textbox (txtOutput) that has been populated by a StringBuilder (the html tags in the original text file have actually been converted to an XHTML file, ie well-formed html tags.)
I can supply the code that converts the html to xhtml if needed...
Basically, I'm just trying to find a way to save the stream as an .html file and have it open as any other html file would open, without the strikethroughs.
A different way to save the stream perhaps?
Thanks,
Paul
|
|
|
|
|
I have zonealarm installed and of course everyone knows, the vsmon services is basically the brains behind the outfit...anyways when I look at the services applet and go to options on vsmon almost everything is grayed out...so I went into the registry at
hkey_local_machine\system\currentcontrolset\services\vsmon\security
And in there, is a key called Security...It is a binary key and has a whole bunch of hex written in it. I imagine this is what is causing the services applet in XP to gray out all the configuration for it. Is there a way I can find out how to write my own Security reg keys like this for services I write in c# to keep people from tampering, etc?
P.S. I've already "googled" the matter lol but maybe someone knows the answer elsewhere. Thanks in advance.
|
|
|
|
|