|
Yes[^].
Although you can make one of your own.
The word "politics" describes the process so well: "Poli" in Latin meaning "many" and "tics" meaning "bloodsucking creatures."
जय हिंद
|
|
|
|
|
I'm pretty new to coding to the Win32 API, so this may be a newbie question:
I've got an application writen in VB6 that opens a PDF document in Adobe Acrobat Reader with the /p switch, so that it shows the print dialog window. When the user clicks "ok", I want the document to print and Acrobat Reader to close.
I open Acrobat Reader using the Shell command, and I close it by sending WM_CLOSE messages to the process (following examples I found online).
This all worked fine when I was using Acrobat Reader version 7, but I recently upgraded to version 9, and now I'm finding that the task manager shows AcroRd32 running even after all the windows have closed. This is a problem, since if the user tries to print a second document, a new window doesn't open and no print dialog window appears.
I can get the process id, and I've tried using TerminateProcess to end it, using code:
lngResult = TerminateProcess(lngProcessId, 0&)
This returns a zero, which I understand means that an error has occurred, but GetLastError also returns a zero, which seems to mean no error was trapped.
Can anyone help me understand what's going on, or what I'm missing here? Thanks very much for your help!
|
|
|
|
|
see this
http://www.dotnetfunda.com/articles/article191.aspx[^][^]
Hope it Helps
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
www.ITS.co.za
|
|
|
|
|
Thanks Vuyiswa, but that solution uses dot net, and I'm using VB6.
For those interested, I did find a solution:
Private Const PROCESS_TERMINATE = 1
Dim lProcessHandle As Long, lResult As Long, lMyProcessID as Long
lProcessHandle = OpenProcess(PROCESS_TERMINATE, True, lMyProcessID )
lResult = TerminateProcess(lProcessHandle, 0&)
which seems to work. I think my problem was that I was trying to send TerminateProcess lMyProcessID instead of lProcessHandle ...
|
|
|
|
|
Welcome, Did you consider moving to .NET ?
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
www.ITS.co.za
|
|
|
|
|
I have considered it, but I am not primarily a VB programmer. I spend most of my time in the Notes/Domino web world -- LotusScript, JavaScript, HTML, and some of the rest on the iSeries (RPG). The VB apps we have are just oddball little things -- this one prints a PDF file automatically from an RPG program -- and since I'm reasonably comfortable in VB6 that's what I did it in.
I've heard that moving to .NET is a big learning curve, so up to now I've stayed away from it ...
|
|
|
|
|
Then when you get Stuck you wont get help
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
www.ITS.co.za
|
|
|
|
|
Hello once again guys.
I used this coding for the showing of date and time. this is supposed to appear when i press a command button named "new record".
text1=date
text2=time
But this doesn't work! Any better one for time and date?
ST
|
|
|
|
|
How about DateTime.Now()?
Dim currentTime As DateTime = DateTime.Now()
TextBox1.Text = currentTime.ToShortDateString()
TextBox2.Text = currentTime.ToShortTimeString()
|
|
|
|
|
Well, i don't know much but does this show the current time on your computer in a textbox?
Thankyou
ST
|
|
|
|
|
|
Well, i tried it but it is giving a compile error: syntax error and this gets highlighted
Dim currentTime As DateTime = DateTime.Now()
What could the problem be?
Thankyou!
ST
|
|
|
|
|
I think you're using VB6, that is the problem.
|
|
|
|
|
you are right. i am using vb6. is there any better way of doing this?
Regards
ST
|
|
|
|
|
|
Use VB.Net? If I remember correctly there is a Date type in VB and you just need to do something like:
Dim myDate as Date
myDate = Now()
I could be wrong it's over 5 years since I last used VB6 and my memory's not what it was.
If you are using VB6 then my suggestion (for your previous question) to use the ErrorProvider won't help you (it's a VB.Net control).
Regards
David R
|
|
|
|
|
ShayanTanwir wrote: is there any better way of doing this?
yes there is.
For one, choose a modern language. VB6 is 20 years old and obsolete; today's Basic is called VB.NET
Once you are sure about the language choice, learn it in a decent way: follow a course, or buy and study a book (a physical book, not an e-book, and no I am not recommending any particular one, go browse some in a book store).
Then read some of the articles here on CodeProject and start experimenting.
Don't try and do it without good fundamentals, it does not work.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Luc Pattyn wrote: VB6 is 20 years old
No its not, it only came out about 1999. If I've told you once, I've told you a million times, don't exaggerate!
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Ashfield wrote: VB6 is 20 years old ... No its not
Correction: VB is 20 years old and VB6, its last incantation, is now obsolete.
Is that better?
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Yes, much. You mustn't confuse those poor souls who are still using it - most of them aren't 20 years old
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
happy to oblige
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Ashfield wrote: No its not, it only came out about 1999
Excuse me, but I beg to differ. I clearly remember VB6 rearing its ugly head somewhere toward the end of 1998. Oh, how I loathe the Dark Ages.
|
|
|
|
|
Quite possibly. To many beers ago to remember
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
If you're going to ask questions on any forum, not just CP's, you really need to specify that you're using VB6. Everyone will assume you're using VB.NET since VB6 has not been support by Microsoft for quite some time now.
|
|
|
|
|
We should boycott all VB6 questions in the forum!!!!
Until I get stuck on some dumb legacy code and need help.
It would help if the OP would be a bit more specific. Very rarely is there too much info. in the orig. post.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|