|
You can filter the code since now you have the API's you would need to achieve this.
Alternatively, you can try using BOOL IsProcessInJob(HANDLE ProcessHandle,HANDLE JobHandle,PBOOL Result);
Pass JobHandle as NULL and you can get if the process is running under any job.
Haven't tried this, but it should work and suffice your needs.
Let me know if it helped.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Thanxxxxxxxx...
Its working in Visual Studio 2005.
but how can i use it in visual studo 6.0.
It shows error for psAPI.h file is not found.
|
|
|
|
|
google for psapi.dll, the best place to put the file is in your system32 folder and then link to this library. hope this helps
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
|
Member 3220373 wrote: one of my process( eg. wmplayer.exe) is running then
i have to execute my statemnt.
If you just want to check if the process is running
Does GetProcessID[^] help?
Regards,
Sandip.
|
|
|
|
|
Hi again I was wondering if somebody could help me with this program I cant get it to stop displaying 32 so that I can check if the program actually works. here is my code. Thanks in advance if anyone can help
// LanusPassword.cpp : Defines the entry point for the console application.
//Corey Lanus
//Program # 10
//Lanus Password
//Verifies that the password meets the requirements
//November 10, 2008
#include "stdafx.h"
#include <iostream>
#include <cstring>
#include <cctype>
using namespace std;
int main()
{
const int size=10;
string pass;
int length;
int caps=0;
int num=0;
int low=0;
cout << "Please enter a 10 character password.\n";
cout << "You must make sure your password has at\n";
cout << "least two uppercase and at least one\n";
cout << "lowercase letter and atleast 1 number.\n";
cin >> pass;
length = sizeof(pass);
cout << length <<endl;
while (length != 10)
{
cout << "You can only enter 10 characters. Please type again.\n";
cin >> pass;
length = sizeof(pass);
}
for (int cnt=0; cnt<size;>{
cout << pass[cnt] << " ";
}
// New line
cout << endl;
for (int i=0; i<size;>{
cin >> pass[i];
if (isdigit(pass[i]))
num=num+1;
if (isupper(pass[i]))
caps=caps+1;
if (islower(pass[i]))
low=low+1;
}
while (caps<2 || low < 1 || num < 1)
{
num=0;
caps=0;
low=0;
cout << "You must make sure your password has at\n";
cout << "least two uppercase and at least one\n";
cout << "lowercase letter and atleast 1 number.\n";
cin >> pass;
for (int i=0; i<size;>{
cin >> pass[i];
if (isdigit(pass[i]))
num=num+1;
if (isupper(pass[i]))
caps=caps+1;
if (islower(pass[i]))
low=low+1;
}
}
cout << "Your password: " << pass << ", is good and excepted.\n";
return 0;
}
|
|
|
|
|
LilKoopa wrote: while (length != 10)
Your code would only work if the length of the "pass" string is returned as 10. You need to check the condition in the while loop first
LilKoopa wrote: cout << length <<endl;
This line, above the while loop would be printing 32 ie the size of pass variable since the length would always be greater than 10
LilKoopa wrote: so that I can check if the program actually works
I hope that you can now check the program after modifying the condition for the while loop
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
sizeof(pass) always returns 4 - it's returning the size in bytes of the pointer that points to the string, not the actual length of the string itself..
if you change
string pass;
to
char pass[100];
and all occurances of
sizeof(pass)
to
strlen(pass)
You'll get code that correctly counts the number of letters in the password. The logic in your code then gets a bit funky, and I can't quite tell what you're trying to do there. Often things become much more clear when you separate out the individual parts of a problem into their own functions.
Might I suggest a different approach to this problem?
#include <iostream>
using namespace std;
int countNumChars(char *str)
{
}
int countLowerChars(char *str)
{
}
int countUpperChars(char *str)
{
}
bool isValidPassword(char *password)
{
int len, numberChars, lowerCaseChars, upperCaseChars;
bool result = false;
len = strlen(password);
numberChars = countNumChars(password);
lowerCaseChars = countLowerChars(password);
upperCaseChars = countUpperChars(password);
result = ((len==10)&&(lowerCaseChars>=1)&&(upperCaseChars>=2)&&(numberChars>=1));
return result;
}
int main()
{
char pass[100];
cout << "Please enter a 10 character password.\n";
cout << "You must make sure your password has at\n";
cout << "least two uppercase and at least one\n";
cout << "lowercase letter and at least 1 number.\n";
cin >> pass;
while (!isValidPassword(pass))
{
cout << "Invalid Password. Please type again.\n";
cin >> pass;
}
cout << "Your password: " << pass << ", is good and accepted.\n";
system("pause");
return 0;
}
|
|
|
|
|
Hi,
Before this, I managed to compile my CSP code and its already work in XP. The step that I take was:
1-compile my csp program- Visual Studio 2005
2-replace the advapi32.dll (for xp)
3-register the dll
--> copy the dll to system32
--> register the dll -regsvr32 xxx.dll
The problems comes when I want to build the CSP in Vista platform. Currently I'm using Vista Ultimate.
I can compile my csp program - Visual Studio 2005.
But, I cannot replace the advapi32.dll for Vista platform in Windows\System32.
I got error:
Destination Folder Access Denied
- You need permission to perform this action.
But I still try to register the dll-I got the error :
CryptAcquireContext returned error 80090019
Do you have any idea on how to solve this problem? What I mean is how to develop the CSP in Vista?
Thank You.
regards,
Yani
|
|
|
|
|
HI,
I am doing visual c++ 2003, and I want to ask about how to convert the data type format ( TotalSeconds) to date format, I know how to convert from date format to total seconds but how to convert in the reverse way, I don't know
this is the way that I convert from date format to total seconds
Ctime Now = CTime::GetCurrentTime();
CTime UCT(0);
CTimeSpan Diff = Now - UCT;
return Diff.GetTotalSeconds();
but how to convert in the reverse way
I would be grateful if you guys can help me
Regards,
Arif Liminto
|
|
|
|
|
arifliminto86 wrote: but how to convert in the reverse way
I am not sure that I understand your question but I believe that you are asking how to convert a 64 bit integer containing CTime total seconds back into a CTime object. If this is what your looking for then perhaps the following code will help.
CTime tNow = CTime::GetCurrentTime();
OutputDebugString(tNow.Format(_T("Current Time: %A, %B %d, %Y\n")));
LONGLONG i64TotalSeconds = tNow.GetTime();
CTime tBack(i64TotalSeconds);
OutputDebugString(tBack.Format(_T("Converted Time: %A, %B %d, %Y\n")));
Best Wishes,
-David Delaune
|
|
|
|
|
Store your number of seconds in a time_t variable and pass it to one
of the functions that takes a time_t (or time_t *); then process the
result.Eg
int main ()
{
time_t rawtime;
struct tm * timeinfo;
time ( &rawtime );
timeinfo = localtime ( &rawtime );
printf ( "The current date/time is: %s", asctime (timeinfo) );
return 0;
}
Hope it helps
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
|
Hello, can anyone give me a suggestion about how can I draw my windows application without the windows system border? Like those Yahoo widget which floating in the desktop? Which GUI SDK support this feature? Thanks!
Nacho
|
|
|
|
|
It's just a matter of the style used when the call to CreateWindowEx is made.
If I use a style of WS_VISIBLE|WS_POPUP|WS_SYSMENU|WS_MINIMIZEBOX
and a styleEx of WS_EX_APPWINDOW
I get a window without a border, that has an entry on the task-bar and who may be minimized or closed from the system-menu, activated by right-clicking the task-bar entry for the program.
See this project for a quick demo: Clock Application[^]
|
|
|
|
|
hello Friends,
i need simple accounting software source code in Visual C++ for learn more about accounting software projects . Please help me if possible
Thanx
|
|
|
|
|
So what you want is for us to give you full source code for accounting software so you can "learn" from it (aka use bits of the code)?
Oh, of course!
Regards,
--Perspx
"A refund for defective software might be nice, except it would bankrupt the entire software industry in the first year." -Andrew Tanenbaum
"Einstein argued that there must be simplified explanations of nature, because God is not capricious or arbitrary. No such faith comforts the software engineer." -Fred Brooks
|
|
|
|
|
You are asking the same thing in multiple forums. DO YOUR OWN WORK.
Blog link to be reinstated at a later date.
|
|
|
|
|
Geeze, the OP spammed/cross posted this forum, too
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
As long as he's not cross-dressing across forums.
Blog link to be reinstated at a later date.
|
|
|
|
|
Hi guys, I've written an application in pure C++ and the command line and now I'd like to convert it to Windows.
I am at the very first steps in using MFC and I am wondering if anyone could be kind enough to help.
To simplify the problem, let's suppose my application is composed of 2 input edit text boxes (Box1, Box2), a button (Calculate), and 1 output textbox (Box3). What is the correct code required to display the result of the calculation (Box1+Box2) in the output textbox (Box3)?
I've read 1300 pages of the excellent Ivor Horton's Beginning C++ 2008 book....only to discover that this simple topic is not covered!!
Many thanks
jEDI
|
|
|
|
|
J_E_D_I wrote: What is the correct code required to display the result of the calculation (Box1+Box2) in the output textbox (Box3)?
Call SetWindowText() , or send the control a WM_SETTEXT message.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Thanks to both of you. I'll try it soon and let you know.
jEDI
|
|
|
|
|
in MFC you may also map the three textboxes to three integer variables and use the UpdateData mechanism see [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I know that you can use the pragma comment directive in your code to link to a specific .lib file. Is it possible to also use this to pull in a .res file?
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
VCF Blog
|
|
|
|