|
yes,
u got my point.now plz helpme and give me the right path.
my code is like this.and in this code after print dialog when a person clicks ok then my dialog is comming and asking for username and password.means m able to block the job after going to the print spool.help me that how i will detect before going to the print spool.
private void timer1_Tick(object sender, EventArgs e)
{
PrintServer myPrintServer = new PrintServer(@"HP LaserJet P2010 Series PCL 5e");
PrintQueueCollection myPrintQueues = myPrintServer.GetPrintQueues();
foreach (PrintQueue pq in myPrintQueues)
{
pq.Refresh();
PrintJobInfoCollection jobs = pq.GetPrintJobInfoCollection();
foreach (PrintSystemJobInfo job in jobs)
{
if (job.Submitter == "gyana.manjarikar")
{
job.Pause();
}
if (true)
{
//MessageBox.Show(job.Name.ToString());
this.Show();
}
else
this.Hide();
}
}
}
private void btnlogin_Click(object sender, EventArgs e)
{
int copies=10;
this.Opacity = 50;
PrintServer myPrintServer = new PrintServer(@"HP LaserJet P2010 Series PCL 5e");
PrintQueueCollection myPrintQueues = myPrintServer.GetPrintQueues();
foreach (PrintQueue pq in myPrintQueues)
{
pq.Refresh();
PrintJobInfoCollection jobs = pq.GetPrintJobInfoCollection();
foreach (PrintSystemJobInfo job in jobs)
{
//if (txtUserName.Text == "aaa" && txtPassword.Text == "bbb" && copies <= 10)
//{
// job.Restart();
//}
if (job.Submitter == "gyana.manjarikar")
{
if (txtUserName.Text == "aa" && txtPassword.Text == "bb" && copies <= 10)
{
timer1.Dispose();
job.Resume();
this.Hide();
}
else
{
lblErrormsg.Text = "Invalid UserName Or Password";
}
}
else
{
this.Show();
timer1.Start();
lblErrormsg.Visible = true;
lblErrormsg.Text = "Invalid User";
}
//if (job.Submitter == "")
//{
// job.Pause();
//}
//else
//{
// lblErrormsg.Visible = true;
// lblErrormsg.Text = "Invalid User";
//}
//if ( txtUserName.Text == "aa" && txtPassword.Text == "bb" )
//{
// job.Pause();
//}
//else
//{
// lblErrormsg.Visible = true;
// lblErrormsg.Text = "Invalid User";
//}
}
}
}
private void btncancel_Click(object sender, EventArgs e)
{
this.Opacity = 50;
this.Hide();
PrintServer myPrintServer = new PrintServer(@"HP LaserJet P2010 Series PCL 5e");
PrintQueueCollection myPrintQueues = myPrintServer.GetPrintQueues();
foreach (PrintQueue pq in myPrintQueues)
{
pq.Refresh();
PrintJobInfoCollection jobs = pq.GetPrintJobInfoCollection();
foreach (PrintSystemJobInfo job in jobs)
{
if (job.Submitter == "gyana.manjarikar")
{
job.Cancel();
}
}// end for each print job
}
}
private void Form1_Load(object sender, EventArgs e)
{
this.Opacity =100;
}
}
}
plz help me that where i will change the code and what i will change .
How i will design a a form in windows service to print a document.
|
|
|
|
|
All right, I tried to make it simple for you, I pointed out that I have no idea how you are going to achieve this and even called you an idiot for attempting it. And still you come back, this time with code. This proves you are not a troll, it does not change the fact that this is a stupid requirement.
I won't help you as I have better things to do, theres an ant crawling up the wall, that will be more interesting than debating this idiotic subject with you.
Good luck pal, you're going to need it!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I recommend either McAfee or John's kerosene.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
You're not going to be able to do this using all-.NET code. I don't know the specifics of how to do it, but you're going to have to basically replace the system's print dialog to do what you want. This is FAR from a trivial task. You'll need very advanced knowledge of Windows internals and COM programming, along with some C++.
Why? Because Windows Security does not have any facilities in it to do what you want. Assigning a seperate password to a resource is a very inefficient method of trying to protect that resource. Personally, I think you're wasting your time trying to do this. Windows Security is made in such a way that users have a single sign-on and don't have to worry about "yet another password" to remember to access any resource. The permissions to users and groups of users are assigned to the user based on their login token, this includes accessing shared devices such as printers.
Your current method does not stop a print job from running. Since the job is already being spooled when your code figures out it is there, the print job has already started happening. The only thing you can do is pause the printer, which pauses ALL print jobs going to it, even the ones by other users who have supposedly put in the proper password. This is easily defeated because the user can just resume the printer to get around your password.
|
|
|
|
|
thanks lot for ur great response.i will try to do.
How i will design a a form in windows service to print a document.
|
|
|
|
|
manjari kar wrote: How i will design a a form in windows service
You don't. Services should not expose a user interface.
|
|
|
|
|
any ways can i customise the print dialog of the system,means i want to replace comdlg32.dll to system 32 or win 32.by invoking.or if any other method to overriding comdlg32.dll then plz tell me.nw for this requirement i m thinking to customise the stanard print dialog .so how i will do.plz help me.
How i will design a a form in windows service to print a document.
|
|
|
|
|
manjari kar wrote: i want to replace comdlg32.dll
You can't do that. The next time anyone installs a piece of software or MS releases a patch, it'll overwrite or replace what you put in.
manjari kar wrote: any ways can i customise the print dialog of the system
Again, the answer does not change. I've already given you the list of skills required to replace the dialog AND/OR alter the existing one. This is an extremely advanced topic, not for beginners.
|
|
|
|
|
see,in comdlg32.dll-1538-1033-print dialog pop up is comming.i inserted there controls for username and password in no of copies panel.i installed the resource hacker which used to customise the dialogs of comdlg32.dll.then i used one software for disable the windows file protection ,used inuse for replacing the customise comdlg32.dll and used move on boot for reboot.but it didnt replce the dll.tell me the process how to customise the windows xp print dialog.plz help me in any ways.This requirement is mandatory for me.help me.
How i will design a a form in windows service to print a document.
|
|
|
|
|
manjari kar wrote: see,in comdlg32.dll-1538-1033-print dialog pop up is comming.i inserted there controls for username and password in no of copies panel.i installed the resource hacker which used to customise the dialogs of comdlg32.dll.then i used one software for disable the windows file protection ,used inuse for replacing the customise comdlg32.dll and used move on boot for reboot.but it didnt replce the dll
You are entirely on your own with this one. Putting in a username and password is just making things more complicated than they need to be. There is no legit reason to do this and it's easily defeatable. You are doing things that noone does. This is what makes it entirely on your shoulders now...
|
|
|
|
|
ok,i understud ur point but what can i do.I already told my P.M that its not possible to do this.in one application only i can import the dlls and override it.but in xp how to modify.but he told priviously our people hv done this one using vb6.0.why u r unable this one in .net.so what should i will do.i m trying my best.thats why m askin.
the last way i m thinking that whatever i modified inprint dialog i saved in c drive then i will put windows xp cd to restart setup and i want to use recovery console for repair using r. and there i will give the path of modified one.so is it possible way to do this or not plz suggest me.
thanks,
regards,
manjari.
How i will design a a form in windows service to print a document.
|
|
|
|
|
manjari kar wrote: but he told priviously our people hv done this one using vb6.0.
Then he's going to have to prove it. Doing it in VB6 alone isn't possible. Personally, I think he's blowing smoke out his ass.
|
|
|
|
|
thanks for support.i m totally fedup in this project.i want to leave this company.nw m searching outside.again thanks for support.take care.bye.
How i will design a a form in windows service to print a document.
|
|
|
|
|
personally something i m telling u that i think humanity is there in this world.in this company my p.m has assigned this project single me and he told you should takecare of entire project and he didnt give me any support or any idea of this.totally i m doing identity on this. 2 to 3 times i told it is not possible to modify in windows xp.but again n again he told u r totally unable to do this .what u know about .net.next month i will think about u.so nw m thinking before thinking about me ,i will think about this company.nw i hv one offer in another company.m thinking to leave this one.and one more thing ur suggetions really impressed me and i think u r the only one supporter for me in this matter.
this is my mail id-manjari10i@gmail.com.if u want mail me.keep touch with me.
thanks,
regards,
manjari
How i will design a a form in windows service to print a document.
|
|
|
|
|
Hi everyone
Pleasae can someone help me. I have created a custom ribbon and am trying to implement it in an ExcaleAddIn and have created all the neccessary xml for it along with it's events as follows:
<pre><?xml version="1.0" encoding="UTF-8"?>
<customUI onLoad="Ribbon_Load" xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon>
<tabs>
<tab idMso="TabAddIns" label="ValueExplorer">
<group id="grpModel" label="Model Manager">
<button id="btnOpenModel" onAction="btnOpenModel_Click" label="Open Model" showImage="false" />
<button id="btnNewModel" onAction="btnNewModel_Click" label="New Model" showImage="false" />
<button id="btnPublish" onAction="btnPublish_Click" label="Publish VXP Model" showImage="false" />
</group>
<group id="grpVersion" label="Version Manager">
<button id="btnNewVersion" onAction="btnNewVersion_Click" label="New Version" showImage="false" />
<button id="btnOpenVersion" onAction="btnOpenVersion_Click" label="Open Version" showImage="false" />
</group>
<group id="grpObject" label="Object Manager">
<button id="btnNewObject" onAction="btnNewObject_Click" label="New Object" showImage="false" />
<button id="btnOpenObject" onAction="btnOpenObject_Click" label="Open Object" showImage="false" />
</group>
<group id="grpUser" label="User Manager">
<button id="btnNewUser" onAction="btnNewUser_Click" label="New User" showImage="false" />
<button id="btnEditUser" onAction="btnEditUser_Click" label="Edit User" showImage="false" />
</group>
<group id="grpScenario" label="Scenario Manager">
<button id="btnNewScenario" onAction="btnNewScenario_Click" label="New Scenario" showImage="false" />
<button id="btnActivate" onAction="btnActivate_Click" label="Activate" showImage="false" />
<button id="btnVarience" onAction="btnVarience_Click" label="Varience Report" showImage="false" />
<separator id="separator1" />
<button id="btnOpenScenario" onAction="btnOpenScenario_Click" label="Open Scenario" showImage="false" />
<button id="btnGroup" onAction="btnGroup_Click" label="Group Scenarios" showImage="false" />
<button id="btnSaveScenario" onAction="btnSaveScenario_Click" label="Save Scenario" showImage="false" />
</group>
<group id="grpSensitivity" label="Sensitivity Manager">
<button id="btnNewSensitivity" onAction="btnNewSensitivity_Click" label="New Sensitivity" showImage="false" />
<button id="btnOpenSensitivity" onAction="btnOpenSensitivity_Click" label="Open Sensitivity" showImage="false" />
<button id="btnSaveSensitivity" onAction="btnSaveSensitivity_Click" label="Save Sensitivity" showImage="false" />
</group>
<group id="grpTracer" label="Tracer">
<button id="btnView" onAction="btnView_Click" label="View" showImage="false" />
</group>
<group id="grpCalc" label="Calculation">
<checkBox id="chkAutoRecalc" onAction="chkAutoRecalc_Click" label="Auto" />
<button id="btnRecalcNow" onAction="btnRecalcNow_Click" label="Recalc Now" showImage="false" />
</group>
<group id="grpConfig" label="Config Manager">
<button id="btnETLConfig" onAction="btnETLConfig_Click" label="ETL Config" showImage="false" />
<button id="btnSysConfig" onAction="btnSysConfig_Click" label="System Config" showImage="false" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>
I have also created the callbacks for the OnAction event as such:
<pre>public void OnActionCallback(Office.IRibbonControl control, bool isPressed)
{
if (control.Id == "btnNewVersion_Click")
{
//MessageBox.Show("You clicked " + control.Id);
Form frmNewModel = new Form();
frmNewModel.Show();
}
else
{
MessageBox.Show("You clicked a different control.");
}
}
But i still can't get any functionailty out of it. I have successfully added the ribbon to the workbook as a tab but also have some default menu items displaying even after setting the StratFromScratch property to true.
Please help where you can.
Thanks
"Sex is not the answer, it's the question and the answer is yes"
|
|
|
|
|
G'day all
I've almost finished working onn a word processor and last night somethin very weird happened. I added a new blank tab to my sexy tab control and saved changes, then I thought I'd give it a rest and turn off the computer. Well, this morning, I switched on and to my surprise, all my combo boxes, buttons (68, to be exact) had all been removed from my toolStrip. Now, The code for each of my controls is still in the code view but the only things missing are the ones inside the toolStrip (tab control is still there).. Has anybody had this problem before? Does Visual Studio have some magical invisible button that I must have unknowingly clicked to remove those controls? Any thoughts on this? I'm mystified...
regards
jay
|
|
|
|
|
Hi Jay,
I’ve seen this many times in my own projects but have [Edit!] never found out why. The most common post in internet forums suggests that the reason is the presence of duplicate resource files but that has never been the case in my situation. I always find that the code to add the controls to the toolstrip has been removed by VS and it is a simple matter to edit the designer file to fix this.
A simple example:
Before the error
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.Status});
this.statusStrip1.Location = new System.Drawing.Point(0, 636);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Padding = new System.Windows.Forms.Padding(1, 0, 21, 0);
and after the error
this.statusStrip1.Location = new System.Drawing.Point(0, 636);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Padding = new System.Windows.Forms.Padding(1, 0, 21, 0);
I hope the fix is as simple for you and if you do come up with a reason for the error please post back as I'd love to know!
Alan.
modified on Saturday, May 23, 2009 3:08 PM
|
|
|
|
|
Thank you for the reply and code Alan, I'll be trying to figure out why this has happened and will definately post the reason for it if I can figure it out.
regards,
jason pezzimenti.
|
|
|
|
|
I often have a similar problem. All my buttons, comboBoxes, textBoxes, and checkBoxes suddenly disappear, but my groupBoxes and other containers are still there. If I click and drag the select the region containing the buttons, etc. then their outlines all show up. Then I just slightly resize one of them (affects them all since they're all selected) and like magic they all show up. Then I Ctrl+Z the resize and everything's back to normal. Still haven't figured out why this happens. Could be the resource file issue mentioned above, but I haven't really checked.
Dybs
|
|
|
|
|
Never underestimate the power of the backup! I have a scheduled task that runs every couple of hours and copies all my current working project files to a backup directory (it creates a new time-stamped directory each time).
At worst I might lose a couple of hours work, which is a nuisance but not a disaster.
There are three kinds of people in the world - those who can count and those who can't...
|
|
|
|
|
Videos provide look into how you can support Windows 7 in your applications.
MSDEV.com[^] has produced a set of videos giving developers a look into Windows 7 coding. You can view the videos in the series main page, A Developer's First Look at Windows 7[^].
This series introduces Windows 7 with an emphasis on those new features that will be of most interest and use to developers. It consists of: two introductory sessions, one focusing on the new user interface, and one on behind-the-scenes features, two hour-long sessions that cover compatibility and security issues, six shorter sessions which focus on coding for a single new feature.
For more information, see See Windows 7 From a Developer Point of View in msdev.com Videos[^].
|
|
|
|
|
I have all the code necessary (I think) to perform a drag and drop into word... but I am having trouble with pictures... any kind of Bitmap or Image does not drop properly into word, it does something but then acts as if I didn't drop anything it understood.... However, the same code works for dragging and dropping onto other office apps (e.g. Excel and Powerpoint).
The code looks like this:
<br />
private void pictureBox1_MouseMove(object sender, MouseEventArgs e)<br />
{<br />
if (_mouseIsDown)<br />
{<br />
IDataObject obj = new DataObject(DataFormats.Bitmap, pictureBox1.Image);<br />
this.DoDragDrop(obj, DragDropEffects.All);<br />
}<br />
}<br />
Any one have any idea what I'm doing wrong? (and for the record, I have tried it without using IDataObject as well, just directly putting the image into the data argument... oh and I also tried creating a "new Bitmap(pictureBox1.Image)" and putting that in the data argument...
To no avail....
A) Can anyone reproduce the issue at hand
B) Does anyone know what I'm doing wrong? Do I need to use OLE directly or something?
Thanks
Chadwick Posey
=============================
I'm a developer, he's a developer, she's a developer, we're developers, Wouldn't ya like to be a developer too?
|
|
|
|
|
Welp this is as close as I could figure out.
You cannot do it directly in memory (as far as I can tell), but here is the code emulating something close to dragging and dropping a file from explorer into word:
<br />
string[] files = new string[1];<br />
files[0] = @"C:\someimage.jpg";<br />
IDataObject d = new DataObject();<br />
d.SetData(DataFormats.FileDrop, files);<br />
<br />
if (this.DoDragDrop(d, DragDropEffects.Copy) == DragDropEffects.Copy)<br />
{<br />
}<br />
Still cannot figure out why I cannot just drag and drop an image directly though.... would love to know what I could do differently.
=============================
I'm a developer, he's a developer, she's a developer, we're developers, Wouldn't ya like to be a developer too?
|
|
|
|
|
Hi All,
Just came across a strange issue recently.
Maybe its a bug in the framework or something ?
I have 2 processes running , each with its own winform UI, say host application and external application. The host application has a user control and a context menu defined for that user control, plus some blank panels. The external application also has a user control and context menu defined on it.
Now lets say do a SetParent across processes(i know, i know but that`s what the applications must do right now), with the host process` panel as the parent handle, and the external application`s user control is made its child window, then the context menu`s show unusual behavior i.e we can have both their context menus visible simultaneously !
I`m using the contextmenustrip class of dot net 2.0 and this issue doesn`t seem to occur for the older 1.1 context menu classes (in the same scenario).
Is this a known issue with the newer 2.0 class ?
Are there any workarounds to rectify this behavior ?
Is there any way I can get to know the context menu started, closed events across processes if required?
Any help is most appreciated.
Thanks in advance.
|
|
|
|
|
How to use windows application with in the LAN developed in vb.net 2005 with sqlserver express edition 2005
had problem in connnectiostring mapping
|
|
|
|